./gradlew clean from the React Native project's android/ directory.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
This issue still exists in [email protected].
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
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.
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'
}
@rborn that should solve the issues you're having?
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).
@shockdesign the app/build.gradle dependencies alone (without upgrading Gradle) do not resolve the issue.
@sunweiyang you have to upgrade Gradle as Detox 7 relies on changes in Gradle to work properly.
@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:
newOkhttpDebug line I get a flavorDimensions not existent error.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!
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.
@rborn Sorry, your debugImplementation should be androidTestImplementation but that should work with just project(path: ":detox")) and no configuration
@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 馃様
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.
The issue has been closed for inactivity.
Related to: https://github.com/wix/detox/issues/774
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.
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
@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.
We have bigger problems 馃槪
Hi Friends,
I think Issue still exists, I have asked a question on StackOverflow.
Any help ?
Most helpful comment
This issue still exists in [email protected].