Release Apk Error Android Studio

I generated the unsigned release APK in Android Studio and it does not work. I run my app in debug on my phone and it works perfectly, but the release apk does not.

The app just haves to show simple text in textviews and it does not ... I do not know what to do.

Please help

3

3 Answers

Sign it. All apks, including debug ones, must be signed to be used. The debug ones just use an automatically generated keystore for signing.

After entering Generate Signed APk and just changed the buildTypes in the section of Gradle i changed minifyEnabled true to false.

That was all.

buildTypes {
    release {
        minifyEnabled false
        proguardFile getDefaultProguardFile('proguard-android.txt')
        proguardFile 'proguard-project.txt'
        zipAlignEnabled true
    }
}

If you have enabled proguard (i.e minifyEnabled true) and specifically getting "Wrong number of Segments" error (this is related to JWT based API call authentication) in release build then add these rules in your proguard-rules.pro file:

-keepattributes Signature
-keepattributes InnerClasses

-keep class io.jsonwebtoken.** { *; }
-keepnames class io.jsonwebtoken.* { *; }
-keepnames interface io.jsonwebtoken.* { *; }

-keep class org.bouncycastle.** { *; }
-keepnames class org.bouncycastle.** { *; }
-dontwarn org.bouncycastle.**

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Marcus Vance

Marcus Vance

Cybersecurity & Digital Privacy Researcher

Marcus Vance is a cybersecurity auditor and technology writer dedicated to educating the public about online safety, data privacy regulations, enterprise security, and emerging cyber threats.

Share this article
Twitter Facebook Pinterest