Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In detox/build.gradle: Could not find method minReactNative44Implementation() #516

Closed
sunweiyang opened this issue Jan 13, 2018 · 20 comments

Comments

@sunweiyang
Copy link

Description / Steps to Reproduce

This results in the following output:

Running  ./gradlew clean ...
Starting a Gradle Daemon (subsequent builds will be faster)
Reading env from: .env
Reading env from: .env

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/sunw/Skale/Repos/skale-react-native/Skale/node_modules/detox/android/detox/build.gradle' line: 60

* What went wrong:
A problem occurred evaluating project ':detox'.
> Could not find method minReactNative44Implementation() for arguments [com.squareup.okhttp3:okhttp:3.4.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 7.0.0-alpha.0
  • Node: 5.6.0
  • Device: MacBook Pro 2016
@sunweiyang
Copy link
Author

This issue still exists in [email protected].

@rborn
Copy link

rborn commented Feb 20, 2018

Same for 7.1.0
I tried to follow the gradle 3 instructions but the app won't even compile :(

SO: https://stackoverflow.com/questions/48876569/reacct-native-on-android-cannot-compile-app

Thanks

@shockdesign
Copy link

shockdesign commented Feb 28, 2018

Upgrading Gradle worked for me...

Modified build.gradle in the root android folder

 buildscript {
     repositories {
         ....
         google()
     }
     dependencies {
         ....
         classpath 'com.android.tools.build:gradle:3.0.1'
     }
 }

Also had to modify gradle/wrapper/gradle-wrapper.properties off the root Android folder

To make sure gradle package was updated

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

And that seemed to work without any issues.

@shockdesign
Copy link

Also make sure in the app/build.gradle file you have this..

dependencies {
    ....
    androidTestCompile(project(path: ":detox", configuration: "newOkhttpDebug"), {
      exclude group: 'com.android.support', module: 'support-annotations'
    })
    androidTestCompile 'junit:junit:4.12'
    androidTestCompile 'com.android.support.test:runner:1.0.1'
    androidTestCompile 'com.android.support.test:rules:1.0.1'
}

@shockdesign
Copy link

shockdesign commented Feb 28, 2018

@rborn that should solve the issues you're having?

@sunweiyang
Copy link
Author

Is there a solution that does not involve updating Gradle? It'd be nice to have Detox work right after react-native init (especially since that's generally more compatible with other RN libraries).

@sunweiyang
Copy link
Author

@shockdesign the app/build.gradle dependencies alone (without upgrading Gradle) do not resolve the issue.

@shockdesign
Copy link

@sunweiyang you have to upgrade Gradle as Detox 7 relies on changes in Gradle to work properly.

@rborn
Copy link

rborn commented Mar 2, 2018

@shockdesign I updated based on your suggestions and https://developer.android.com/studio/build/gradle-plugin-3-0-0-migration.html but I get 2 errors now:

  1. If I add the newOkhttpDebug line I get a flavorDimensions not existent error.
  2. If I just do debugImplementation(project(path: ":detox")) the app compiles, gets intalled on the genymotion sim or real device but then it doesn't start and will lead to a timeout error.

Any ideas?

Thank you!

@stale
Copy link

stale bot commented Apr 16, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.

@stale stale bot added the 🏚 stale label Apr 16, 2018
@shockdesign
Copy link

@rborn Sorry, your debugImplementation should be androidTestImplementation but that should work with just project(path: ":detox")) and no configuration

@stale stale bot removed the 🏚 stale label Apr 17, 2018
@rborn
Copy link

rborn commented Apr 17, 2018

@shockdesign I managed to fix it, but I don't remember what I did, it was me doing some stupid thing (more than sure I was changing stuff in the wrong place). Thanks for the reply and sorry for not getting back in time 😔

@stale
Copy link

stale bot commented Jun 1, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.

@stale stale bot added the 🏚 stale label Jun 1, 2018
@stale
Copy link

stale bot commented Jun 8, 2018

The issue has been closed for inactivity.

@stale stale bot closed this as completed Jun 8, 2018
@noomorph
Copy link
Collaborator

Related to: #774

@rotemmiz
Copy link
Member

Not really related since this is a build time dependency, the computer does a great job at stopping bad configurations/broken dependencies. Running tests however has no validation, I want to add runtime validation to versions of cli tools we use.

@rotemmiz
Copy link
Member

Though this issue is closed, I would like to address a few of the issues raised here.

There are two flavours to detox Android, one for rn44-45, and the other for 46 and up. Please make sure you read the Android setup docs.

newOkhttpDebug is the old API, it was changed between Detox 6 and 7

@noomorph
Copy link
Collaborator

@rotemmiz , I see your point. In any case, it could be a more user-friendly error message, so maybe it's a nice-to-have one.

@rotemmiz
Copy link
Member

We have bigger problems 😣

@neerajkumar-lad
Copy link

Hi Friends,
I think Issue still exists, I have asked a question on StackOverflow.

https://stackoverflow.com/questions/51305555/could-not-find-method-missingdimensionstrategy-for-arguments-minreactnative

  • Xcode : 9.4.1
  • node : v10.6.0
  • npm : 6.1.0
  • react-native-cli: 2.0.1
  • react-native: 0.56.0

Any help ?

@wix wix locked and limited conversation to collaborators Jul 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants