繁体   English   中英

无法将Firebase集成到我的Android应用中

[英]Can't integrate Firebase in my Android app

我一直在自己的Firebase帐户中添加新项目,并下载了google-services.json设置文件并成功安装它,该应用程序可以正常运行,但是不适用于firebase服务,以下是我的debug,而该应用程序崩溃了。

请注意,当我尝试添加时,会显示此错误:实现'com.google.firebase:firebase-core:16.0.4',在android studio中,gradle中没有显示任何错误

10/08 19:55:40: Launching app
$ adb push C:\xxx\app\build\outputs\apk\debug\app-debug.apk /data/local/tmp/com.xxx.insidecartoon
$ adb shell pm install -t -r "/data/local/tmp/com.xxx.xxx"
    pkg: /data/local/tmp/com.xxx.xxx
Success
APK installed in 27 s 241 ms
$ adb shell am start -n "com.xxx.xxx/com.xxx.xxx.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -D
Waiting for application to come online: com.xxx.xxx.test | com.xxx.xxx
Connecting to com.xxx.xxx
Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page.
I/System.out: Sending WAIT chunk
W/ActivityThread: Application com.xxx.xxx is waiting for the debugger on port 8100...
I/dalvikvm: Debugger is active
I/System.out: Debugger has connected
    waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
Connected to the target VM, address: 'localhost:8602', transport: 'socket'
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: waiting for debugger to settle...
I/System.out: debugger has settled (1405)
I/dalvikvm: Could not find method android.content.Context.createDeviceProtectedStorageContext, referenced from method android.support.v4.content.ContextCompat.createDeviceProtectedStorageContext
W/dalvikvm: VFY: unable to resolve virtual method 565: Landroid/content/Context;.createDeviceProtectedStorageContext ()Landroid/content/Context;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getCodeCacheDir, referenced from method android.support.v4.content.ContextCompat.getCodeCacheDir
W/dalvikvm: VFY: unable to resolve virtual method 573: Landroid/content/Context;.getCodeCacheDir ()Ljava/io/File;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getColor, referenced from method android.support.v4.content.ContextCompat.getColor
W/dalvikvm: VFY: unable to resolve virtual method 574: Landroid/content/Context;.getColor (I)I
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getColorStateList, referenced from method android.support.v4.content.ContextCompat.getColorStateList
W/dalvikvm: VFY: unable to resolve virtual method 575: Landroid/content/Context;.getColorStateList (I)Landroid/content/res/ColorStateList;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getDataDir, referenced from method android.support.v4.content.ContextCompat.getDataDir
W/dalvikvm: VFY: unable to resolve virtual method 577: Landroid/content/Context;.getDataDir ()Ljava/io/File;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getDrawable, referenced from method android.support.v4.content.ContextCompat.getDrawable
W/dalvikvm: VFY: unable to resolve virtual method 580: Landroid/content/Context;.getDrawable (I)Landroid/graphics/drawable/Drawable;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.getNoBackupFilesDir, referenced from method android.support.v4.content.ContextCompat.getNoBackupFilesDir
W/dalvikvm: VFY: unable to resolve virtual method 587: Landroid/content/Context;.getNoBackupFilesDir ()Ljava/io/File;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method android.support.v4.content.ContextCompat.isDeviceProtectedStorage
W/dalvikvm: VFY: unable to resolve virtual method 600: Landroid/content/Context;.isDeviceProtectedStorage ()Z
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.startForegroundService, referenced from method android.support.v4.content.ContextCompat.startForegroundService
W/dalvikvm: VFY: unable to resolve virtual method 615: Landroid/content/Context;.startForegroundService (Landroid/content/Intent;)Landroid/content/ComponentName;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0006
I/dalvikvm: Could not find method android.content.Context.isDeviceProtectedStorage, referenced from method com.google.android.gms.internal.measurement.zzsl.init
W/dalvikvm: VFY: unable to resolve virtual method 600: Landroid/content/Context;.isDeviceProtectedStorage ()Z
D/dalvikvm: VFY: replacing opcode 0x6e at 0x0009
V/FA: Registered activity lifecycle callback
D/FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
D/FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
I/FirebaseInitProvider: FirebaseApp initialization successful
V/FA: onActivityCreated
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zze; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zze;' failed
    VFY: unable to find class referenced in signature (Lcom/google/android/gms/ads/internal/client/zze;)
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zze; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zze;' failed
I/dalvikvm: Could not find method com.google.android.gms.ads.internal.client.zze.zzb, referenced from method com.google.android.gms.ads.internal.client.zzac.zzH
W/dalvikvm: VFY: unable to resolve virtual method 17122: Lcom/google/android/gms/ads/internal/client/zze;.zzb (Landroid/content/Context;Lcom/google/android/gms/ads/internal/client/AdSizeParcel;Ljava/lang/String;Lcom/google/android/gms/internal/zzew;)Lcom/google/android/gms/ads/internal/client/zzu;
D/dalvikvm: VFY: replacing opcode 0x6e at 0x001f
I/dalvikvm: Could not find method com.google.android.gms.common.internal.zzx.zzb, referenced from method com.google.android.gms.ads.AdRequest$Builder.setContentUrl
W/dalvikvm: VFY: unable to resolve static method 21535: Lcom/google/android/gms/common/internal/zzx;.zzb (Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
D/dalvikvm: VFY: replacing opcode 0x71 at 0x0002
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zze; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zze;' failed
E/dalvikvm: Could not find class 'com.google.android.gms.ads.internal.client.zze', referenced from method com.google.android.gms.ads.internal.client.zzn.<init>
W/dalvikvm: VFY: unable to resolve new-instance 2192 (Lcom/google/android/gms/ads/internal/client/zze;) in Lcom/google/android/gms/ads/internal/client/zzn;
D/dalvikvm: VFY: replacing opcode 0x22 at 0x000a
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zze; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zze;' failed
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zze; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zze;' failed
    VFY: unable to find class referenced in signature (Lcom/google/android/gms/ads/internal/client/zze;)
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zzaf; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zzaf;' failed
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zzaf; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zzaf;' failed
    VFY: unable to find class referenced in signature (Lcom/google/android/gms/ads/internal/client/zzaf;)
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/internal/zzcv; (3038)
    Link of class 'Lcom/google/android/gms/internal/zzcv;' failed
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/internal/zzcv; (3038)
    Link of class 'Lcom/google/android/gms/internal/zzcv;' failed
W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/android/gms/internal/zzcv;)
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/reward/client/zzf; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/reward/client/zzf;' failed
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/reward/client/zzf; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/reward/client/zzf;' failed
W/dalvikvm: VFY: unable to find class referenced in signature (Lcom/google/android/gms/ads/internal/reward/client/zzf;)
    Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zze; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zze;' failed
D/dalvikvm: DexOpt: unable to opt direct call 0x42de at 0x0c in Lcom/google/android/gms/ads/internal/client/zzn;.<init>
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/client/zzaf; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/client/zzaf;' failed
D/dalvikvm: DexOpt: unable to opt direct call 0x427b at 0x1a in Lcom/google/android/gms/ads/internal/client/zzn;.<init>
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/internal/zzcv; (3038)
    Link of class 'Lcom/google/android/gms/internal/zzcv;' failed
D/dalvikvm: DexOpt: unable to opt direct call 0x623a at 0x21 in Lcom/google/android/gms/ads/internal/client/zzn;.<init>
W/dalvikvm: Unable to resolve superclass of Lcom/google/android/gms/ads/internal/reward/client/zzf; (3038)
    Link of class 'Lcom/google/android/gms/ads/internal/reward/client/zzf;' failed
D/dalvikvm: DexOpt: unable to opt direct call 0x46fd at 0x28 in Lcom/google/android/gms/ads/internal/client/zzn;.<init>
W/dalvikvm: DexOpt: resolve class illegal access: Lcom/google/android/gms/ads/internal/util/client/zza; -> Lcom/google/android/gms/common/zze;
I/dalvikvm: Could not find method com.google.android.gms.common.zze.isGooglePlayServicesAvailable, referenced from method com.google.android.gms.ads.internal.util.client.zza.zzU
W/dalvikvm: VFY: unable to resolve static method 22073: Lcom/google/android/gms/common/zze;.isGooglePlayServicesAvailable (Landroid/content/Context;)I
D/dalvikvm: VFY: replacing opcode 0x71 at 0x0000
I/dalvikvm: Could not find method com.google.android.gms.internal.zzne.zzsi, referenced from method com.google.android.gms.ads.internal.util.client.zza.zzW
W/dalvikvm: VFY: unable to resolve static method 27575: Lcom/google/android/gms/internal/zzne;.zzsi ()Z
D/dalvikvm: VFY: replacing opcode 0x71 at 0x0014
W/dalvikvm: Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/android/gms/ads/internal/client/zzn;
    Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/android/gms/ads/internal/client/zzaa;
    Exception Ljava/lang/NoClassDefFoundError; thrown while initializing Lcom/google/android/gms/ads/AdRequest;
D/AndroidRuntime: Shutting down VM
W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x417e1da0)
E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.xxx.xxx, PID: 29691
    java.lang.NoClassDefFoundError: com.google.android.gms.ads.internal.client.zze
        at com.google.android.gms.ads.internal.client.zzn.<init>(Unknown Source)
        at com.google.android.gms.ads.internal.client.zzn.<clinit>(Unknown Source)
        at com.google.android.gms.ads.internal.client.zzaa.<clinit>(Unknown Source)
        at com.google.android.gms.ads.AdRequest.<clinit>(Unknown Source)
        at com.google.android.gms.ads.AdRequest$Builder.<init>(Unknown Source)
        at com.xxx.xxx.MainActivity.requestNewInterstitial(MainActivity.java:77)
        at com.xxx.xxx.MainActivity.onCreate(MainActivity.java:49)
        at android.app.Activity.performCreate(Activity.java:5541)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2368)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2464)
        at android.app.ActivityThread.access$900(ActivityThread.java:172)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:146)
        at android.app.ActivityThread.main(ActivityThread.java:5653)
        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:1291)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
        at dalvik.system.NativeStart.main(Native Method)
Disconnected from the target VM, address: 'localhost:8602', transport: 'socket'

我的gradle信息我也运行android 3.2和gradle wrapper gradle-4.6

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
buildToolsVersion "28.0.2"

defaultConfig {
    applicationId "com.xxx.xxx"
    minSdkVersion 15
    targetSdkVersion 28
    versionCode 1
    versionName "KING-DEV"
}
buildTypes {
    release {
        debuggable false
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.2.1'
    compile 'com.google.android.gms:play-services-ads:8.4.0'
    implementation 'com.google.firebase:firebase-core:16.0.4'

}
apply plugin: 'com.google.gms.google-services'**

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        jcenter()
        google()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.2.0'
        classpath 'com.google.gms:google-services:4.1.0' // google-services plugin


        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        google()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

要解决此问题,请更改以下代码行:

compile 'com.google.android.gms:play-services-ads:8.4.0'

implementation 'com.google.android.gms:play-services-ads:16.0.0'

并在以下代码行之后删除**

apply plugin: 'com.google.gms.google-services'

尝试应用Google Play服务apply plugin: 'com.google.gms.google-services'

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM