buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Just update your buildTypes instead your .
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Then Clean - Rebuild And
File -> Invalidate Cache / Restart . I hope it will helps you .
FYI : I think your gradle file under " apply plugin: 'com.android.application'"
buildTypes {
release {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
OR
You can try File -> Invalidate Caches/Restart, and select this option to fix this.
Related
I'am using minifyenable = true but error in aapt_rules.txt
my build.gradle
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
}
debug {
debuggable true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
error logcat
Expected field or method name at /Users/ujangwahyu/REINOVASI/ANDROID/DEV/MS2_Android/app/build/intermediates/aapt_proguard_file/isByPassDebug/aapt_rules.txt:148:33
-keepclassmembers class * { *** #{(v) -> vm.onClickEnter(v)}(android.view.View); }
Some days before I also faced the same issue and I fixed it by configuring gradle.properties and build.gradle(project level)
put below two lines in gradle.properties
android.enableR8=false
android.enableR8.libraries=false
put below lines of code inside buildscript{} in build.gradle(project level)
configurations.all {
resolutionStrategy {
force 'net.sf.proguard:proguard-base:6.1.0'
}
}
I have two different flavor's, RQT & PRD.
And for one of them, I want to disable proguard configuration (for RQT, disable proguard for both buildTypes).
Like add conditioning ? Is something like that is possible ?
android {
...
flavorDimensions("server")
productFlavors {
rqt {
dimension "server"
applicationIdSuffix ".rqt"
}
prd {
dimension "server"
applicationIdSuffix ".prd"
}
}
...
buildTypes {
debug {
(__if (flavor != RQT) then do proguard config...__)
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile 'proguard-debug-project.txt'
}
release {
(__if (flavor != RQT) then do proguard config...__)
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile 'proguard-release-project.txt'
}
}
...
}
You could create additional Build Types, e.g. debugNoProguard, releaseNoProguard, etc.
android {
variantFilter { variant ->
def needed = variant.name in [
'rqtDebugNoProguard',
'rqtReleaseNoProguard',
'prdDebug',
'prdRelease'
]
variant.setIgnore(!needed)
}
buildTypes {
debug {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFile 'proguard-debug-project.txt'
}
debugNoProguard {
debuggable true
minifyEnabled false
signingConfig signingConfigs.debug
}
....
}
}
Then instead of building rqtDebug you would build the variant rqtDebugNoProguard or prdDebugNoProguard when you wanted to run a debug build without ProGuard.
Proguard is working well for release version but it is not work for debug version.
Here is my build.gradle file
buildTypes {
debug {
lintOptions {
disable 'MissingTranslation'
}
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
lintOptions {
disable 'MissingTranslation'
}
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
I'm using TeamCity to build version of application and upload it to HockeyApp. I want to enable proguard only on specific flavor and when building is on teamcity and uploading on HockeyApp, is it possible? Right now I defined variable in gradle file:
def runProguard = false
and set it in my flavors to false or true and then in build type I have:
if (project.hasProperty('teamcity') && runProguard.toBoolean()) {
minifyEnabled true
} else {
minifyEnabled false
}
but it doesn't work on teamcity and I have version without proguard on HockeyApp. How to fix it? Is it another way to do it for example defining gradle task with enabled proguard?
You should do something like this to achieve what you want:
android {
buildTypes {
debug {
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules-debug.pro'
}
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
mock {
initWith(buildTypes.release)
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
pro {
applicationId = 'com.example.app.pro'
}
free {
applicationId = 'com.example.app.free'
}
}
Also you can set some environment variable in teamcity and check if the build is happening on ci or it's on local machine:
if (!System.getenv("CI")) {
//do something on local machine
} else {
// do something on ci server
}
in the version 0.4.2 i write in the AndroidManifest
android:debuggable="false" to upload to play.store
but in the 0.5.1, i do not what to do.
Please, help me.
y resolved my problem with
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
foo{
debuggable false //add this
}
}
in the androidmanifest
i resolved the problem with
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
foo{
debuggable false //add this
}
}