安卓工作室 : Generated Release APK not working

标签 android android-studio apk

我正在尝试安装一个应用程序,我确保该应用程序可以正常工作(通过 Android Studio 上的播放按钮安装可以正常工作)但是如果我尝试通过 Play 商店或直接通过 APK 文件安装,我会收到错误消息: “应用未安装”。此错误发生在小米 Redmi note 5 而不是 7(其中一个之前从未安装过此应用程序)。
当我尝试使用 Android Studio 通过生成的 APK 版本直接安装时会发生这种情况。

Build -> Generate Signed Bundle/APK -> APK -> Insert my passwords -> 选择 Release 并选中两个复选框(V1 和 V2),我只尝试了 V1 和 V2,但都没有用...

现在我尝试转到构建 -> 构建 bundle/APK -> 构建 APK,它可以使用调试文件进行安装。但是我无法将此文件上传到 Play Store。 所以问题出在 APK 文件的 RELEASE 版本上。我该如何修复它以便将其上传到 Play 商店

PS:在第三台设备上试过这个调试文件,也没有用。 如果我直接从 Android Studio 播放按钮 安装,所有 3 台设备都能正常工作

这是我的 build.gradle (Module:app) 文件:

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

    android {
        compileSdkVersion 28
        buildToolsVersion "29.0.2"
        defaultConfig {
            applicationId "com.appdidier.hospitalar"
            minSdkVersion 16
            targetSdkVersion 28
            versionCode 5
            versionName "1.0"
            testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
            multiDexEnabled true
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    }
    lintOptions {
        checkReleaseBuilds false
    }
}

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
    //    implementation 'androidx.appcompat:appcompat:1.1.0'
        implementation 'com.android.support:design:28.0.0'
        implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'androidx.test:runner:1.2.0'
        androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
        implementation 'com.google.firebase:firebase-analytics:17.2.0'

        implementation 'com.google.firebase:firebase-database:19.2.0'
        implementation 'com.google.firebase:firebase-storage:19.1.0'
        implementation 'com.google.firebase:firebase-auth:19.1.0'
    ////    implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
        implementation 'com.google.firebase:firebase-messaging:20.0.0'
    //    implementation 'com.google.android.gms:play-services:12.0.1'
    //    implementation 'com.google.android.gms:play-services-maps:15.0.1'
    //    implementation 'com.google.android.gms:play-services-location:11.6.0'
        implementation 'com.itextpdf:itextg:5.5.10'
        implementation 'com.android.support:multidex:1.0.3'
        implementation 'com.github.barteksc:android-pdf-viewer:2.8.1'
        implementation "com.squareup.picasso:picasso:2.71828"
        implementation 'com.github.chrisbanes:PhotoView:2.1.3'
    //    implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
        implementation 'com.google.code.gson:gson:2.8.5'
        implementation 'com.github.sundeepk:compact-calendar-view:1.9.1'
        implementation 'com.google.android.gms:play-services-maps:17.0.0'

    }

最佳答案

我最终通过删除 list 文件中的这行代码解决了我的问题:

android:protectionLevel="signature"

很遗憾 Google 没有调试此问题的报告...我费了很大的劲才找到它。 当问题只是:“应用程序未安装”时很难找到解决方案

关于安卓工作室 : Generated Release APK not working,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58558619/

相关文章:

android - 无法压缩 apk android android studio 2.2

android - 构建 APK : Algorithm HmacPBESHA256 not available 时出错

gradle - 更新Android Studio Gradle插件以获取新的GDK版本

android - XMPP与安卓交互

android - 如何在android中顺时针和逆时针旋转图像(指尖旋转)?

android - 使用 HttpResponse 时出现异常 response = client.execute(request);

android-studio - 从源键盘映射/转到文件/在项目 View 中定位文件

android - 缩放和加载位图导致 OOM (OutOfMemoryError) (Android)

Android Studio 不显示代码更改并且无法生成最近更改的签名 apk

java - 我应该安装哪个 Java JDK 才能使用 Android Studio