2015-04-02 91 views
0

我想在我的項目的android studio中生成已簽名的apk但是它給了我錯誤。我是android新手,請幫助我。試圖在android工作室生成已簽名的apk給出錯

搖籃控制檯,堆棧跟蹤是這樣的:

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 

而且控制檯消息搖籃:

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 

我的搖籃文件是這樣的:

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' 
} 
+1

請問您可以添加gradle文件嗎?只要確保你刪除了任何密碼:) – Flaxie 2015-04-02 08:04:30

+0

請再次檢查問題。 – killer 2015-04-02 08:07:33

+0

可能是因爲構建工具版本是:'buildToolsVersion「21.1.2」',但您使用的appcompat庫是'com.android.support:appcompat-v7:22.0.0'。考慮使用相同的版本。 – frek13 2015-04-02 08:10:46

回答

1

這是我的」 m做到這一點:

的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=manamana.keystore_filname 
keyStorePassword=manamana_password 
keyAlias=manamana_alias 
keyAliasPassword=manamana_alias_password 

,我已在項目的根和 「keystore.properties」 密鑰庫添加到的.gitignore和

從未檢查
相關問題