OSS许可插件在启动OssLicensesMenuActivity时崩溃

时间:2018-02-08 14:47:42

标签: android gms-licenses-plugin

每个人!我使用本教程Google APIs for Android OSS licenses包含了Android OSS。进入我的项目(目标sdk版本是27)。

但是当我开始 OssLicensesMenuActivity 时,我遇到了一个问题。

我这样做如下:

OssLicensesMenuActivity.setActivityTitle("OSS Licenses Demo");
startActivity(new Intent(getActivity(), OssLicensesMenuActivity.class));

这是问题:

ResourceType: For resource 0x7f07000a, entry index(10) is beyond type entryCount(4)
java.lang.RuntimeException: An error occurred while executing doInBackground()
     at android.support.v4.content.ModernAsyncTask$3.done(ModernAsyncTask.java:161)
     at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
     at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
     at java.util.concurrent.FutureTask.run(FutureTask.java:242)
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
     at java.lang.Thread.run(Thread.java:762)
Caused by: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f07000a
     at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:248)
     at android.content.res.Resources.getResourcePackageName(Resources.java:2783)
     at com.google.android.gms.internal.zzdmw.zza(Unknown Source)
     at com.google.android.gms.internal.zzdmw.zzeq(Unknown Source)
     at com.google.android.gms.oss.licenses.zzb.loadInBackground(Unknown Source)
     at android.support.v4.content.AsyncTaskLoader.onLoadInBackground(AsyncTaskLoader.java:306)
     at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:59)
     at android.support.v4.content.AsyncTaskLoader$LoadTask.doInBackground(AsyncTaskLoader.java:47)
     at android.support.v4.content.ModernAsyncTask$2.call(ModernAsyncTask.java:138)
     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    ... 3 more

此外,我已尝试将these lines添加到Manifest,但问题尚未解决:

<activity android:name="com.google.android.gms.oss.licenses.OssLicensesMenuActivity"
    android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/>

<activity android:name="com.google.android.gms.oss.licenses.OssLicensesActivity"
    android:theme="@style/Theme.AppCompat.DayNight.DarkActionBar"/> 

2 个答案:

答案 0 :(得分:1)

在我将项目移至Android Studio 3.0.1之后(因此Gradle已更新至3.0.1版),问题已修复。

答案 1 :(得分:0)

遇到以下具有插件依赖性的问题,

com.google.gms:oss-licenses:0.9.2

com.google.android.gms:play-services-oss-licenses:11.4.2

发现该问题已通过最新的com.google.android.gms:play-services-oss-licenses:16.0.0修复。这需要将com.google.gms:google-services撞到3.2.1才能解决与分支的firebase / play-services sdks的冲突。

参考:https://developers.google.com/android/guides/releases

enter image description here