简体   繁体   English

无法从 Android Studio 生成签名的 apk

[英]Failed to generating Signed apk from Android Studio

while generating signed apk from android studio getting error.从android studio生成签名的apk时出错。 Few days later all works good, while from last 2 days I am facing problem to generate signed apk.几天后一切正常,而从过去 2 天开始,我面临生成签名 apk 的问题。

Error is -错误是——

FAILURE: Build failed with an exception. FAILURE:构建失败,出现异常。 What went wrong:什么地方出了错:

A problem was found with the configuration of task ':app:packageRelease'.发现任务 ':app:packageRelease' 的配置有问题。 File '/media/user86/data/MySIPonline/app/build/intermediates/res/resources-release-stripped.ap_' specified for property 'resourceFile' does not exist.为属性“resourceFile”指定的文件“/media/user86/data/MySIPonline/app/build/intermediates/res/resources-release-stripped.ap_”不存在。

I'll checked that folder and release-stripped.ap file is present in it.我将检查该文件夹,并且其中存在 release-stripped.ap 文件。 I am not able to figure out the error.我无法弄清楚错误。

Here is build.gradle (app)这是 build.gradle (app)

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
    applicationId "com.xxxxxxxxxx"
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 15
    versionName "1.5.1"
    multiDexEnabled true
}

buildTypes {
    release {
        minifyEnabled false
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
dexOptions {
    javaMaxHeapSize "2048M"
}}


repositories {
maven { url "https://jitpack.io" }
maven { url 'https://maven.fabric.io/public' }}



dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:support-v4:23.1.1'
compile 'com.github.PhilJay:MPAndroidChart:v2.2.3'
compile 'com.mcxiaoke.volley:library:1.0.19'
compile 'com.google.code.gson:gson:2.5'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.squareup.okhttp:okhttp:2.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/paynimo_v2.0_live.jar')
compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.1@aar') {
    transitive = true;
}
compile files('libs/paynimo.scanner.jar')
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
compile 'com.android.support:cardview-v7:23.2.1'
}
apply plugin: 'com.google.gms.google-services

Here is link for pro-guard file - https://gist.github.com/Sanwal13/b667326812b87702c86fa02870b28240这是亲卫文件的链接 - https://gist.github.com/Sanwal13/b667326812b87702c86fa02870b28240

Please help and thanks in advance.请帮助并提前致谢。

You need to set the shrinkResources property to false as it doesn't work with Instant Run feature.您需要将shrinkResources属性设置为 false,因为它不适用于Instant Run功能。 If you are using Android Studio 2.2 simply specify it in your manifest as:如果您使用的是Android Studio 2.2,只需在清单中将其指定为:

buildTypes {
release {
    minifyEnabled false
    shrinkResources false
    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}

if you are using Android Studio 2.0如果您使用的是Android Studio 2.0

  1. Open Settings.打开设置。
  2. Select Build, Execution and Deployment.选择构建、执行和部署。
  3. Uncheck enable Instant Run option.取消选中启用即时运行选项。

清理你的项目并尝试生成签名的 APK 我有同样的问题我清理了项目重建了它对我有用的项目。

Follow below steps to remove you error -按照以下步骤删除您的错误 -

Step 1 : - Clean your project第 1 步: - 清理您的项目

Step 2 : - Rebuild your project第 2 步: - 重建您的项目

Step 3 : - Invalidate and Restart Android Studio第 3 步: - 使 Android Studio 无效并重新启动

Step 4 : - Edit build.gradle with below code第 4 步: - 使用以下代码编辑 build.gradle

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Just remove - this line只需删除- 这一行

shrinkResources false收缩资源错误

Problem solve :)问题解决 :)

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

相关问题 使用 android studio 生成签名的 apk - Generating signed apk with android studio 无法从 Android Studio 生成签名 apk,但我可以在我的手机上运行它 - Failed to generating Signed apk from Android Studio but I am able to run it on my mobile 错误:无法从商店读取密钥:...生成签名 APK 时无法在 Android Studio 上恢复密钥 - ERROR: Failed to read the key from store:... Cannot recover key on Android Studio when generating Signed APK 在没有Android Studio的情况下从Android源代码生成签名的APK - Generating Signed APK from Android Source Code without Android Studio 在Android Studio中生成签名的APK时出现NullPointerException - NullPointerException while generating signed apk in android studio 在Android Studio中生成签名的APK时出错 - Error while generating a signed apk in Android Studio Android Studio 3.2无法生成签名的包/ apk - Android Studio 3.2 not generating signed bundle/apk Android Studio-不断生成Debug签名的APK - Android studio - keeps generating Debug signed APK Android Studio安装失败,APK未签名 - Installation failed with Android Studio, APK not signed Android Studio:安装失败,因为APK未签名 - Android Studio: Installation failed since APK was not signed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM