gpt4 book ai didi

android - 使用 multidex 和 google play 服务的应用程序崩溃

转载 作者:搜寻专家 更新时间:2023-11-01 08:39:57 24 4
gpt4 key购买 nike

这是我的第一个应用程序。我尝试添加需要谷歌播放服务和 Multidex 支持的 Admob,所以我也添加了这些项目。

我的应用程序在 Android 5.1 中运行良好,但在 Android 3.2 中崩溃

我理解这个错误,因为它试图加载一些类但没有在 google play 服务中找到它们(我想所以不太清楚)。

    android minSdkVersion="13"
android targetSdkVersion="21"

我该如何解决?

日志:

11-16 08:31:44.365: E/dalvikvm(392): Could not find class 'android.app.Notification$BigTextStyle', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zza
11-16 08:31:44.457: E/dalvikvm(392): Could not find class 'android.os.UserManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzap
11-16 08:31:44.465: E/dalvikvm(392): Could not find class 'android.app.AppOpsManager', referenced from method com.google.android.gms.common.GooglePlayServicesUtil.zzb
11-16 08:31:44.815: E/dalvikvm(392): Could not find class 'com.google.android.gms.ads.internal.overlay.zzc', referenced from method com.google.android.gms.ads.internal.overlay.zzl.zza
11-16 08:31:44.835: E/dalvikvm(392): Could not find class 'android.support.v4.util.SimpleArrayMap', referenced from method com.google.android.gms.ads.internal.zzq.<init>
11-16 08:31:44.945: E/dalvikvm(392): Could not find class 'com.google.android.gms.internal.zzbk', referenced from method com.google.android.gms.internal.zzig.zzG
11-16 08:31:45.155: E/AndroidRuntime(392): FATAL EXCEPTION: main
11-16 08:31:45.155: E/AndroidRuntime(392): java.lang.NoClassDefFoundError: android.support.v4.util.SimpleArrayMap
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.zzq.<init>(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.zzq.<init>(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.zzb.<init>(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.zzc.<init>(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.zzf.<init>(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.client.zze.zza(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.client.zzz.zzdb(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.client.zzz.zzda(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.internal.client.zzz.zza(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.BaseAdView.loadAd(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.google.android.gms.ads.AdView.loadAd(Unknown Source)
11-16 08:31:45.155: E/AndroidRuntime(392): at file_handler.bep_file_handle_activity.display_add(bep_file_handle_activity.java:78)
11-16 08:31:45.155: E/AndroidRuntime(392): at file_handler.bep_file_handle_activity.onCreate(bep_file_handle_activity.java:53)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.Activity.performCreate(Activity.java:4397)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1048)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1779)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1831)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.ActivityThread.access$500(ActivityThread.java:122)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1024)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.os.Handler.dispatchMessage(Handler.java:99)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.os.Looper.loop(Looper.java:132)
11-16 08:31:45.155: E/AndroidRuntime(392): at android.app.ActivityThread.main(ActivityThread.java:4123)
11-16 08:31:45.155: E/AndroidRuntime(392): at java.lang.reflect.Method.invokeNative(Native Method)
11-16 08:31:45.155: E/AndroidRuntime(392): at java.lang.reflect.Method.invoke(Method.java:491)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
11-16 08:31:45.155: E/AndroidRuntime(392): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
11-16 08:31:45.155: E/AndroidRuntime(392): at dalvik.system.NativeStart.main(Native Method)
11-16 08:31:51.885: E/dalvikvm(392): Could not find class 'android.support.v4.util.ArrayMap', referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.<init>
11-16 08:31:51.955: E/dalvikvm(392): Could not find class 'android.support.v4.util.ArrayMap', referenced from method com.google.android.gms.common.api.GoogleApiClient$Builder.zzoI

最佳答案

要添加 google play 服务库,您不应该将 jar 文件复制到您的项目;您应该将 google play 服务库项目导入到您的项目中。怎么办?

  1. 将整个 google play 服务复制到您的工作区。 (google play服务库项目路径为:

    /extras/google/google_play_services/libproject/google-play-services_lib

  2. 将 google play 服务库导入您的项目。右键单击您的android项目。转到属性。在左侧面板中选择 Android。单击添加并浏览库项目。选择相同。单击确定并应用

向您的项目添加一些 jar:

  1. 复制jar文件到libs文件夹
  2. 右键单击您的 android 项目。转到属性。在左侧面板中选择 Java Build Path。在“库”选项卡上,按“添加 jars...”按钮并浏览添加的 jar 文件,然后应用并确定。

更新:

为您的项目添加 multidex 支持:

How to enable multidexing with the new Android Multidex support library

请添加最新的支持库v4。

自动添加支持库v4:

在 eclipse 中:右键单击您的 android 项目 -> Android 工具 -> 添加支持库。

关于android - 使用 multidex 和 google play 服务的应用程序崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33727892/

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