我在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。 我该怎么办?


当前回答

我也出现了这个问题,下面是我的代码

        storeFile file(properties.getProperty("filepath"))
        storePassword properties.getProperty("keypassword")
        keyAlias properties.getProperty("keyAlias")
        keyPassword properties.getProperty("keypassword")

原因是属性名错误,它应该是keyPassword而不是keyPassword

其他回答

始终使用您的构建对您的构建进行签名。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插件用户指南

在构建中添加以下代码行。grade文件为我工作,将它们添加到下面的buildTypes块发布如下所示

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
    debug {
        applicationIdSuffix ".debug"
        debuggable true
    }

如果你想在调试模式下运行app

1)查看左侧底部,在收藏夹上面有构建变量

2)点击Build variables。单击发布并选择调试

它工作完美!!

最后对我有用的,我也不知道为什么,是:

去了LastPass(我用来保存所有密码的服务) 把光标放在密码上方,双击,选择我的密码 一旦选择,我按cmd C复制 切换到Android study,点击cmd V进行粘贴

请注意,我多次尝试通过在密码末尾单击并移动鼠标选择密码来复制密码。

这很奇怪,但它只能通过双击密码顶部来复制它。

我也使用了打开模块设置>签名…方法由@NightFury在这篇文章中解释。

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
        }
    }