【发布时间】:2020-02-21 19:29:25
【问题描述】:
我正在尝试安装一个我确保可以正常工作的应用程序(通过 Android Studio 上的播放按钮安装工作正常)但是如果我尝试通过 Play 商店安装或直接通过 APK 文件安装,则会出现错误: “未安装应用”。此错误发生在小米红米 note 5 而不是 7 上(其中一个以前从未安装过此应用程序)。
当我尝试使用 Android Studio 通过生成的 APK 版本直接安装时会发生这种情况。
Build -> Generate Signed Bundle/APK -> APK -> Insert my passwords -> 选择 Release 并选中两个复选框(V1 和 V2),我只尝试了 V1 和 V2,但都没有工作...
现在我尝试转到 Build -> Build bundle/APK -> Build APK,它可以使用调试文件进行安装。但是我无法将此文件上传到 Play 商店。 所以问题出在 RELEASE 版本的 APK 文件上。如何修复它以便将其上传到 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'
}
【问题讨论】:
-
您要生成哪些构建变体以在 Play 商店中发布?你还应该检查你是否有proguard的问题
-
嗨@JuanE.LondoñoT。并感谢您的评论。 “变体”是什么意思?如果您的意思是两个复选框(Jar 签名和完整的 APK 签名),我已经对这个问题进行了解释,已经尝试了所有组合。现在关于proguard,我没有任何问题。
-
看看下面的link,你可以看到更多关于构建变体的信息,以防它有你的应用程序的不同变体。未安装应用程序,当我尝试安装未签名或先前安装了调试版本的发布 apk 时出现该错误,当我尝试安装发布版本时它生成错误。
-
再次感谢@JuanE.LondoñoT。但我之前什至没有使用过变体......这不是我的第一个应用程序,但这是第一次出现此错误。所有其他应用程序都能够正确发布。我猜这个新的 Android Studio 版本发生了一些变化,导致这个生成的 APK 无法工作
标签: android android-studio apk