play-services-location:9.0.0生成java.lang.NoClassDefFoundError:com.google.firebase.FirebaseOptions

时间:2016-05-25 22:21:00

标签: android android-studio firebase

我添加了编译com.google.android.gms:play-services-location:9.0.0'使用Fused Location API。

我遇到了Firebase库的麻烦。



05-25 15:15:43.592 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.595 22764-22764/com.produactivity E/dalvikvm: Could not find class 'com.google.firebase.FirebaseOptions', referenced from method com.google.firebase.FirebaseApp.<init>
05-25 15:15:43.595 22764-22764/com.produactivity W/dalvikvm: VFY: unable to resolve check-cast 8585 (Lcom/google/firebase/FirebaseOptions;) in Lcom/google/firebase/FirebaseApp;
05-25 15:15:43.597 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.597 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.597 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.604 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.616 22764-22764/com.produactivity E/dalvikvm: Could not find class 'com.google.firebase.FirebaseApp$zzb', referenced from method com.google.firebase.FirebaseApp.zzaJ
05-25 15:15:43.616 22764-22764/com.produactivity W/dalvikvm: VFY: unable to resolve check-cast 8581 (Lcom/google/firebase/FirebaseApp$zzb;) in Lcom/google/firebase/FirebaseApp;
05-25 15:15:43.616 22764-22764/com.produactivity I/dalvikvm: Could not find method com.google.firebase.FirebaseOptions.fromResource, referenced from method com.google.firebase.FirebaseApp.zzbu
05-25 15:15:43.616 22764-22764/com.produactivity W/dalvikvm: VFY: unable to resolve static method 61478: Lcom/google/firebase/FirebaseOptions;.fromResource (Landroid/content/Context;)Lcom/google/firebase/FirebaseOptions;
05-25 15:15:43.617 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.618 22764-22764/com.produactivity E/dalvikvm: Could not find class 'com.google.firebase.FirebaseApiNotAvailableException', referenced from method com.google.firebase.FirebaseApp.getToken
05-25 15:15:43.618 22764-22764/com.produactivity W/dalvikvm: VFY: unable to resolve new-instance 8579 (Lcom/google/firebase/FirebaseApiNotAvailableException;) in Lcom/google/firebase/FirebaseApp;
05-25 15:15:43.618 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/auth/FirebaseUser;)
05-25 15:15:43.618 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/auth/FirebaseUser;)
05-25 15:15:43.620 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/FirebaseOptions;)
05-25 15:15:43.622 22764-22764/com.produactivity I/dalvikvm: Could not find method com.google.firebase.FirebaseOptions.getApplicationId, referenced from method com.google.firebase.FirebaseApp.zzNV
05-25 15:15:43.622 22764-22764/com.produactivity W/dalvikvm: VFY: unable to resolve virtual method 61479: Lcom/google/firebase/FirebaseOptions;.getApplicationId ()Ljava/lang/String;
05-25 15:15:43.623 22764-22764/com.produactivity W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/firebase/auth/FirebaseUser;)
05-25 15:15:43.623 22764-22764/com.produactivity E/dalvikvm: Could not find class 'com.google.firebase.FirebaseApp$zza', referenced from method com.google.firebase.FirebaseApp.zza
05-25 15:15:43.623 22764-22764/com.produactivity W/dalvikvm: VFY: unable to resolve check-cast 8580 (Lcom/google/firebase/FirebaseApp$zza;) in Lcom/google/firebase/FirebaseApp;
05-25 15:15:43.643 22764-22764/com.produactivity W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41bcac98)
05-25 15:15:43.643 22764-22764/com.produactivity W/dalvikvm: threadid=1: uncaught exception occurred
05-25 15:15:43.643 22764-22764/com.produactivity W/System.err: java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
05-25 15:15:43.651 22764-22764/com.produactivity W/System.err:     at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
05-25 15:15:43.651 22764-22764/com.produactivity W/System.err:     at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
05-25 15:15:43.651 22764-22764/com.produactivity W/System.err:     at android.content.ContentProvider.attachInfo(ContentProvider.java:1638)
05-25 15:15:43.651 22764-22764/com.produactivity W/System.err:     at android.content.ContentProvider.attachInfo(ContentProvider.java:1609)
05-25 15:15:43.651 22764-22764/com.produactivity W/System.err:     at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
05-25 15:15:43.651 22764-22764/com.produactivity W/System.err:     at android.app.ActivityThread.installProvider(ActivityThread.java:5114)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.app.ActivityThread.installContentProviders(ActivityThread.java:4688)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4628)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.app.ActivityThread.access$1500(ActivityThread.java:157)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:110)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.os.Looper.loop(Looper.java:193)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5398)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at java.lang.reflect.Method.invokeNative(Native Method)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at java.lang.reflect.Method.invoke(Method.java:515)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
05-25 15:15:43.652 22764-22764/com.produactivity W/System.err:     at dalvik.system.NativeStart.main(Native Method)
05-25 15:15:43.653 22764-22764/com.produactivity W/dalvikvm: threadid=1: calling UncaughtExceptionHandler
05-25 15:15:43.665 22764-22764/com.produactivity E/AndroidRuntime: FATAL EXCEPTION: main
                                                                   Process: com.produactivity, PID: 22764
                                                                   java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions
                                                                       at com.google.firebase.FirebaseApp.zzbu(Unknown Source)
                                                                       at com.google.firebase.provider.FirebaseInitProvider.onCreate(Unknown Source)
                                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1638)
                                                                       at android.content.ContentProvider.attachInfo(ContentProvider.java:1609)
                                                                       at com.google.firebase.provider.FirebaseInitProvider.attachInfo(Unknown Source)
                                                                       at android.app.ActivityThread.installProvider(ActivityThread.java:5114)
                                                                       at android.app.ActivityThread.installContentProviders(ActivityThread.java:4688)
                                                                       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4628)
                                                                       at android.app.ActivityThread.access$1500(ActivityThread.java:157)
                                                                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1434)
                                                                       at android.os.Handler.dispatchMessage(Handler.java:110)
                                                                       at android.os.Looper.loop(Looper.java:193)
                                                                       at android.app.ActivityThread.main(ActivityThread.java:5398)
                                                                       at java.lang.reflect.Method.invokeNative(Native Method)
                                                                       at java.lang.reflect.Method.invoke(Method.java:515)
                                                                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:940)
                                                                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
                                                                       at dalvik.system.NativeStart.main(Native Method)
&#13;
&#13;
&#13;

我的应用等级上有下一个配置

&#13;
&#13;
buildscript {
    repositories {
        maven { url 'https://maven.fabric.io/public' }
    }

    dependencies {
        classpath 'io.fabric.tools:gradle:1.+'
    }
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

repositories {
    maven { url 'https://maven.fabric.io/public' }
}


android {
    compileSdkVersion 23
    buildToolsVersion "24.0.0 rc4"

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }

    defaultConfig {
        applicationId "com.p"
        versionCode 1
        versionName "Test"
        minSdkVersion 16
        targetSdkVersion 23

        multiDexEnabled true
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    provided "org.projectlombok:lombok:1.12.6"

    compile fileTree(dir: 'libs', include: 'Parse-1.10.3.jar')
    compile 'com.parse.bolts:bolts-android:1.1.2'

    compile 'com.android.support:appcompat-v7:23.1.1'
    compile 'com.android.support:design:23.1.1'
    compile 'com.google.android.gms:play-services-location:9.0.0'

    compile 'com.fasterxml.jackson.core:jackson-annotations:2.4.0'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.4.2'
    compile 'com.fasterxml.jackson.core:jackson-core:2.4.2'

    compile 'com.github.satyan:sugar:1.3.1'
    compile('com.crashlytics.sdk.android:crashlytics:2.5.5@aar') {
        transitive = true;
    }

    compile 'com.android.support:multidex:1.0.0'
}
&#13;
&#13;
&#13;

我已将所有工具更新到最新版本。

3 个答案:

答案 0 :(得分:1)

  1. 更新您的Google Play服务&#39;从Android SDK Manager到版本30&gt;附加功能。
  2. 添加行compile&#39; com.android.support:multidex:1.0.1&#39;你的依赖。
  3. 将其添加到清单中的应用程序标签:android:name =&#34; android.support.multidex.MultiDexApplication&#34;

答案 1 :(得分:0)

    MultiDex.install(getApplicationContext()); 

似乎解决了这个问题......

答案 2 :(得分:0)

您必须在项目中编译multiDex类

1.-在graddle文件(模块应用程序)中添加multiDexEnable true并在依赖项中编译'com.android.support:multidex:1.0.0'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    minSdkVersion 14
    targetSdkVersion 21
    // Enabling multidex support.
    multiDexEnabled true
}
...
}
dependencies {
   ...
   compile 'com.android.support:multidex:1.0.0'
}
  1. 在清单中添加标记android:name="android.support.multidex.MultiDexApplication"
  2. 中的<application>

    实施例

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myapplication">
         <application
            ...
            android:name="android.support.multidex.MultiDexApplication">
            ...
         </application>
    </manifest>