简体   繁体   中英

Android app works in debug but not in release, idk why

The login with Twitter works ins debug, but not in release, also the size of the apk is bigger in the debug. Where is the problem??

i have 3 activitys

this is the build.grandle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.2"
    defaultConfig {
        applicationId "com.PolDevs.MyClickerGame"
        minSdkVersion 23
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-auth:19.1.0'
    implementation 'com.google.firebase:firebase-database:19.1.0'
    implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
    implementation 'com.google.firebase:firebase-core:17.2.2'
    implementation 'com.twitter.sdk.android:twitter-core:3.1.0'

    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test.ext:junit:1.1.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'

Open the documentation for all the libraries you are using and double check if they have any specific rules to be put in proguard since that is enabled during release build. proguard obfuscates you're APK when making a release build, which means removing code like annotations and comments etc. which also reduces the size of the apk.

So for some libraries to work, you have to specify some rules in your proguard file to no obfuscate certain things. Common error to be careful of when maiking debug and release builds.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM