Android 4.4上的OneSignal崩溃

问题描述 投票:1回答:1

我在Unity中集成了OneSignal并将其构建到Android平台中。我在Crashlytics收到一些关于OneSignal的崩溃日志。我做了一些研究,我看到这个错误是在os 4.4中触发的。我的应用程序有两个人触发它,他们使用的是os 4.4设备。我看到一些参考,他们说我需要启用multiDex选项。但我已经启用了它。所以我不知道如何解决它。有人知道怎么解决吗?谢谢。

以下是我在Crashlytics收到的崩溃日志。

Caused by java.lang.VerifyError: com/onesignal/LocationGMS
       at com.onesignal.OneSignal.onAppLostFocus(OneSignal.java:1062)
       at com.onesignal.ActivityLifecycleHandler$AppFocusRunnable.run(ActivityLifecycleHandler.java:171)
       at android.os.Handler.handleCallback(Handler.java:733)
       at android.os.Handler.dispatchMessage(Handler.java:95)
       at android.os.Looper.loop(Looper.java:136)
       at android.os.HandlerThread.run(HandlerThread.java:61)

这是我的傻瓜

// GENERATED BY UNITY. REMOVE THIS COMMENT TO PREVENT OVERWRITING WHEN EXPORTING AGAIN
buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
    }
}

allprojects {
   repositories {
      flatDir {
        dirs 'libs'
      }
   }
}

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:multidex:1.0.1'
    compile project(':fabric-init')
    compile project(':fabric')
    compile project(':crashlytics')
    compile project(':crashlytics-wrapper')
    compile project(':answers')
    compile project(':beta')
    compile project(':OneSignalConfig')
    compile project(':SuperAwesome_lib')
    compile project(':unity-android-resources')
    compile files('libs/unity-classes.jar')
    compile(name: 'common', ext: 'aar')
    compile(name: 'GoogleAIDL', ext: 'aar')
    compile(name: 'GooglePlay', ext: 'aar')
    compile(name: 'Helpshift', ext: 'aar')
    compile(name: 'com.android.support.animated-vector-drawable-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.appcompat-v7-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.cardview-v7-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.customtabs-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.design-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.recyclerview-v7-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-compat-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-core-ui-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-core-utils-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-fragment-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-media-compat-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-v4-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.support-vector-drawable-27.1.1', ext: 'aar')
    compile(name: 'com.android.support.transition-27.1.1', ext: 'aar')
    compile(name: 'android.arch.core.runtime-1.1.0', ext: 'aar')
    compile(name: 'android.arch.lifecycle.livedata-core-1.1.0', ext: 'aar')
    compile(name: 'android.arch.lifecycle.runtime-1.1.0', ext: 'aar')
    compile(name: 'android.arch.lifecycle.viewmodel-1.1.0', ext: 'aar')
    compile(name: 'UnityAds', ext: 'aar')
    compile(name: 'com.google.firebase.firebase-iid-12.0.1', ext: 'aar')
    compile(name: 'installreferrer-1.0', ext: 'aar')
    compile(name: 'onesignal-unity', ext: 'aar')
    compile(name: 'com.google.android.gms.play-services-iid-12.0.1', ext: 'aar')
}

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.1'

    defaultConfig {
        targetSdkVersion 26
        applicationId 'com.xxxxx.xxxxx'
        multiDexEnabled true
        versionCode 41
        versionName "1.0.30"
        minSdkVersion 16
    }

    lintOptions {
        abortOnError false
    }

    aaptOptions {
        noCompress '.unity3d', '.ress', '.resource', '.obb'
    }

    dexOptions{
        javaMaxHeapSize "2g"
    }

    buildTypes {
            debug {
                jniDebuggable true
            }
            release {
                // Set minifyEnabled to true if you want to run ProGuard on your project
                // minifyEnabled true
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt'
                signingConfig signingConfigs.release
            }
        }
}
android unity3d gradle onesignal multidex
1个回答
0
投票

设置multidex有很多步骤,一个似乎你可能错过的一个重要的步骤是由于你的android:name从你的<application>标签看到的AndroidManifest.xml错误

<application
    android:name="android.support.multidex.MultiDexApplication" >
</application>

下面有一个详细的指南,我建议您查看以确保在Unity项目上使用multiDex正确设置所有内容https://appmediation.com/unity-enable-multidex/

© www.soinside.com 2019 - 2024. All rights reserved.