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


当前回答

我的问题是通过改变Stéphane所建议的构建变量来解决的,如果有人像我一样很难找到“构建变量”,这里是一个截图,你可以在那里找到它。

其他回答

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 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插件用户指南

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

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

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

它工作完美!!

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

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

如果有人想使用Android Studio调试发布版本,请遵循以下步骤:

将构建变体设置为发布模式。

右键单击左侧导航窗格中的应用程序,单击打开模块设置。 进入签名标签。添加签名配置并填写信息。选择你的钥匙链。

转到构建类型选项卡。选择释放模式并设置:

-可调试为true。

-将Config签名到Config。(你刚创建的那个)。

同步你的gradle。享受吧!