为属性'signingConfig.storeFile'指定的Android不存在

Pac*_*chu 26 android android-studio

我试图生成签名APK使用AndroidStudio但我收到此错误:

    Error:A problem was found with the configuration of task ':app:packageRelease'.
> File 'com.pachu.fartsound' specified for property 'signingConfig.storeFile' does not exist.
Run Code Online (Sandbox Code Playgroud)

我不知道你是否需要它,但有我的build.gradle:

    apply plugin: 'com.android.application'
apply plugin: 'android'
android {
    compileSdkVersion 19
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.pachu.fartsounds"
        minSdkVersion 9
        targetSdkVersion 19
        versionCode 1
        versionName "1.2"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:19.+'
    compile 'com.google.android.gms:play-services:5.0.89'
}
Run Code Online (Sandbox Code Playgroud)

Nik*_*tov 23

转到Build - > Generate Signed APK.创建你的密钥(或选择现有的) - > next - > next - > done!

如果你想"艰难地"做到这一点,你需要在buildTypes之前将已创建的发布密钥指定到signingConfigs中.像这样的东西:

signingConfigs {
        release {
            storeFile file("/yourkey.jks") //check that the file exists
            storePassword "YourPassword"
            keyAlias "YourAlias"
            keyPassword "YourPassword"
        }
    }
Run Code Online (Sandbox Code Playgroud)

但这在某种程度上毫无用处.因为Android Studio提供了非常简单易用的方法来创建已准备好发布的签名APK文件.并且还将密钥的密码指定到build.gradle文件中...... - 不建议在安全性方面这样做.

  • “但是这有点没用”。我非常不同意。如果您必须使用不同的应用程序配置来构建多个调试/发行版,那么这将非常有用。 (2认同)

Voy*_*Voy 7

我的钥匙在

APPROOT/myKey.jks
Run Code Online (Sandbox Code Playgroud)

虽然学生正在寻找

APPROOT/app/myKey.jks
Run Code Online (Sandbox Code Playgroud)

我想你在生成签名的apk时在第二个对话框上指定了第二条路径,但我还没有检查出来,有人可以确认吗?