在发布模式下反应本地android应用崩溃

时间:2019-01-23 13:21:20

标签: android react-native react-native-android

我可以在模拟器上运行该应用,但无法为Android生成有效的APK。

我试图通过Android Studio运行该应用,并查看我得到的日志猫

    Process: com.app.app, PID: 22827
    java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/jni/IteratorHelper;.hasNext()Z"
        at com.facebook.react.bridge.CatalystInstanceImpl.initializeBridge(Native Method)
        at com.facebook.react.bridge.CatalystInstanceImpl.<init>(Unknown Source)
        at com.facebook.react.bridge.CatalystInstanceImpl.<init>(Unknown Source)
        at com.facebook.react.bridge.CatalystInstanceImpl$Builder.build(Unknown Source)
        at com.facebook.react.ReactInstanceManager.createReactContext(Unknown Source)
        at com.facebook.react.ReactInstanceManager.a(Unknown Source)
        at com.facebook.react.ReactInstanceManager$5.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:762)
01-23 16:29:51.854 22827-22841/? E/AndroidRuntime: FATAL EXCEPTION: Thread-2
    Process: com.app.app, PID: 22827
    java.lang.NoSuchMethodError: no non-static method "Lcom/facebook/jni/IteratorHelper;.hasNext()Z"
        at com.facebook.react.bridge.CatalystInstanceImpl.initializeBridge(Native Method)
        at com.facebook.react.bridge.CatalystInstanceImpl.<init>(Unknown Source)
        at com.facebook.react.bridge.CatalystInstanceImpl.<init>(Unknown Source)
        at com.facebook.react.bridge.CatalystInstanceImpl$Builder.build(Unknown Source)
        at com.facebook.react.ReactInstanceManager.createReactContext(Unknown Source)
        at com.facebook.react.ReactInstanceManager.a(Unknown Source)
        at com.facebook.react.ReactInstanceManager$5.run(Unknown Source)
        at java.lang.Thread.run(Thread.java:762)

我不知道这是哪里来的 我正在运行react-native -v 0.55

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 16
        compileSdkVersion = 27
        targetSdkVersion = 26
        supportLibVersion = "27.1.1"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.4'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

及以下依赖性

dependencies {
    compile project(':react-native-restart')
    compile project(':react-native-sentry')
    compile project(':react-native-gesture-handler')
    compile project(':react-native-version-number')
    compile project(':react-native-image-picker')
    compile project(':react-native-splash-screen')
    compile project(':react-native-vector-icons')
    compile project(':react-native-wheel-picker')
    compile fileTree(dir: "libs", include: ["*.jar"])
    compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
    compile "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.facebook.fresco:fresco:1.3.0'
    implementation 'com.facebook.fresco:animated-base-support:1.3.0'
    implementation 'com.facebook.fresco:animated-gif:1.3.0'
    implementation 'com.facebook.fresco:animated-webp:1.3.0'
    implementation 'com.facebook.fresco:webpsupport:1.3.0'
    implementation 'com.facebook.fresco:webpsupport:1.3.0'
}

更新

采用以下设置将progaurd设置应用于项目

-keep class com.facebook.imagepipeline.animated.factory.AnimatedFactoryImpl { public AnimatedFactoryImpl(com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory, com.facebook.imagepipeline.core.ExecutorSupplier); }

-keepclasseswithmembernames class * {
    native <methods>;
}

-ignorewarnings

-keep class * {
    public private *;
}

0 个答案:

没有答案