应用在第一次运行时崩溃 将 Firebase 与 onesignal 一起使用时



最近,我已经将我的Firebase和OneSignal依赖项升级到最新版本,但是发生了一件奇怪的事情,应用程序第一次安装后,我打开它,它在1-2秒后直接压碎,但是当你第二次再次打开它时,它表现正常而不会压碎。

这是我的毕业生(应用级(:

apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.11.2'
}
}
repositories {
maven { url 'https://maven.google.com' }
}

android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.mohammed.skyquestionbank"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
manifestPlaceholders = [
onesignal_app_id               : 'my_id',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
dataBinding {
enabled true
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:exifinterface:27.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.flaviofaria:kenburnsview:1.0.7'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.onesignal:OneSignal:3.10.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'com.mikhaellopez:circularimageview:3.2.0'
implementation 'com.android.support:customtabs:27.1.1'
implementation 'com.android.support:support-media-compat:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.firebaseui:firebase-ui-auth:4.2.0'
implementation 'com.firebaseui:firebase-ui-database:4.0.1'
implementation 'com.google.firebase:firebase-database:16.0.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.mikepenz:materialdrawer:6.0.9'
implementation 'com.mikhaellopez:circularprogressbar:2.0.0'
implementation 'com.zekapp.library:progreswheelview:1.1.5'
}
apply plugin: 'com.google.gms.google-services'

这里是根级别

buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath 'com.google.gms:google-services:4.0.1'
classpath 'io.fabric.tools:gradle:1.25.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {url "https://jitpack.io"}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

这是粉碎日志:

--------- beginning of crash
10-11 00:26:41.282 5157-5157/com.example.mohammed.skyquestionbank      E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.mohammed.skyquestionbank, PID: 5157
java.lang.NoSuchMethodError: No static method zzac()Lcom/google      /firebase/iid/zzap; in class Lcom/google/firebase/iid/zzap; or its super     classes (declaration of 'com.google.firebase.iid.zzap' appears in /data/app/com.example.mohammed.skyquestionbank-1/base.apk:classes2.dex)             atcom.google.firebase.messaging.FirebaseMessagingService.zzb(Unknown Source)
at com.google.firebase.iid.zzb.onStartCommand(Unknown Source)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2864)
at android.app.ActivityThread.access$2100(ActivityThread.java:144)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1376)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
10-11 00:26:41.288 1146-1146/? E/EGL_emulation: tid 1146:     eglCreateSyncKHR(1865): error 0x3004 (EGL_BAD_ATTRIBUTE)

所以我自己解决了这个问题,最新版本的 Firebase-core 和 Firebase-auth 16.0.4 似乎存在问题,因为它们最近在今年 10 月刚刚发布。 我不得不将它们降级到 16.0.3 以匹配我的 Firebase 数据库 16.0.3。暗恋者逃脱了。

相关内容

  • 没有找到相关文章

最新更新