Firebase Unity SDK 4.3.0" java.lang.AbstractMethodError"

时间:2017-12-18 19:11:54

标签: android firebase unity3d firebase-authentication

我将Firebase Unity SDK更新到版本4.3.0并运行了Android解析器。现在,当游戏启动时,它会在场景开始加载后崩溃:

12-18 23:08:24.200  7493  7493 D AndroidRuntime: Shutting down VM
12-18 23:08:24.202  7493  7493 E AndroidRuntime: FATAL EXCEPTION: main
12-18 23:08:24.202  7493  7493 E AndroidRuntime: Process: com.**.**, PID: 7493
12-18 23:08:24.202  7493  7493 E AndroidRuntime: java.lang.Error: FATAL EXCEPTION [main]
12-18 23:08:24.202  7493  7493 E AndroidRuntime: Unity version     : 2017.2.0p4
12-18 23:08:24.202  7493  7493 E AndroidRuntime: Device model      : LeEco LEX720
12-18 23:08:24.202  7493  7493 E AndroidRuntime: Device fingerprint: LeEco/ZL1_NA/le_zl1:6.0.1/WEXNAOP5802101261S/letv01261206:user/release-keys
12-18 23:08:24.202  7493  7493 E AndroidRuntime: 
12-18 23:08:24.202  7493  7493 E AndroidRuntime: Caused by: java.lang.AbstractMethodError: abstract method "void com.google.firebase.auth.FirebaseAuth$AuthStateListener.a(com.google.firebase.auth.FirebaseAuth)"
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at com.google.firebase.auth.k.run(Unknown Source)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at android.os.Handler.handleCallback(Handler.java:751)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:95)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:154)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:6186)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:889)
12-18 23:08:24.202  7493  7493 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:779)

PS:我也从建立在Windows上迁移到构建在mac上,因此不得不更新android sdk

Android API            27  
Build Tools        27.0.2  
Platform Tools     27.0.0  
SDK Tools          26.1.1 
Play Services          46

在Temp \ GradleOut文件夹中由unity生成的Gradle文件

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

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

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

apply plugin: 'com.android.application'

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile(name: 'GoogleAIDL', ext:'aar')
    compile(name: 'GooglePlay', ext:'aar')
    compile(name: 'animated-vector-drawable-25.3.1', ext:'aar')
    compile(name: 'appcompat-v7-25.3.1', ext:'aar')
    compile(name: 'cardview-v7-25.3.1', ext:'aar')
    compile(name: 'common', ext:'aar')
    compile(name: 'customtabs-25.3.1', ext:'aar')
    compile(name: 'facebook-android-sdk-4.23.0', ext:'aar')
    compile(name: 'facebook-android-wrapper-7.10.0', ext:'aar')
    compile(name: 'firebase-analytics-11.6.0', ext:'aar')
    compile(name: 'firebase-analytics-impl-11.6.0', ext:'aar')
    compile(name: 'firebase-analytics-impl-license-11.6.0', ext:'aar')
    compile(name: 'firebase-analytics-license-11.6.0', ext:'aar')
    compile(name: 'firebase-app-unity-4.3.0', ext:'aar')
    compile(name: 'firebase-auth-11.6.0', ext:'aar')
    compile(name: 'firebase-auth-license-11.6.0', ext:'aar')
    compile(name: 'firebase-auth-unity-4.3.0', ext:'aar')
    compile(name: 'firebase-common-11.6.0', ext:'aar')
    compile(name: 'firebase-common-license-11.6.0', ext:'aar')
    compile(name: 'firebase-core-11.6.0', ext:'aar')
    compile(name: 'firebase-iid-11.6.0', ext:'aar')
    compile(name: 'firebase-iid-license-11.6.0', ext:'aar')
    compile(name: 'play-services-ads-11.6.0', ext:'aar')
    compile(name: 'play-services-ads-lite-11.6.0', ext:'aar')
    compile(name: 'play-services-base-11.6.0', ext:'aar')
    compile(name: 'play-services-base-license-11.6.0', ext:'aar')
    compile(name: 'play-services-basement-11.6.0', ext:'aar')
    compile(name: 'play-services-basement-license-11.6.0', ext:'aar')
    compile(name: 'play-services-gass-11.6.0', ext:'aar')
    compile(name: 'play-services-tasks-11.6.0', ext:'aar')
    compile(name: 'play-services-tasks-license-11.6.0', ext:'aar')
    compile(name: 'support-compat-25.3.1', ext:'aar')
    compile(name: 'support-core-ui-25.3.1', ext:'aar')
    compile(name: 'support-core-utils-25.3.1', ext:'aar')
    compile(name: 'support-fragment-25.3.1', ext:'aar')
    compile(name: 'support-media-compat-25.3.1', ext:'aar')
    compile(name: 'support-v4-25.3.1', ext:'aar')
    compile(name: 'support-vector-drawable-25.3.1', ext:'aar')
    compile project(':Firebase')
    compile project(':GoogleMobileAdsPlugin')
}

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.2'

    defaultConfig {
        targetSdkVersion 27
        applicationId 'com.**.**'
    }

    lintOptions {
        abortOnError false
    }

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

    signingConfigs { release {
        storeFile file('/Users/home/Desktop/Unity Projects/UP - Android/user.keystore')
        storePassword '****'
        keyAlias 'androiddebugkey'
        keyPassword '****'
    } }

    buildTypes {
        debug {
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt','proguard-user.txt'
            jniDebuggable true
        }
        release {
            minifyEnabled true
            useProguard true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-unity.txt','proguard-user.txt'
            signingConfig signingConfigs.release
        }
    }

}

Proguard文件:

-keep class com.facebook.** {*;}
-keep class com.unity.purchasing.** {*;}
-keepattributes Signature
-dontwarn com.google.vr.ndk.base.DaydreamApi

-keep public class com.google.android.gms.ads.**{
public *;
}

# For old ads classes
-keep public class com.google.ads.**{
public *;
}

# For mediation
-keepattributes *Annotation*

# Other required classes for Google Play Services
# Read more at http://developer.android.com/google/play-services/setup.html
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
@com.google.android.gms.common.annotation.KeepName *;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}

-keep public class com.google.unity.**{
public *;
}

Unity 2017.2.0p4
MacOS High Sierra

注意:在我迁移到Mac并更新到Firebase UnitySDK 4.3.0 之前,它工作正常

1 个答案:

答案 0 :(得分:0)

我能够通过删除Unity中的Library文件夹的内容来解决这个问题,以不同的顺序多次重新导入所有Firebase软件包(最后是4.4.1,但只是从4.4.0更新到4.4。 1并没有自己动手)并运行GooglePlay Resolver"强制更新" (我在更新Firebase之前尝试了这一点,并在清除了Library文件夹之后,没有运气)。

我不能说这些事情中的哪一个最终修复了它,但如上所述,它们都没有孤立地工作,也没有对我的任何代码或资产进行任何更改。它似乎完全是Firebase的一部分。

有趣的是Firebase软件包如何使用不相同的文件覆盖彼此,所以很明显1)它们不是独立的,2)导入它们的顺序很重要。我希望他们能够创建一个单一的一体化资产并完成它。