我在github上下载了一个Android应用程序的zip文件,我试图运行它,但我得到了一个带有此消息的对话框
app-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog.
我使用Android Studio。 我该怎么办?
我在github上下载了一个Android应用程序的zip文件,我试图运行它,但我得到了一个带有此消息的对话框
app-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog.
我使用Android Studio。 我该怎么办?
当前回答
我是怎么解决的
发生此错误是因为您已将构建变量设置为发布模式。将其设置为构建模式并再次运行项目。
如果你想在发布模式下运行,只需生成一个签名的apk,就像我们在发布应用程序时通常做的那样
其他回答
如果任何人想使用Android Studio 3.5调试和发布单独的构建变体,请遵循以下步骤: 1. 将构建变体设置为发布模式。
进入“文件>>项目结构” 选择模块,然后签名配置 单击签名配置下的加号图标
选择发布部分,并提供您的发布应用程序信息,然后应用和确定。
回到你的应用级别构建。gradle和改变你的buildTypes >“发布”部分如下截图。
然后运行你的项目。快乐的编码。
用于gradle Kotlin dsl
signingConfigs {
create("releaseConfig") {
storeFile = file("your keystore file path")
storePassword = "storePassword"
keyAlias = "keyAlias"
keyPassword = "keyPassword"
}
}
buildTypes {
getByName("release") {
signingConfig = signingConfigs.getByName("releaseConfig")
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
我成功地调试了签名的APK,遵循这个过程:-
在“Build Variant”工具栏中选择“release”版本 在构建中。Gradle为模块设置debuggable true为发布构建类型 去文件->项目结构->签名选项卡下填写所有信息->风味下 tab->选择刚刚创建的签名配置 设置断点 在调试模式下运行应用程序
始终使用您的构建对您的构建进行签名。gradle DSL脚本是这样的:
android {
signingConfigs {
debug {
storeFile file("debug.keystore")
}
myConfig {
storeFile file("other.keystore")
storePassword "android"
keyAlias "androidotherkey"
keyPassword "android"
}
}
buildTypes {
bar {
debuggable true
jniDebugBuild true
signingConfig signingConfigs.debug
}
foo {
debuggable false
jniDebugBuild false
signingConfig signingConfigs.myConfig
}
}
}
如果你想了解更多与Android Studio相关的Gradle构建系统,请访问:
Gradle插件用户指南
signingConfigs应该在buildTypes之前
signingConfigs {
debug {
storeFile file("debug.keystore")
}
myConfig {
storeFile file("other.keystore")
storePassword "android"
keyAlias "androidotherkey"
keyPassword "android"
}
}
buildTypes {
bar {
debuggable true
jniDebugBuild true
signingConfig signingConfigs.debug
}
foo {
debuggable false
jniDebugBuild false
signingConfig signingConfigs.myConfig
}
}