在Proguard上阻止Android上的react-native-detox构建

时间:2018-10-01 09:15:56

标签: react-native detox

我一直在尝试使用排毒测试e2e。 RN 0.57.0

我遵循了android的集成步骤,但是在尝试编译项目时受阻。 detox build -c android.emu.debug

当我运行普通的./gradlew assembleRelease命令时,它可以完美构建。

    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$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$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.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)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithProguardForReleaseAndroidTest'.
> Job failed, see logs for details

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

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 30s
child_process.js:644
    throw err;
    ^

也许排毒需要另一个proguard文件?

----更新---- 这是我的build.gradle依赖项:

dependencies {
    compile project(':rn-fetch-blob')
    implementation project(':react-native-firebase')
    implementation project(':react-native-image-resizer')
    implementation project(':react-native-zendesk-support')
    implementation project(':bugsnag-react-native')
    implementation project(':react-native-fast-image')
    implementation project(':react-native-calendar-events')
    implementation project(':react-native-contacts')
    implementation project(':react-native-device-info')
    implementation project(':react-native-image-picker')
    implementation project(':react-native-config')
    implementation project(':react-native-restart')
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:appcompat-v7:27.1.0"
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:recyclerview-v7:27.1.0'
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:cardview-v7:27.1.0'
    implementation 'com.google.android.gms:play-services-gcm:15.0.1'
    implementation "com.facebook.react:react-native:+"  // From node_modules
    // Firebase dependencies
    implementation "com.google.android.gms:play-services-base:15.0.1"
    implementation "com.google.firebase:firebase-core:15.0.2"
    implementation "com.google.firebase:firebase-analytics:15.0.2"

    implementation('com.crashlytics.sdk.android:crashlytics:2.9.3@aar') {
        transitive = true;
    }
    implementation project(':react-native-photo-view')
    implementation (project(':react-native-camera')) {
      implementation 'com.android.support:exifinterface:27.1.0'
      implementation ('com.google.android.gms:play-services-vision:15.0.1') {
          force = true
      }
    }
    implementation(project(':react-native-notifications')) {
        exclude group: 'com.google.firebase', module: 'firebase-messaging'
    }
    implementation("com.google.firebase:firebase-messaging:15.0.2") {
        implementation project(':react-native-notifications')
    }
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlinVersion"
    implementation project(':react-native-code-push')

    androidTestImplementation(project(":detox"))
    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test:rules:1.0.2'
}

不确定React Native依赖项是否有所作为... 也许版本不匹配?

0 个答案:

没有答案