Can't generate signed APK in Android Studio, because proguard-rules.txt is missing
Solution 1
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
should work ok, as long as you don't need any special ProGuard configuration. If you do, use your original proguardFiles
entry and create the file
/Users/franek/Documents/Android_Studio_Melange/app/proguard-rules.txt
Then put your custom rules in this file.
Solution 2
Delete folder build inside app folder, then regenerate.
Solution 3
You can try delete folder build inside app folder.
Then regenerate.
fragon
Updated on June 05, 2022Comments
-
fragon almost 2 years
I have a problem with generating signed APK in Android Studio. After fixing all the warnings I am stuck on this one:
Error:Execution failed for task ':app:proguardRelease'. java.io.FileNotFoundException: /Users/franek/Documents/Android_Studio_Melange/app/proguard-rules.txt (No such file or directory)
I don't want to change minifyEnabled to false, because I want to keep Proguard working. How can I fix this error?
A fragment of build.gradle:
buildTypes { release { minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } }
-
stkent about 8 yearsThis seems like it might be dangerous, since the default ProGuard files protect a bunch of Android platform stuff from obfuscation: see e.g. android.googlesource.com/platform/sdk/+/… You can guess what might break by looking at the classes in this list.
-
Luke Needham about 8 yearsMy app runs fine after exporting through this proguard configuration, and does properly obfuscate the code, although you are probably correct. However since I couldn't get it to work any other way, this is the only option I could find.
-
Leap Bun about 7 yearsThis helps me. Thanks.