Android app-release-unsigned.apk 未签名
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25001479/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
app-release-unsigned.apk is not signed
提问by andrew
I downloaded the zip file of an Android app on github and I'm trying to run it, but I get a dialog with this message
我在 github 上下载了一个 Android 应用程序的 zip 文件,我正在尝试运行它,但我收到了一个带有此消息的对话框
app-release-unsigned.apk is not signed. Please configure the signing information for the selected flavor using the Project Structure dialog.
I'm using Android Studio. What am I supposed to do?
我正在使用 Android Studio。我应该做些什么?
回答by NightFury
If anyone wants to debug releasebuild using Android Studio, follow these steps:
如果有人想使用 Android Studio调试发布版本,请按照以下步骤操作:
- Set build variant to release mode.
- 将构建变体设置为发布模式。
Right click on appin left navigation pane, click Open Module Settings.
Go to Signing Tab. Add a signing config and fill in information. Select your keychain as well.
右键单击左侧导航窗格中的应用程序,单击“打开模块设置”。
转到签名选项卡。添加签名配置并填写信息。也选择您的钥匙串。
- Go to Build Typetab. Select release mode and set:
- 转到构建类型选项卡。选择释放模式并设置:
-Debuggable to true.
- 可调试为true。
-Signing Config to the config. (The one you just created).
- 将 Config 签名到config。(您刚刚创建的那个)。
Sync your gradle. Enjoy!
同步你的gradle。享受!
回答by Stéphane
Make sure the build variantis set to debug(and not release) in Android Studio (check the build variantspanel).
确保在 Android Studio中将构建变体设置为debug(而不是release)(检查构建变体面板)。
If set to debug, it should automatically sign the app with the auto-generated debug keystore, without editing the build scripts.
如果设置为调试,它应该使用自动生成的调试密钥库自动签署应用程序,而无需编辑构建脚本。
However you will need to create and configure a specific keystore for release.
但是,您需要为发布创建和配置特定的密钥库。
Official documentation, covering debug and release modes: https://developer.android.com/tools/publishing/app-signing.html
官方文档,涵盖调试和发布模式:https: //developer.android.com/tools/publishing/app-signing.html
回答by Martin Revert
Always sign your build using your build.gradle DSL script like this:
始终使用 build.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
}
}
}
If you want to understand a little more of the Gradle build system associated to Android Studio just pay a visit to:
如果您想了解更多与 Android Studio 相关的 Gradle 构建系统,只需访问:
回答by Mohammad Khan
I was successfully able to debug signed APK , Follow this procedure:-
我成功调试了已签名的 APK,请按照以下步骤操作:-
- Choose "release" version in "Build Variant" ToolBar
- In the
Build.gradle
for the module setdebuggable true
for release build type - Go to File->Project Structure->under signing tab fill all info->Under Flavours tab->Choose signing Config You just created
- Set the breakpoints
- Run the application in the debug mode
- 在“Build Variant”工具栏中选择“release”版本
- 在为发布构建类型
Build.gradle
设置的模块中debuggable true
- 转到文件->项目结构->在签名选项卡下填写所有信息->在风味选项卡下->选择您刚刚创建的签名配置
- 设置断点
- 在调试模式下运行应用程序
回答by Shohel Rana
If anyone wants to debug and release separate build variant using Android Studio 3.5, follow the below steps: 1. Set build variant to release mode.
如果有人想使用 Android Studio 3.5 调试和发布单独的构建变体,请按照以下步骤操作: 1. 将构建变体设置为发布模式。
- Go to File >> Project Structure
- Select Modules, then Signing Config
- Click in the Plus icon under Signing Config
- 转到文件>>项目结构
- 选择模块,然后签名配置
- 单击签名配置下的加号图标
- Select release section and Provide your release App Information then Apply and OK.
- 选择发布部分并提供您的发布应用信息,然后应用和确定。
- Go to your app level
build.gradle
and change yourbuildTypes
> "release" section like below Screenshot.
- 转到您的应用程序级别
build.gradle
并更改您的buildTypes
>“发布”部分,如下面的屏幕截图。
Then Run your Project. Happy Coding.
然后运行你的项目。快乐编码。
回答by Samir Mangroliya
if you want to run app in debugmode
如果你想在调试模式下运行应用程序
1) Look at Left Side bottom, above Favorites there is Build Variants
1)查看左侧底部,在收藏夹上方有构建变体
2) Click on Build Variants. Click on release and choose debug
2) 单击构建变体。点击发布并选择调试
it works perfect !!!
它工作完美!
回答by NickUnuchek
signingConfigs should be before buildTypes
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
}
}
回答by Alex Tam
The app project you downloaded may include a signed info in the file of build.gradle. If you saw codes like these:
您下载的应用项目可能在 build.gradle 文件中包含签名信息。如果你看到这样的代码:
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
}
}
you could delete them and try again.
你可以删除它们然后再试一次。
回答by Evgenii Vorobei
For gradle Kotlin dsl
对于 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")
}
}
回答by ben75
For security reasons, you cannot install an unsigned apk on Android. So if you only have the unsigned apk: you must sign it. Here is how to do that : link
出于安全原因,您不能在 Android 上安装未签名的 apk。因此,如果您只有未签名的 apk:您必须对其进行签名。这是如何做到的:链接
Note that you can sign the apk with a self-signed certificate.
请注意,您可以使用自签名证书对 apk 进行签名。
An alternative can be either :
另一种选择可以是:
- to download the signed apk if available.
- to download the sources, compile them (with Android-Studio or gradle or ...). It will produce multiple apks and one of them will be signed with your debug-key (and so you will be able to install it)
- 下载已签名的 apk(如果可用)。
- 下载源代码,编译它们(使用 Android-Studio 或 gradle 或 ...)。它将生成多个 apk,其中一个将使用您的调试密钥进行签名(因此您将能够安装它)