android - 过时的 proguard 文件;使用 -keepclasseswithmembers 而不是 -keepclasseswithmembernames

标签 android proguard

我的 android 项目中的 proguard.cfg 文件出现以下错误。我不知道这个错误说什么。有什么想法吗?

最佳答案

这是 SDK 工具 v11 的一个错误。 http://code.google.com/p/android/issues/detail?id=16384

当 Lint 产生错误时,

  • 转到 lint 警告 View (Window > Show View > Other > android > Lint Warnings)并双击错误以修改 proguard.cfg

  • 将“keepclasseswithmembernames”重命名为“keepclasseswithmembers”在线显示错误并保存。

  • 再次运行 Lint(在 Lint 警告 View 中单击刷新)

  • 如果在后续行中显示更多警告,请重复重命名。

我把我的变成了这个样子。

-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService

-keepclasseswithmembernames class * {
    native <methods>;
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

-keep class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator *;
}

关于android - 过时的 proguard 文件;使用 -keepclasseswithmembers 而不是 -keepclasseswithmembernames,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8613098/

相关文章:

android - 自定义操作栏删除 Logo 的左边距

php - 使用 PHP 和 MySQL 验证 Android 登录

android - 无法解析 'getSupportActionBar()'

gradle - 在干净的生成版本中找不到符号

java - NullPointerException : ProGuard, Spring 启动

android - 无法在包含 jsch lib 的 Android 项目上启用 Proguard

android - TextToSpeech OnUtteranceCompletedListener 不起作用

Android - 丢失 PNG 图像 OnDraw 的质量

android - 保留 android.support.v4 后,使用 proguard 在 android.support.v4 处出现 nullPointerException

android - Proguard 不允许我导出 apk