[英]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
清理你的项目并尝试生成签名的 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.