我一直在 Android Studio 中成功使用 DexGuard,Gradle
没有任何问题。我最近尝试过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/app/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
}
}