Android Studio & Proguard: Cannot Resolve Symbol Getdefaultproguardfile?
Solution 1:
I had the same trouble as shown here:
The error message makes it seem as if the file is not being found, and therefore not read. However, I went to into sdk/tools/proguard folder to find the file, and at the top added a statement to test if the file was actually being read. I put at the top "Will this crash it?"
As you can see from the error, the file was indeed found during the build process and the statement I added crashed it. Thus, it appears the "can't resolve symbol" error is giving a false positive.
Solution 2:
Try to change into -
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
Solution 3:
I really had the same issue. So here is what made my project working:
release {
minifyEnabled true
proguardFile 'proguard-rules.pro'
}
Tested by this code:
Log.d(TAG, "TEST!");
Log.i(TAG, "INFO!");
Log.e(TAG, "ERROR!");
In proguard.pro I placed this snippet (which removes all Log.d
-Statements in the byte-code)
-assumenosideeffects classandroid.util.Log {
publicstaticintd(...);
}
And the cat says:
MainAct﹕ INFO!
MainAct﹕ ERROR!
-> exactly what I tried to achieve :)
PS: This assumes that you have the proguard.pro
file in the module (aka 'app') folder.
Solution 4:
Try:
proguardFiles.add(file('proguard-android.txt'))
proguardFiles.add(file('proguard-rules.txt'))
This structure works in the gradle-experimental plugin.
Solution 5:
I fixed the issue of Android Studio not recognising the method by using double quotes instead of the single. The below is what I ended up using:
release{
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile("proguard-android.txt"),
"proguard-rules.pro"
}
Post a Comment for "Android Studio & Proguard: Cannot Resolve Symbol Getdefaultproguardfile?"