[英]app-release-unsigned.apk is not signed
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.我正在使用 Android Studio。 What am I supposed to do?
我应该做些什么?
If anyone wants to debug release build using Android Studio, follow these steps:如果有人想使用 Android Studio 调试发布版本,请按照以下步骤操作:
Right click on app in left navigation pane, click Open Module Settings .右键单击左侧导航窗格中的应用程序,单击“打开模块设置” 。
Go to Signing Tab.转到签名选项卡。 Add a signing config and fill in information.
添加签名配置并填写信息。 Select your keychain as well.
也选择您的钥匙串。
-Debuggable to true . - 可调试为true 。
-Signing Config to the config . - 将 Config 签名到config 。 (The one you just created).
(您刚刚创建的那个)。
Sync your gradle.同步你的gradle。 Enjoy!
享受!
Make sure the build variant is set to debug (and not release ) in Android Studio (check the build variants panel).确保在 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
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 构建系统,只需访问:
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. 将构建变体设置为发布模式。
build.gradle
and change your buildTypes
> "release" section like below Screenshot.build.gradle
并更改您的buildTypes
> "release" 部分,如下面的屏幕截图。 Then Run your Project.然后运行你的项目。 Happy Coding.
快乐编码。
I was successfully able to debug signed APK , Follow this procedure:-我成功调试了已签名的 APK,请按照以下步骤操作:-
Build.gradle
for the module set debuggable true
for release build typeBuild.gradle
中为发布构建类型设置debuggable true
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
}
}
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")
}
}
if you want to run app in debug mode如果你想在调试模式下运行应用程序
1) Look at Left Side bottom, above Favorites there is Build Variants 1)查看左侧底部,在收藏夹上方有构建变体
2) Click on Build Variants. 2) 单击构建变体。 Click on release and choose debug
点击发布并选择调试
it works perfect !!!它工作完美!
The app project you downloaded may include a signed info in the file of build.gradle.您下载的应用项目可能在 build.gradle 文件中包含签名信息。 If you saw codes like these:
如果你看到这样的代码:
buildTypes {
debug {
signingConfig signingConfigs.release
}
release {
signingConfig signingConfigs.release
}
}
you could delete them and try again.你可以删除它们然后再试一次。
For security reasons, you cannot install an unsigned apk on Android.出于安全原因,您不能在 Android 上安装未签名的 apk。 So if you only have the unsigned apk: you must sign it.
因此,如果您只有未签名的 apk:您必须对其进行签名。 Here is how to do that : link
这是如何做到的: 链接
Note that you can sign the apk with a self-signed certificate.请注意,您可以使用自签名证书对 apk 进行签名。
An alternative can be either :另一种选择可以是:
How i solved this我是如何解决这个问题的
This error occurs because you have set your build variants to release mode.发生此错误是因为您已将构建变体设置为发布模式。 set it to build mode and run project again.
将其设置为构建模式并再次运行项目。
If you want to run in release mode, just generate a signed apk the way we do it normally when releasing the app如果你想在发布模式下运行,只需按照我们发布应用程序时通常的方式生成一个签名的apk
在工具窗口栏中选择 Build Variants Change Build Variant from Release to Debug
My solution was to change the name of my signing config from the default "config" to "debug".我的解决方案是将我的签名配置的名称从默认的“配置”更改为“调试”。 To verify, I changed it to some other random name and got the error again, and then changed it back to "debug" and the error was gone.
为了验证,我将其更改为其他一些随机名称并再次出现错误,然后将其更改回“调试”并且错误消失了。 So while it seems artificial and I tend to not believe this is the whole story, give this solution a try.
因此,虽然它看起来很人为,而且我倾向于不相信这是整个故事,但请尝试使用此解决方案。
i also appear this problem,and my code below我也出现这个问题,下面是我的代码
storeFile file(properties.getProperty("filepath"))
storePassword properties.getProperty("keypassword")
keyAlias properties.getProperty("keyAlias")
keyPassword properties.getProperty("keypassword")
the reason is property name error,it should be keyPassword not keypassword原因是属性名错误,应该是keyPassword而不是keypassword
What finally worked for me, and I have no idea why, is:最终对我有用的,我不知道为什么,是:
Notice I did try to copy many times by selecting the password by clicking at the end of the password and selecting the password by moving the mouse.请注意,我确实尝试通过单击密码末尾并通过移动鼠标选择密码来选择密码来进行多次复制。
It is strange but it only worked by double clicking on top of the password to copy it.这很奇怪,但它只能通过双击密码顶部来复制它。
Also I did use the Open Module Settings > Signing... method explained by @NightFury on this post.我也确实使用了@NightFury 在这篇文章中解释的 Open Module Settings > Signing... 方法。
adding below lines of code in build.gradel file worked for me, add them under buildTypes block below release as shown在 build.gradel 文件中添加以下代码行对我有用,将它们添加到 release 下面的 buildTypes 块下,如图所示
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
applicationIdSuffix ".debug"
debuggable true
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.