HI I have develop one app which is working perfectly in debug . but same code base when i trying to run code in release build some API is not firing because proguard . i dont know its because of proguard or minifyEnabled true or shrinkResources true then i made both false as below .
buildTypes {
release {
minifyEnabled false
shrinkResources false
crunchPngs false // Paste this line
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
using above code its working fine but when i try to upload build in play store release build with signed bundle file then its showing below error :
You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play. Learn more about debuggable APKs and Android App Bundles.
please help me how to fix this issue .can we disable proguard for release build if not then how to fix this issue .
Related
I recently started using Firebase Dynamic Links in my Android app. Everything works great when I run my app with a debug APK. When I click on a dynamic link, it opens my app on the correct screen with the intent filter I set up in my manifest.
Here's what it looks like in the debug version:
Correct result
However, I have noticed that the dynamic link doesn't work when I generate a release APK and try to click the same link. Instead the link opens in a browser first before opening my app at the launcher activity which isn't the activity I specified with my intent filter.
Here's the same test in the release version:
Incorrect result
I'm assuming this is a problem with my build settings but it could be something else. I haven't been able to identify it. I tried disabling proguard in my app's build.gradle file but that had no effect.
For reference, here's the buildTypes snippet of my build.gradle file:
buildTypes {
debug{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
Also the proguard-rules.pro file is currently empty. Any help would be appreciated!
Have you created a SHA256 key based on your production keystore? You have to add it to your project inside the Firebase console in order to have app links enabled.
Reference to documentation: https://firebase.google.com/docs/dynamic-links/android/receive#app_links
In build.gradle (app) file we have this by default,
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
According to https://developer.android.com/studio/build/shrink-code,
minifyEnabled true make the code more secure (making it hard to reverse engineer) and also shrink the size in release build, which we use for publishing the app.
I know that using minifyEnabled true makes compile time longer, but usually debug builds are used for development and testing, which is not affected anyways.
What I'm looking for is that, what are the disadvantages (such as performance impacts) cause by using minifyEnabled true at runtime. I'm not worried about the build time of a release build.
Google Play Console also recommending us to enable it therefore I'm wondering why is minifyEnabled is disabled by default.
By adding minifyEnabled true in your release build you can obfuscate code but it is set to false by default in release builds because if set true it shall require proguard rules to be written to tell the compiler which classes are to be ignored while obfuscating the code. If minifyEnabled is set to true by default and the developer forgets to add proguard rules, it can lead to runtime crashes.
However, setting minifyEnabled to true and shrinkResources to true can reduce your apk size.
As NIKHIL AGGARWAL said, setting minifyEnabled to true can lead to runtime crashes.
You should research each used library so that include their ProGuard rules into your project. Also sometimes after Gradle or libraries upgrade you should again check ProGuard rules and accordingly update them in your project.
You should add data classes of your network model to ProGuard.
You should check your release build on several devices/emulators with different Android versions to understand where it can crash. Debugging in release build is difficult and with obfuscation it becomes a nightmare.
However after you set minifyEnabled = true and avoid crashes you will decrease apk size and impede to cracking attempts.
I would like to publish a a library with debuggable true on release build types. This would help me debug that library. What are the potential problems if this library goes into production? Is it secure ? What difference does it make when released with debuggable as false?
buildTypes {
release {
minifyEnabled true
debuggable true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
First of all, you can not publish an apk with debuggable set to true.
Google play console will give you an error just after you upload the apk.
Secondly, it is not secure at all. Your apk will be very slow.
There are differences in a debug build and a release build. Release builds are much faster. Release builds do not print logs (it is a good practice to not print logs in release builds) which makes execution slower as it takes time to print the characters in the console and all print commands are usually in sync.
Moreover, a release build may also trigger code obfuscation and splits.
In my debug android app I made a sign in into firebase with google and facebook and it worked well, but after generating signed APK it's not working, I updated SHA1 in firebase project with release SHA and updated key hash in facebook for developers also but it still not working what can I do.
Most of the times things like this happens because of proguard, it removes some of the files when building apk. Check if it works when proguard is disabled. if it works then try to configure proguard to keep all required files.
To disable proguard set minifyEnabled false in build.gradle
after changing it will look somewhat like
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
To further configure proguard you can easily find tutorial on google.
Some helpful links:-
https://stackoverflow.com/a/26274623/5176343
https://stackoverflow.com/a/15761408/5176343
It's tough to say without seeing the code, but one thing that has worked for me in the past was turning off proguard and/or minify in build.gradle. Those things were changing property names in the release apk for me which then caused de-serialization to fail for me because the names didn't match what was in the json.
Have you selected a build version to release and than generate singed apk i hope this will work for you.
I have an app that works fine in debug mode, but when I create a signed apk and install it on the same phone, some features do not work.
Is there a way to get console messages from the release version?
Thanks in advance.
#Matt If it is working fine in your simulator while running in debug mode then obviously it should work with your apk in mobile device as well. Actually elaborate your question.
In you release gradle build change to this
release {
multiDexEnabled true
minifyEnabled false
shrinkResources false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
multiDexEnabled true
minifyEnabled false
shrinkResources false
}
hope this is helpful .