生成失败,发生异常。同时生成签名的apk

时间:2018-11-25 14:51:32

标签: android

我正在尝试构建应用程序。我可以正确构建应用程序。另外,我能够以调试模式生成应用程序。但是,当我尝试使用发布模式生成签名的apk时,出现了以下错误。

请帮助我哪里出了问题。

错误如下

:app:validateSigningRelease UP-TO-DATE
:app:packageRelease FAILED


 FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:packageRelease'.
> C:\Users\Baba\Project\Application\Artharakshak\Code\Artharakshak\app\release\app-release.apk

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

* Get more help at https://help.gradle.org

BUILD FAILED in 20s
30 actionable tasks: 29 executed, 1 up-to-date

下面是我的progourd文件

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in C:\Users\Baba\AppData\Local\Android\Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings

内部版本为

dependencies {
    classpath 'com.android.tools.build:gradle:3.2.1'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}

2 个答案:

答案 0 :(得分:0)

我有解决办法。

问题原因:

升级我的Android Studio后,Windows中存在一些访问问题,结果,在较旧版本上开发的现有项目无法在同一位置写入apk。 即使清理项目也无济于事。

解决方案:

我在其他位置创建了一个新项目。这有助于构建和生成apk文件

答案 1 :(得分:0)

也许您输入了错误的密码

您需要在gradle.properties

中添加此代码
MYAPP_RELEASE_STORE_FILE=my-release-key.keystore
MYAPP_RELEASE_KEY_ALIAS=my-key-alias
MYAPP_RELEASE_STORE_PASSWORD=your_password
MYAPP_RELEASE_KEY_PASSWORD=your_password