简体   繁体   English

app-release-unsigned.apk 未签名

[英]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 调试发布版本,请按照以下步骤操作:

  1. Set build variant to release mode.将构建变体设置为发布模式。

在此处输入图片说明

  1. Right click on app in left navigation pane, click Open Module Settings .右键单击左侧导航窗格中的应用程序,单击“打开模块设置”

  2. Go to Signing Tab.转到签名选项卡。 Add a signing config and fill in information.添加签名配置并填写信息。 Select your keychain as well.也选择您的钥匙串。

在此处输入图片说明

  1. Go to Build Type tab.转到构建类型选项卡。 Select release mode and set:选择释放模式并设置:

-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 构建系统,只需访问:

Gradle Plugin User Guide 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. 将构建变体设置为发布模式。

构建变体

  1. Go to File >> Project Structure转到文件>>项目结构
  2. Select Modules, then Signing Config选择模块,然后签名配置
  3. Click in the Plus icon under Signing Config单击签名配置下的加号图标

签名配置

  1. Select release section and Provide your release App Information then Apply and OK.选择发布部分并提供您的发布应用信息,然后应用和确定。

登入

  1. Go to your app level 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,请按照以下步骤操作:-

  1. Choose "release" version in "Build Variant" ToolBar在“Build Variant”工具栏中选择“release”版本
  2. In the Build.gradle for the module set debuggable true for release build type在模块的Build.gradle中为发布构建类型设置debuggable true
  3. Go to File->Project Structure->under signing tab fill all info->Under Flavours tab->Choose signing Config You just created转到文件->项目结构->在签名选项卡下填写所有信息->在风味选项卡下->选择您刚刚创建的签名配置
  4. Set the breakpoints设置断点
  5. Run the application in the debug mode在调试模式下运行应用程序

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.你可以删除它们然后再试一次。

My problem was solved by changing the build variant as suggested by Stéphane , if anyone was struggling to find the "Build variants" as I did here is a screenshot where you can find it .我的问题是通过按照 Stéphane 的建议更改构建变体来解决的,如果有人像我一样努力寻找“构建变体”,这里有一个截图,您可以在其中找到它。

在此处输入图片说明

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 :另一种选择可以是:

  • to download the signed apk if available.下载已签名的 apk(如果可用)。
  • to download the sources, compile them (with Android-Studio or gradle or ...).下载源代码,编译它们(使用 Android-Studio 或 gradle 或 ...)。 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,其中一个将使用您的调试密钥进行签名(因此您将能够安装它)

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:最终对我有用的,我不知道为什么,是:

  • Went to LastPass (the service I use to keep all my passwords)去了 LastPass(我用来保存所有密码的服务)
  • Select my password by putting the cursor on top of the password and double clicking通过将光标放在密码顶部并双击来选择我的密码
  • Once selected I press cmd C to copy选择后我按 cmd C 复制
  • Went to Android study and cmd V to paste去安卓学习和cmd V粘贴

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.

相关问题 Cordova app-release-unsigned.apk 不工作 - Cordova app-release-unsigned.apk not working Android Studio 3.5.2 - 错误:您当前选择的变体 (app-release-unsigned.apk) 的 apk 未签名 - Android Studio 3.5.2 - Error: The apk for your currently selected variant (app-release-unsigned.apk) is not signed jarsigner:无法打开 jar 文件:app-release-unsigned.apk - jarsigner: unable to open jar file: app-release-unsigned.apk 不能通过g-mail在Android手机上打开文件(来自Android Studio的app-release-unsigned.apk)的原因是什么? - What could be the reason a file (app-release-unsigned.apk from Android Studio) does not open on an android phone from g-mail? 已签名的应用程序崩溃且未签名的APK运行 - Signed app crashing and unsigned apk running 将未签名的APK转换为已签名的APK - Convert unsigned apk into signed apk 未签名的版本APK未安装 - Unsigned Release APK not installing signed vs unsigned apk:classDeffNotFound - signed vs unsigned apk: classDeffNotFound “未安装应用程序”错误,尽管 apk 使用与先前版本 apk 签名相同的上传密钥进行签名 - “App not installed” error although apk is signed with the same upload key that signed previous release apk 生成已签名的 apk 不起作用,apk 未签名 - generate signed apk is not working, apk is unsigned
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM