Reputation: 7051
Using gradle wrapper 2.10, and Android Gradle build tools 2.0.0-beta7 2.1.0
From my build.gradle:
buildTypes {
all{
minifyEnabled true
proguardFiles = [getDefaultProguardFile("proguard-android.txt"), 'proguard-project.pro'];
}
}
This works. Things are obfuscated.
I have the following line in my proguard-project.pro as well:
-printmapping my-mapping.txt
Everything else in that file works fine, but the mapping keeps getting printed to the wrong place:
Printing mapping to [C:\path\to\my\project\build\outputs\mapping\debug\mapping.txt]
Has this syntax changed?
Note: I've tried supplying a direct path. I've tried supplying a name without a hyphen. Nothing changes.
For now I just made a gradle copy task for it.
Upvotes: 28
Views: 2984
Reputation: 44831
Starting from Android Studio 3.5.3 and AGP 3.5.3 the -printmapping
parameter is respected.
For example using:
-printmapping mapping.txt
It is copied from the default:
{projectRoot}\build\outputs\mapping\release\mapping.txt
to:
{projectRoot}\mapping.txt
Upvotes: 0
Reputation: 111
Just try to start Android Studio as administrator.
-printmapping
may not write to system folder which cause this issue.
Upvotes: -1
Reputation: 10309
The mapping file at location build\outputs\mapping\debug\mapping.txt
is the default one that gets generated even when you don't specify -printmapping my-mapping.txt
inside proguard-project.pro
. I see the name is always mapping.txt
so -printmapping
is being ignored with the new Android Studio version.
I remember it used to get generated at the same project root folder where proguard-project.pro
is present but I confirm, it doesn't generate now with Android Studio 2.0 and is a bug that you can file at Android Issue Tracker.
UPDATE
Link to Android Issue: https://code.google.com/p/android/issues/detail?id=205213
Upvotes: 11
Reputation: 412
Maybe you can change to follwoing
android {
buildTypes {
release {
runProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'),'some-other-rules.txt'
//proguardFile 'some-other-rules.txt'
}
}
}
Upvotes: 0
Reputation: 1008
Faced with same problem, but it seems that
{projectRoot}\build\outputs\mapping\debug\mapping.txt
is correct place for mapping files now
Upvotes: 4