While generating signed apk from Android Studio getting an error. A few days later all works good, while from last 2 days I am facing problem to generate signed apk.
Error is:
FAILURE: Build failed with an exception. What went wrong: A problem
was found with the configuration of task ':app:packageRelease'. File
'/media/user86/data/MySIPonline/app/build/intermediates/res/resources-release-stripped.ap_'
specified for property 'resourceFile' does not exist.
I've checked that folder and release-stripped.ap file is present in it. I am not able to figure out the error.
Here is build.gradle (app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.xxxxxxxx"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
}
}
lintOptions {
abortOnError false
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'de.petendi:ethereum-android-lib:0.2.1'
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
compile 'com.android.support:design:26.0.0-alpha1'
testCompile 'org.ethereum:ethereumj-core:1.2.0-RELEASE'
testCompile 'commons-io:commons-io:2.4'
testCompile 'junit:junit:4.12'
}
configurations.all {
resolutionStrategy {
force 'com.fasterxml.jackson.core:jackson-databind:2.7.1-1'
force 'com.fasterxml.jackson.core:jackson-annotations:2.7.0'
force 'com.fasterxml.jackson.core:jackson-core:2.7.1'
}
}
Here is link for pro-guard file - https://gist.github.com/Sanwal13/b667326812b87702c86fa02870b28240
Please help and thank you very much for your time and assistance in this matter.
Related
I am trying to build my app but i received this error. I have rebuilt, cleaned progect and reset Android Studio. This is the screenshot of the problem:
Code error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: Unable to pre-dex 'C:\Users\User-1.gradle\caches\modules-2\files-2.1\stax\stax-api\1.0.1\49c100caf72d658aca8e58bd74a4ba90fa2b0d70\stax-api-1.0.1.jar' to 'C:\Users\User-1\Documents\workspace\WebUpHosting\app\build\intermediates\transforms\dex\debug\folders\1000\10\stax-api-1.0.1_4deeb811af0ea67608aa694ead937d7c9ac36202'
The problem is when i am building, because my app compiles right. Anyone knows how i could solve that?
UPDATE:
buil.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.webuphosting.app"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dexOptions {
preDexLibraries = false
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.daimajia.easing:library:2.0#aar'
compile 'com.daimajia.androidanimations:library:2.3#aar'
compile 'com.android.support:support-v4:26.+'
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
compile 'com.android.support:recyclerview-v7:26.0.+'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile "com.squareup.retrofit2:converter-simplexml:2.3.0"
testCompile 'junit:junit:4.12'
}
Hard to tell the exact problem with more code to see, but as a solution, you could just simply disable pre-dex:
boolean preDexLibraries
Whether to pre-dex libraries. This can improve incremental builds, but clean builds may be slower.
To do so, add the following block in your main module (app)'s build.gradle file, inside the android:
android {
// everything else
dexOptions {
preDexLibraries = false
}
}
By default, it is set to true, so by setting it to false, you could get around your issue, but it may not solve the root-cause.
I am creating an android app currently using firebase and facebook. I am trying to add a facebook login button, but when I add the line compile 'com.facebook.android:facebook-android-sdk:[4,5)' I get the error
Error:Execution failed for task ':app:processDebugManifest'.
Manifest merger failed : Attribute meta-data#android.support.VERSION#value value=(26.0.0-alpha1) from [com.android.support:design:26.0.0-alpha1] AndroidManifest.xml:27:9-38
is also present at [com.android.support:cardview-v7:25.3.1] AndroidManifest.xml:24:9-31 value=(25.3.1).
Suggestion: add 'tools:replace="android:value"' to element at AndroidManifest.xml:25:5-27:41 to override.
when I try to sync the gradle build. Here is what my app build.gradle file looks like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26"
defaultConfig {
applicationId "com.notnow.barapp"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:support-v4:26.+'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
It's because Facebook library use com.android.support:cardview-v7:25.3.1 and you cannot use different support library with different version number. I resolved downgrading compileSdkVersion to 25 and all the support library to 25.3.1. You can check that Facebook library is using com.android.support:cardview-v7:25.3.1 at the following link: Facebook Core Gradle
Hope it helps.
i have this error :
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: android/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl.class
on this build.gradle app :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.mtma.mytripmyadventure"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile('com.android.support:support-v4:23.4.0') {
force = true;
}
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:multidex:1.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.roughike:bottom-bar:1.2.1'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:support-v4:23.4.0'
}
i have try many things to do but the result still the same
i have add all*.exclude group: 'com.android.support', module: 'support-v4'
but still error
help me to resolve this.. icant resolve it in 1 day
thx stackoverflow
I had a similar issue, I was importing
compile fr.avianey.com.viewpagerindicator:library:2.4.1.1'
and had to add "#aar" termination
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
That error in your latest comment is completely different as it relates to an XML issue in your Activity.
You do not need the support-v4 dependency explicitly. It is included with the v7 dependency. That being said, definitely do not need to force = true on it
The solution to the first error is remove both dependencies of compile 'com.android.support:support-v4
This has worked for me.
compile('com.jakewharton:butterknife:8.5.1') {
exclude module: 'support-compat'
}
We want to set up instrumentation tests for our app, that also has 2 flavors. We have successfully set up Android Studio to run instrumented tests directly from the IDE, but trying to run instrumented tests from the command line via 'gradle connectedCheck' always results in the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:mergeDevelopmentDebugAndroidTestJavaResources'.
> Cannot determine expansion folder for /Users/james/Development/AndroidProjects/parkinsons11/app/build/intermediates/packagedJarsJavaResources/androidTest/development/debug/junit-4.12.jar936209038/LICENSE-junit.txt with folders
Our test app, which also has two flavours and is set up for instrumented tests, runs both from the IDE and from command line without incident.
Here is our gradle file from our main project:
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.app.ourapp"
minSdkVersion 16
versionCode 11
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
assets.srcDirs = ['src/main/assets',
'src/main/assets/font']
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
productFlavors {
live {
versionName "1.1 live"
applicationId "com.app.ourapp.live"
}
development {
versionName '1.1 development'
applicationId "com.app.ourapp.development"
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':library:datetimepicker')
compile project(':library:tools')
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:+'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'org.quanqi:mpandroidchart:1.7.+'
compile 'commons-io:commons-io:2.+'
compile 'joda-time:joda-time:2.+'
compile 'com.microsoft.azure.android:azure-storage-android:0.4.+'
testCompile 'junit:junit:4.12'
testCompile "org.robolectric:robolectric:${robolectricVersion}"
testCompile "org.mockito:mockito-core:1.+"
androidTestCompile 'junit:junit:4.12'
androidTestCompile "org.mockito:mockito-core:1.+"
}
And here is our gradle.build from our test app (which works):
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.test.picroft.instrumentationtestapp"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
newFlavour {
applicationId "com.test.picroft.instrumentationtestapp.newflavor"
}
oldFlavour {
applicationId "com.test.picroft.instrumentationtestapp.oldflavor"
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
testCompile 'junit:junit:4.12'
testCompile "org.mockito:mockito-core:1.+"
androidTestCompile 'junit:junit:4.12'
androidTestCompile "org.mockito:mockito-core:1.+"
}
I'm at a loss as to where I'm going wrong. I've compared the directory structure from both apps and there's no meaningful difference. Here's a rough outline of our main project's structure:
src
-androidTest
--java
---*
-live
--res
---layout
---values
-main
--java
---*
-test
--java
---*
I'm totally confused why instrumented tests on one app works fine both in IDE and in command line, while the other refuses to work via command line.
It seems the issue resolved itself. I believe it was some kind of corruption of the build state that was fixed through an invalidate/restart.
Its also worth pointing out that when you switch build flavours in the Build Variation panel, its worth it to wait until Android Studio finishes synchronizing and is not performing any tasks before doing a build or run. I've found that when I was hitting build or run and Android Studio hadn't finished switching the build flavour, it caused all manner of unpredictable issues.
I think the problem might be that you haven't defined a default instrumentation runner, as mentioned here. You should include this in your build.gradle file
android {
defaultConfig {
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
}
I am still using Android Studio 0.8.9 on my Macbook Air. On my iMac i installed Android Studio 1.0.
As 1.0 only supports 'com.android.tools.build:gradle:1.0.0' i had to change my build.gradles
as mentioned here. Gradle DSL method not found: 'runProguard'
0.8.9 uses 'com.android.tools.build:gradle:0.12.2'
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example...."
minSdkVersion 19
targetSdkVersion 20
versionCode 1
versionName "0.87"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
}
dexOptions {
preDexLibraries = false
} }
repositories {
mavenCentral()
flatDir {
dirs 'libs'
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services-wearable:+'
compile 'com.spotify.sdk:spotifysdk:1.0.0-beta6#aar'
compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20')
}
With the 0.8.9 beta on my MacBook Air my App builds fine. On my iMac i get this error.
org.apache.commons.collections.ArrayStack has already been added to output. Please remove duplicate copies.
UPDATE
The problems seems to be that commons-collections is added to the external libraries and commons-beanutils which also includes a commons-collections.
compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20') {
exclude group: "commons-beanutils", module: "commons-beanutils"
}
if i exclude the commons-beanutils the build process is fine, but the app crashes, as it needs the commons-beanutils. same if i exclude the commons-collections.
furthermore i tried to manually remove the folder common-collections from the commons-beanutils jar, but this also does not work..
finally it works.
this one does not include commons-collections, so everything works fine.
compile 'commons-beanutils:commons-beanutils:20030211.134440'
don't understand why this was not necessary in beta 0.8.9
compile('se.michaelthelin.spotify:spotify-web-api-java:1.4.20') {
exclude group: "commons-beanutils", module: "commons-beanutils"
}
compile 'commons-beanutils:commons-beanutils:20030211.134440'
Try:
project > clean
project > rebuild
and run again