I've been following this for a while but everytime I try to set up android it's unclear and I haven't been very successful.
Current state of detox is suppose to support android <=0.56, but I see it seems not completely true from this
I'm also confused with how I'm suppose to add dependencies.
androidTestImplementation(project(path: ":detox"))
or
androidTestCompile(project(path: ":detox", configuration: "oldOkhttpDebug"), {
exclude group: 'com.android.support', module: 'support-annotations'
})
When I try to run detox build -c android.emu.debug I get proguard errors:
Note: there were 27 duplicate class definitions.
(http://proguard.sourceforge.net/manual/troubleshooting.html#duplicateclass)
Warning: library class android.content.res.XmlResourceParser extends or implements program class org.xmlpull.v1.XmlPullParser
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$1: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.cache.Striped64$Cell: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1: can't find referenced class sun.misc.Unsafe
Warning: android.support.test.espresso.core.internal.deps.guava.util.concurrent.AbstractFuture$UnsafeAtomicHelper$1: can't find referenced class sun.misc.Unsafe
Warning: library class android.content.Intent depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlSerializer
Warning: library class android.content.IntentFilter depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.BitmapDrawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.graphics.drawable.Drawable depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.util.Xml depends on program class org.xmlpull.v1.XmlPullParser
Warning: library class android.util.Xml depends on program class org.xmlpull.v1.XmlSerializer
Warning: library class android.util.Xml depends on program class org.xmlpull.v1.XmlPullParser
Warning: there were 24 unresolved references to classes or interfaces.
You may need to add missing library jars or update their versions.
If your code works fine without the missing classes, you can suppress
the warnings with '-dontwarn' options.
(http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
Warning: there were 14 instances of library classes depending on program classes.
You must avoid such dependencies, since the program classes will
be processed, while the library classes will remain unchanged.
(http://proguard.sourceforge.net/manual/troubleshooting.html#dependency)
Hi @hkung77, you might want to look at this repo: https://github.com/semutmerah/rn-56-test-detox
This example is working fine on Mac machine, and able to run both iOS and Android test.
Also, as far as I know, RN 57 is not yet supported.
@semutmerah thanks a lot for the repo! I was getting an error about cannot find symbol because I didn't import my app MainActivity in the DetoxTest.java file.
@semutmerah The issue is about ProGuard errors. You don't face them in the repo you mentioned because ProGuard is disabled in there (see https://github.com/semutmerah/rn-56-test-detox/blob/master/android/app/build.gradle#L94).
I am also facing these ProGuard issues.
I solved my issues by using a different ProGuard file for testing via testProguardFile.
_android/app/build.gradle_
android {
// ...
defaultConfig {
// ...
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
testProguardFile 'proguard-test-rules.pro'
testBuildType System.getProperty('testBuildType', 'debug')
missingDimensionStrategy "minReactNative", "minReactNative46" //read note
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
_android/app/proguard-test-rules.pro_
# Proguard rules that are applied to your test apk/code.
# https://github.com/googlesamples/android-testing-templates/blob/master/AndroidTestingBlueprint/app/proguard-test-rules.pro
-ignorewarnings
-keepattributes *Annotation*
-dontnote junit.framework.**
-dontnote junit.runner.**
-dontwarn android.test.**
-dontwarn android.support.test.**
-dontwarn org.junit.**
-dontwarn org.hamcrest.**
-dontwarn com.squareup.javawriter.JavaWriter
-dontwarn org.mockito.**
Hoping it helps others as well!
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.
You're all right, we need to revamp the Android setup docs.
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.
Most helpful comment
You're all right, we need to revamp the Android setup docs.