我在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

其他回答

出于安全原因,您不能在Android上安装unsigned apk。所以如果你只有未签名的apk:你必须签署它。下面是如何做到这一点:链接

注意,您可以使用自签名证书对apk进行签名。

备选方案可以是:

下载已签名的apk(如有)。 下载源代码,编译它们(用Android-Studio或gradle或…)它将生成多个apk,其中一个将与您的调试密钥(因此您将能够安装它)进行签名。

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

用于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")
    }
}

在工具窗口栏中选择构建变量 将生成变体从发布更改为调试

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