OneSignal InAppMessageClickHandler在Android上使React Native应用崩溃

时间:2019-10-02 20:42:02

标签: android react-native onesignal

我继承了一个运行.53.0的旧版React Native应用。我正在升级到.61.1react-native-onesignal:3.4.1。该应用程序可成功构建和安装,但在Android上打开时,出现以下错误日志,则立即崩溃:

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/onesignal/OneSignal$InAppMessageClickHandler;
at com.myapp.app.MainApplication$1.getPackages(MainApplication.java:45)
at com.facebook.react.ReactNativeHost.createReactInstanceManager(ReactNativeHost.java:76)
at com.facebook.react.ReactNativeHost.getReactInstanceManager(ReactNativeHost.java:38)
at com.facebook.react.ReactDelegate.loadApp(ReactDelegate.java:103)
at com.facebook.react.ReactActivityDelegate.loadApp(ReactActivityDelegate.java:88)
at com.facebook.react.ReactActivityDelegate.onCreate(ReactActivityDelegate.java:83)
at com.facebook.react.ReactActivity.onCreate(ReactActivity.java:44)
at android.app.Activity.performCreate(Activity.java:7802)
at android.app.Activity.performCreate(Activity.java:7791)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1299)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3245)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3409)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2016)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)

Caused by: java.lang.ClassNotFoundException: Didn't find class "com.onesignal.OneSignal$InAppMessageClickHandler" on path: DexPathList[[zip file "/data/app/com.myapp.app-imlEjSJbzDUWgkV2ru8pdw==/base.apk"],nativeLibraryDirectories=[/data/app/com.myapp.app-imlEjSJbzDUWgkV2ru8pdw==/lib/arm64, /data/app/com.myapp.app-imlEjSJbzDUWgkV2ru8pdw==/base.apk!/lib/arm64-v8a, /system/lib64, /product/lib64]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:196)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 22 more

OneSignal在.53.0上运行良好。我们的app / buidld.gradle仅包含:

implementation(project(':react-native-onesignal')) {
        exclude group: 'com.google.android.gms'
        exclude group: 'com.google.firebase'
    }

依赖项和

        manifestPlaceholders = [
            onesignal_app_id: project.env.get("ONE_SIGNAL_KEY"),
            onesignal_google_project_number: "REMOTE"
        ]

在默认配置中。要尝试修复,我已在我的app / build.gradle中添加了插件,例如:

    repositories {
        maven { url 'https://plugins.gradle.org/m2/'}
    }
    dependencies {
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.4, 0.99.99]'
    }
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

dependencies {
    implementation 'com.onesignal:OneSignal:[3.11.2, 3.99.99]'
}

,但错误仍然存​​在。有什么想法我应该从这里开始吗?

0 个答案:

没有答案