gpt4 book ai didi

android - 在 Android 4.4 及以下版本中实现 Google Analytics 7.5.0(Play 服务)会崩溃

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:09:46 26 4
gpt4 key购买 nike

在我实现 Google Analytics 后,我的应用程序在 Lollipop 之前的设备上立即崩溃。

07-22 15:42:43.831: W/dalvikvm(1815): VFY: unable to resolve virtual method     16407: Lcom/google/android/gms/analytics/internal/zzg;.getApplicationContext    ()Landroid/content/Context;
07-22 15:42:43.831: D/dalvikvm(1815): VFY: replacing opcode 0x6e at 0x0003
07-22 15:42:43.831: I/dalvikvm(1815): Could not find method com.google.android.gms.internal.zzld.zzoQ, referenced from method com.google.android.gms.analytics.internal.zzf.zzV
07-22 15:42:43.831: W/dalvikvm(1815): VFY: unable to resolve static method 27402: Lcom/google/android/gms/internal/zzld;.zzoQ ()Lcom/google/android/gms/internal/zzlb;
07-22 15:42:43.831: D/dalvikvm(1815): VFY: replacing opcode 0x71 at 0x000e
07-22 15:42:43.831: W/dalvikvm(1815): VFY: unable to find class referenced in signature (Lcom/google/android/gms/internal/zzlb;)
07-22 15:42:43.831: W/dalvikvm(1815): VFY: Ljava/lang/Object; is not instance of Lcom/google/android/gms/analytics/internal/zzd;
07-22 15:42:43.831: W/dalvikvm(1815): VFY: bad arg 1 (into Lcom/google/android/gms/analytics/internal/zzd;)
07-22 15:42:43.831: W/dalvikvm(1815): VFY: rejecting call to Lcom/google/android/gms/analytics/internal/zzf;.zza (Lcom/google/android/gms/analytics/internal/zzd;)V
07-22 15:42:43.831: W/dalvikvm(1815): VFY: rejecting opcode 0x70 at 0x0002
07-22 15:42:43.831: W/dalvikvm(1815): VFY: rejected Lcom/google/android/gms/analytics/internal/zzf;.zzhT ()Lcom/google/android/gms/analytics/internal/zzv;
07-22 15:42:43.831: W/dalvikvm(1815): Verifier rejected class Lcom/google/android/gms/analytics/internal/zzf;
07-22 15:42:43.831: D/AndroidRuntime(1815): Shutting down VM
07-22 15:42:43.831: W/dalvikvm(1815): threadid=1: thread exiting with uncaught exception (group=0xb0ce1b20)
07-22 15:42:43.831: E/AndroidRuntime(1815): FATAL EXCEPTION: main
07-22 15:42:43.831: E/AndroidRuntime(1815): Process: ---, PID: 1815
07-22 15:42:43.831: E/AndroidRuntime(1815): java.lang.VerifyError: com/google/android/gms/analytics/internal/zzf
07-22 15:42:43.831: E/AndroidRuntime(1815): at com.google.android.gms.analytics.GoogleAnalytics.getInstance(Unknown Source)
07-22 15:42:43.831: E/AndroidRuntime(1815): at com.x.x.x.onCreate(x.java:22)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4328)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.app.ActivityThread.access$1500(ActivityThread.java:135)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.os.Handler.dispatchMessage(Handler.java:102)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.os.Looper.loop(Looper.java:136)
07-22 15:42:43.831: E/AndroidRuntime(1815): at android.app.ActivityThread.main(ActivityThread.java:5001)
07-22 15:42:43.831: E/AndroidRuntime(1815): at java.lang.reflect.Method.invokeNative(Native Method)
07-22 15:42:43.831: E/AndroidRuntime(1815): at java.lang.reflect.Method.invoke(Method.java:515)
07-22 15:42:43.831: E/AndroidRuntime(1815): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
07-22 15:42:43.831: E/AndroidRuntime(1815): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
07-22 15:42:43.831: E/AndroidRuntime(1815): at dalvik.system.NativeStart.main(Native Method)

我的 Gradle 文件(在 android block 内):

compileSdkVersion 22
buildToolsVersion "22.0.1"

defaultConfig {
applicationId "x.x.x"
minSdkVersion 14
targetSdkVersion 22
versionCode 6
versionName "0.5"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

我使用这个版本的 Google Play 服务:

编译 'com.google.android.gms:play-services-analytics:7.5.0'

我已经在网上搜索了很多关于这个主题的内容,但找不到任何解决问题的方法。最接近的一个是关于 SO 的这个答案,不幸的是它对我没有用:https://stackoverflow.com/a/31432568

最佳答案

尝试使用新的 Android 配置启用 MultiDex,构建工具 22.0.1 有一个我在 MultiDex 上报告的错误(如您在此处看到的:java.lang.VerifyError with API < 21)。

因此在 gradle 中启用 MultiDex 并使用 build-tools 23 rc3:

compileSdkVersion 22
buildToolsVersion "23 rc3"

defaultConfig {
applicationId "x.x.x"
minSdkVersion 14
targetSdkVersion 22
versionCode 6
versionName "0.5"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

在你的依赖项中导入它(最新版本是 1.0.1)

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:multidex:1.0.1'
}

并将其附加到应用程序中的基本上下文:

public class MyApplication extends CustomLibraryApplication {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}

或者扩展一个 MultiDexApplication:

public class MyApplication extends MultiDexApplication {

}

或者在 list 中使用 MultiDexApplication。

关于android - 在 Android 4.4 及以下版本中实现 Google Analytics 7.5.0(Play 服务)会崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31579780/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com