简体   繁体   English

尝试在Android Studio中生成签名的APK会出现错误

[英]Trying to generated signed apk in android studio gives error

I want to generate signed apk in android studio of my project but It is giveing me error.I am new to android, please help me in this. 我想在我的项目的android studio中生成签名的apk,但这给了我error.I是android的新手,请为此提供帮助。

Gradle console gives stack trace like this: Gradle控制台提供了如下堆栈跟踪:

Executing tasks: [:app:assembleRelease]

Configuration on demand is an incubating feature.
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:compileReleaseJava UP-TO-DATE
:app:lintVitalRelease
:app:compileReleaseNdk UP-TO-DATE
:app:preDexRelease UP-TO-DATE
:app:dexRelease UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:validateExternalOverrideSigning
:app:packageRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:
A problem was found with the configuration of task ':app:packageRelease'.
> File '2222' specified for property 'signingConfig.storeFile' does not exist.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 3.685 secs

Also console messages gradle: 控制台消息也逐渐增加:

Information:Gradle tasks [:app:assembleRelease]
:app:preBuild UP-TO-DATE
:app:preReleaseBuild UP-TO-DATE
:app:checkReleaseManifest
:app:preDebugBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72200Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42200Library UP-TO-DATE
:app:prepareReleaseDependencies
:app:compileReleaseAidl UP-TO-DATE
:app:compileReleaseRenderscript UP-TO-DATE
:app:generateReleaseBuildConfig UP-TO-DATE
:app:generateReleaseAssets UP-TO-DATE
:app:mergeReleaseAssets UP-TO-DATE
:app:generateReleaseResValues UP-TO-DATE
:app:generateReleaseResources UP-TO-DATE
:app:mergeReleaseResources UP-TO-DATE
:app:processReleaseManifest UP-TO-DATE
:app:processReleaseResources UP-TO-DATE
:app:generateReleaseSources UP-TO-DATE
:app:compileReleaseJava UP-TO-DATE
:app:lintVitalRelease
:app:compileReleaseNdk UP-TO-DATE
:app:preDexRelease UP-TO-DATE
:app:dexRelease UP-TO-DATE
:app:processReleaseJavaRes UP-TO-DATE
:app:validateExternalOverrideSigning
:app:packageRelease FAILED
Error:A problem was found with the configuration of task ':app:packageRelease'.
> File '2222' specified for property 'signingConfig.storeFile' does not exist.
Information:BUILD FAILED
Information:Total time: 3.685 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

My Gradle File is like this: 我的Gradle文件是这样的:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.example.mubashirgul.androidtest"
        minSdkVersion 15
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }

            debug {

            }

    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
}

This is how i'm doing it: 这就是我的做法:

build.gradle: 的build.gradle:

apply plugin: 'com.android.application'

android {
.
.
.

signingConfigs {
    release
}

buildTypes {
    release {
        minifyEnabled true
        proguardFiles 'proguard.pro'
        debuggable false
        signingConfig signingConfigs.release
    }
.
.
.
}

dependencies {
    ...
}

def props = new Properties()

props.load(new FileInputStream(rootProject.file("keystore.properties")))
android.signingConfigs.release.storeFile rootProject.file(props.keyStore)
android.signingConfigs.release.storePassword props.keyStorePassword
android.signingConfigs.release.keyAlias props.keyAlias
android.signingConfigs.release.keyPassword props.keyAliasPassword

keystore.properties: keystore.properties:

keyStore=manamana.keystore_filname
keyStorePassword=manamana_password
keyAlias=manamana_alias
keyAliasPassword=manamana_alias_password

Then i have the keystore in root of project and the "keystore.properties" is added to .gitignore and never checked in 然后我在项目的根目录中有密钥库,并且将“ keystore.properties”添加到.gitignore中,并且从未签入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM