Android 9 Pie崩溃(com.google.android.gms ... ClassNotFoundException)

时间:2019-04-11 16:35:27

标签: android unity3d crash admob android-9.0-pie

我有一个在Android上发布的Unity3D游戏,到目前为止,它运行良好。 但是,Android Vitals仪表板现在报告很多崩溃。这是详细信息:

By Android version: Android 9   4500    100.0%

Stacktrace:

java.lang.Error: FATAL EXCEPTION [Thread-360]
Unity version     : 2017.3.1p3
Device model      : Google Pixel
Device fingerprint: google/sailfish/sailfish:9/PQ2A.190305.002/5240760:user/release-keys
Caused by
  at lt.b (com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:2)
  at ls.a (com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:1)
  at lu.a (com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:18)
  at com.google.android.gms.ads.internal.util.ar.a (com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:10)
  at kx.a (com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:7)
  at kx.run (com.google.android.gms.policy_ads_fdr_dynamite@30000@30000.238272502.238272502:2)
Caused by: java.lang.ClassNotFoundException: 
  at dalvik.system.BaseDexClassLoader.findClass (BaseDexClassLoader.java:134)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:379)
  at ac.loadClass (com.google.android.gms.dynamite_dynamiteloader@16089081@16.0.89 (100400-239467275):4)
  at java.lang.ClassLoader.loadClass (ClassLoader.java:312)

我的AndroidResolverDependencies.xml文件:

<dependencies>
  <packages>
    <package>com.android.support:customtabs:[26.0.0, 27.2.0[</package>
    <package>com.android.support:support-v4:[26.0.0, 27.2.0[</package>
    <package>com.google.android.gms:play-services-ads:17.2.0</package>
    <package>com.google.android.gms:play-services-analytics:11.8.0</package>
    <package>com.google.android.gms:play-services-base:[10.2.1, 12.1.0[</package>
    <package>com.google.android.gms:play-services-location:[10.2.1, 12.1.0[</package>
    <package>com.google.firebase:firebase-messaging:[10.2.1, 12.1.0[</package>
  </packages>
  <files>
    <file>Assets/Plugins/Android/android.arch.core.common-1.1.0.jar</file>
    <file>Assets/Plugins/Android/android.arch.core.runtime-1.1.0.aar</file>
    <file>Assets/Plugins/Android/android.arch.lifecycle.common-1.1.0.jar</file>
    <file>Assets/Plugins/Android/android.arch.lifecycle.livedata-core-1.1.0.aar</file>
    <file>Assets/Plugins/Android/android.arch.lifecycle.runtime-1.1.0.aar</file>
    <file>Assets/Plugins/Android/android.arch.lifecycle.viewmodel-1.1.0.aar</file>
    <file>Assets/Plugins/Android/com.android.support.customtabs-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.android.support.support-annotations-27.1.1.jar</file>
    <file>Assets/Plugins/Android/com.android.support.support-compat-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.android.support.support-core-ui-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.android.support.support-core-utils-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.android.support.support-fragment-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.android.support.support-media-compat-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.android.support.support-v4-27.1.1.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-17.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-base-17.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-identifier-16.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-ads-lite-17.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-analytics-16.0.8.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-analytics-impl-16.0.8.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-base-16.1.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-basement-16.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-gass-17.2.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-location-16.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-base-16.3.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-measurement-sdk-api-16.3.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-places-placereport-16.0.0.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-stats-16.0.1.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-tagmanager-v4-impl-16.0.8.aar</file>
    <file>Assets/Plugins/Android/com.google.android.gms.play-services-tasks-16.0.1.aar</file>
    <file>Assets/Plugins/Android/com.google.auto.value.auto-value-annotations-1.6.jar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-common-16.1.0.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-iid-17.1.2.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-iid-interop-16.0.1.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-measurement-connector-17.0.1.aar</file>
    <file>Assets/Plugins/Android/com.google.firebase.firebase-messaging-17.6.0.aar</file>
  </files>
</dependencies>
Target API level: 28
Minimum API level: 16

我在Google AdMob's discussion group中看到了类似的线程,建议将以下内容添加到AndroidManifest.xml文件中:

<uses-library android:name="org.apache.http.legacy" android:required="false" />

但是:

  1. 我不确定问题是否是由任何与Apache相关的API引起的。
  2. 由于uses-library声明,由于它会在Google Play中提供给较小的受众群体,因此这会限制我的应用中的安装次数。

1 个答案:

答案 0 :(得分:9)

按照 Behavior changes: apps targeting API level 28+

  

Apache HTTP客户端弃用

     

在Android 6.0中,我们删除了对Apache HTTP客户端的支持。   从Android 9开始,该库已从   bootclasspath,默认情况下不适用于应用程序。要继续使用Apache HTTP客户端,面向Android 9及更高版本的应用可以在其AndroidManifest.xml中添加以下内容:

<uses-library android:name="org.apache.http.legacy" android:required="false"/>
  

注意:对于具有以下功能的应用,需要android:required =“ false”属性   最低SDK为23或更低版本,因为在具有API级别的设备上   低于24,则org.apache.http.legacy库不可用。   (在这些设备上,Apache HTTP类在   bootclasspath。)

     

作为使用运行时Apache库的替代方法,应用程序可以捆绑   APK中他们自己的org.apache.http库版本。如果你   为此,您必须重新打包该库(使用Jar Jar之类的实用程序)   为避免与   运行时。