I have been using DexGuard successfully with Gradle
in Android Studio without any issues. I recently tried my hands on OkBuck
to speed up my build time and it really helped me.
Although it is able to build debug and signed APKs for me, but when I try building for release with DexGuard like:
./buckw install --run app:bin_release
I get the following error:
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
It is probably insignificant to mention the details of DexGuard integration as it is done as per the documentation and is working fine when I build from within Android Studio or using ./gradlew
, but here it is:
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
}
}