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

时间:2015-11-16 03:04:58

标签: android google-play-services

这是我的第一个申请。我试图添加需要谷歌播放服务和Multidex支持的Admob所以我也添加了这些项目。

我的应用程序在Android 5.1中正常运行但在Android 3.2中崩溃

我理解错误,因为它试图加载某些类但没有在谷歌播放服务中找到它们(我认为所以不完全确切)。

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

我该如何解决?

logcat的:

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

1 个答案:

答案 0 :(得分:3)

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

  1. 将整个Google Play服务复制到您的工作区。 (谷歌播放服务库项目路径是:

    /演员/谷歌/ google_play_services / libproject /谷歌播放-services_lib

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

    1. 将jar文件复制到libs文件夹
    2. 右键单击您的android项目。转到属性。在左侧面板中选择Java Build Path。在Libraries选项卡上,按&#34; Add jars ...&#34;按钮并浏览添加的jar文件,然后应用并确定。
    3. <强>更新

      向项目添加multidex支持

      How to enable multidexing with the new Android Multidex support library

      请添加最新的支持库v4。

      自动添加支持库v4

      在eclipse中:右键单击你的android项目 - &gt; Android工具 - &gt;添加支持库。