簡體   English   中英

Android 應用程序可以在調試中運行,但不能在發布中運行,我知道為什么

[英]Android app works in debug but not in release, idk why

使用 Twitter 登錄在調試中有效,但在發布中無效,並且調試中 apk 的大小更大。 問題出在哪兒??

我有 3 個活動

這是 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'

打開您正在使用的所有庫的文檔,並仔細檢查它們是否有任何要放入proguard特定規則,因為在發布構建期間啟用了這些規則。 proguard在進行發布版本時會混淆你的 APK,這意味着刪除注釋和注釋等代碼,這也減少了 apk 的大小。

因此,要使某些庫正常工作,您必須在proguard文件中指定一些規則, proguard混淆某些內容。 進行調試和發布構建時要注意的常見錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM