Buck / OkBuck:DexGuard集成无法正常工作

时间:2017-04-03 12:09:49

标签: android dexguard buck okbuck

我一直在Android Studio中使用Gradle成功使用DexGuard,没有任何问题。我最近尝试了OkBuck来加快我的构建时间,这对我很有帮助。

虽然它可以为我构建调试和签名的APK,但是当我尝试使用DexGuard构建发布时,如:

./buckw install --run app:bin_release

我收到以下错误:

Error: Unknown option '-dalvik' in line 9 of file 'SomeApp/app/build/okbuck/release/proguard.pro',
  included from line 60 of file 'buck-out/gen/app/bin_release/proguard/command-line.txt',
  included from argument number 1

BUILD FAILED: //app:bin_release failed with exit code 1:
proguard_obfuscation
stderr: Error: Unknown option '-dalvik' in line 9 of file 'SomeApp/app/build/okbuck/release/proguard.pro',
  included from line 60 of file 'buck-out/gen/app/bin_release/proguard/command-line.txt',
  included from argument number 1

提及DexGuard集成的详细信息可能并不重要,因为它是根据文档完成的,并且在我从Android Studio或使用./gradlew构建时工作正常,但这里是:

SomeApp /的build.gradle:

buildscript {
    ext {
        DEXGUARD_HOME = "$System.env.DEXGUARD_HOME"
    }

...    

SomeApp /应用/的build.gradle:

buildTypes {
    ...

    release {
         minifyEnabled true
         proguardFile DEXGUARD_HOME + "Dexguard-7.3.11/lib/dexguard-release-aggressive.pro"
         proguardFile 'dexguard-project.txt'
         signingConfig signingConfigs.release
     }
}

1 个答案:

答案 0 :(得分:2)

该消息通常表示ProGuard仍处于启用状态 - ProGuard不知道DexGuard选项-dalvik。您应该将minifyEnabled设置为false。 DexGuard本身已经缩小,优化和混淆了所有代码和资源。