【发布时间】:2013-09-07 17:56:31
【问题描述】:
我最近向 Play 商店发布了一个应用程序,虽然它在没有 proguard 的情况下运行良好,但当我决定使用它时却发生了意外崩溃。
我查看了here 以获取推荐的 google play 服务的 proguard 规则,我还尝试为这种情况添加另一行。这是我得到的(第三行是我的应用程序):
-keep class * extends java.util.ListResourceBundle {
protected Object[][] getContents();
}
-keep class * implements com.google.android.gms.internal.ae
-keep class * extends il.co.kix.minitasker.EntityBase
这是执行回溯后的崩溃报告
android.os.BadParcelableException: Parcelable protocol requires a Parcelable.Creator object called CREATOR on class com.google.android.gms.location.ActivityRecognitionResult
at android.os.Parcel.readParcelable(Parcel.java:2086)
at android.os.Parcel.readValue(Parcel.java:1965)
at android.os.Parcel.readMapInternal(Parcel.java:2226)
at android.os.Bundle.unparcel(Bundle.java:223)
at android.os.Bundle.containsKey(Bundle.java:271)
at android.content.Intent.hasExtra(Intent.java:4116)
at com.google.android.gms.location.ActivityRecognitionResult.boolean hasResult(android.content.Intent)(Unknown Source)
com.google.android.gms.location.DetectedActivity getMostProbableActivity()
at il.co.kix.minitasker.ActivityRecognitionIntentService.void onHandleIntent(android.content.Intent)(Unknown Source)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.os.HandlerThread.run(HandlerThread.java:60)
有问题的代码行可能是:
...
@Override
protected void onHandleIntent(Intent intent) {
if (ActivityRecognitionResult.hasResult(intent)) {
ActivityRecognitionResult result = ActivityRecognitionResult.extractResult(intent);
DetectedActivity mostProbableActivity = result.getMostProbableActivity();
...
谁能帮忙添加一条规则?我不想一起禁用它,但它确实解决了这个问题。
【问题讨论】:
-
正如 google 宣布的那样,任何在 google paly 上上传的 apk 现在 google 在 apk 本身上运行 proguard,所以现在不需要在我们这边使用 proguard。
-
文件大小似乎有非常明显的差异,使用 proguard 时为 800kb,未使用时为 1.2mb。
-
也许我遗漏了一些东西,但他们真的可以在没有我之后签署代码的情况下做到吗?
-
与stackoverflow.com/questions/16362726/… 相同的问题,但没有答案。
-
@BirajZalavadia 我在谷歌搜索你所说的信息,但我没有得到任何关于你所说的新闻的链接。您能否给我一个链接,您可以在其中看到 Google 将在 apk 本身上运行 proguard 吗?
标签: android proguard google-play-services