【发布时间】:2019-11-29 23:22:50
【问题描述】:
一点背景。几个月来我一直在构建/调试/测试我的简单应用程序,没有任何问题。在 AVD 或我实际的 S9 手机上构建/安装。几个月来一切都很好。现在,准备好在 Play 商店中发布我的第一个 beta 版本(我的第一个应用程序)。所以,我按照“签署”我的应用程序的说明进行操作。那行得通,我将我的应用程序包上传到了 Play 商店。现在我再也无法在 Android Studio 中构建/调试/安装了。
错误:您当前选择的变体 (app-release-unsigned.apk) 的 apk 未签名。请为此变体(版本)指定签名配置。
调试 (Shift+F9) 产生上述错误并显示“编辑配置”对话框。
我点击“修复”按钮,然后我不知道该怎么做。或者如何使用这些不同的构建配置。
build.gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
debug {
storeFile file(var)
storePassword 'xxx'
keyAlias = 'xxx'
keyPassword 'xxx'
}
}
compileSdkVersion 29
buildToolsVersion "29.0.1"
defaultConfig {
applicationId "com.birdersdiary.mobile"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "b1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.preference:preference:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
单击“修复”按钮后,我将进入“运行/调试配置”对话框。从那里开始,我完全忘记了为了解决问题需要发生什么。
非常感谢任何帮助。
【问题讨论】:
-
您应该在 build.gradle 上为 buildType 版本设置歌唱配置。如果您需要进一步帮助,请发布您的应用 build.gradle
-
谢谢。我按要求发布了我的 build.gradle。
-
1:您可以修改图片下方的构建版本流程image
-
请不要在问题中编辑解决方案公告。接受(即单击旁边的“勾号”)现有答案之一,如果有的话。如果现有答案尚未涵盖您的解决方案,您还可以创建自己的答案,甚至接受它。比较stackoverflow.com/help/self-answer
标签: android android-studio android-buildconfig