1

当我使用 progurad 选项运行 mvn install 目标时,出现以下错误。以前,我没有这个错误。我找不到导致以下错误的原因:

 proguard.ParseException: Unknown option '-encryptstrings' in line .. of file 'proguard.cfg'

我正在为我的项目使用 dexguard。这个错误是因为 maven 无法识别 dexguard 文件夹位置吗?

proguard.cfg 内容:

-dalvik  -- unknown option
-android -- unknown option
# Encrypt all strings  -- parse exception
-encryptstrings '???*'
以下工作没有问题:
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic
-optimizationpasses 30
-allowaccessmodification
-dontpreverify
-dontoptimize
-ignorewarnings
-renamesourcefileattribute Maviance
-keepattributes SourceFile,LineNumberTable,*Annotation*
-keep,allowshrinking,allowobfuscation class android.support.**Compat* { *; }
4

2 回答 2

1

该选项-encryptstrings '???*'仅受 DexGuard 支持。所以当你使用 ProGuard 构建你的应用程序时,你会收到这样的错误。

因此建议将 dexguard 相关配置分离到单独的配置文件dexguard-project.txt中,该文件仅在使用 DexGuard 时包含。

于 2016-09-28T09:40:19.717 回答
0

我在使用 dexguard 时遇到了同样的错误。问题是我错过了这条线

            proguardFiles getDefaultDexGuardFile('dexguard-debug.pro')

所以 gradle 使用了 Proguard 而不是 Dexguard,后者显然没有 encryptstrings 功能。所以工作版本配置是这样的:

  release {
            debuggable true
            minifyEnabled true
            proguardFiles getDefaultDexGuardFile('dexguard-debug.pro')
            signingConfig signingConfigs.release
        }
于 2016-10-13T09:49:58.733 回答