I am using Android Studio 2.0 on Windows 7. When building my Android project, I get the following error:
:app:transformResourcesWithMergeJavaResForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt
File1: C:\Users\USER\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-api-1.0-sdk\1.9.28\e92c18272b555027d9ec666e7a89162f10638314\appengine-api-1.0-sdk-1.9.28.jar
File2: C:\Users\USER\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-endpoints\1.9.28\bf2e8a74bd28e388b3487fc78a0c7adfa592fd5d\appengine-endpoints-1.9.28.jar`
I have been digging around for hours and can't see anything that causes this. I've deleted .gradle in my home directory, but it just rebuilds it all the same. Does anyone know what causes this?
Full gradle output:
Executing tasks: [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
Configuration on demand is an incubating feature.
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for debug as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
WARNING: Dependency org.apache.httpcomponents:httpclient:4.0.1 is ignored for release as it may be conflicting with the internal version provided by Android.
In case of problem, please repackage it with jarjar to change the class packages
Incremental java compilation is an incubating feature.
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:backend:appengineDownloadSdk
:backend:compileJava
:backend:processResources UP-TO-DATE
:backend:classes
:backend:appengineEndpointsGetClientLibs UP-TO-DATE
:backend:appengineEndpointsExpandClientLibs UP-TO-DATE
:backend:compileEndpointsSrcJava
:backend:processEndpointsSrcResources UP-TO-DATE
:backend:endpointsSrcClasses
:backend:_appengineEndpointsAndroidArtifact UP-TO-DATE
:backend:jar UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2330Library
:app:prepareComAndroidSupportAppcompatV72330Library
:app:prepareComAndroidSupportSupportV42330Library
:app:prepareComAndroidSupportSupportVectorDrawable2330Library
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:compileDebugJavaWithJavac
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug UP-TO-DATE
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt
File1: C:\Users\USER\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-api-1.0-sdk\1.9.28\e92c18272b555027d9ec666e7a89162f10638314\appengine-api-1.0-sdk-1.9.28.jar
File2: C:\Users\USER\.gradle\caches\modules-2\files-2.1\com.google.appengine\appengine-endpoints\1.9.28\bf2e8a74bd28e388b3487fc78a0c7adfa592fd5d\appengine-endpoints-1.9.28.jar
* 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: 15.364 secs
From what I can tell, it's a conflict between two dependencies:
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.28'
compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28'
compile 'javax.servlet:servlet-api:2.5'
compile 'com.google.http-client:google-http-client-jackson2:1.20.0'
compile 'com.google.http-client:google-http-client-gson:1.19.0'
}
I think it's these two dependencies:
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.28'
compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28'
I'm not able to remove any of these, as it causes compile errors on the backend module. It looks like those two dependencies are almost identical, however. Should they both be in there? Any advice is appreciated!
To complete #dsh's answer:
In your dependency tree there are 2 jar files containing the same file named sep_approx_spanish.txt , this is not allowed.
To resolve your problem you have to track down which of your gradle dependencies has the two jars named appengine-api-1.0-sdk-1.9.28.jar and appengine-endpoints-1.9.28.jar; to do this you can open android studio's terminal console and type in:
//if ou are on windows
gradlew dependencies
//if you are on unix based os
./gradlew dependencies
You will see gradle doing a lot of things, but at a certain point it will print the entire dependency tree. Once you find which are the 2 dependencies are causing the problem, add this piece of code at the end of one of the dependency declarations
{
exclude "sep_approx_spanish.txt"
}
So for example if the two dependencies are these
compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28
if must become
compile 'com.google.appengine:appengine-endpoints:1.9.28'{
exclude "sep_approx_spanish.txt"
}
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28
or
compile 'com.google.appengine:appengine-endpoints:1.9.28'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.28'{
exclude "sep_approx_spanish.txt"
}
in this way you tell to gradle to not take into consideration that file for one of the two libraries, avoiding the file's duplication inside the apk.
The error tells you that building your APK would result in two files named com/google/appengine/repackaged/org/apache/commons/codec/language/bm/sep_approx_spanish.txt. This is a failure because the APK can only contain one file at any given path. This is probably caused by two different jar files in your classpath that contain the file. In my project, this only occurred with files that were not actually used at runtime so I excluded them from the APK entirely.
Completing #Apperside answer.
I fixed the error by adding the following lines to my build.gradle file of my app module:
android{
packagingOptions {
exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/bm/*'
exclude 'com/google/appengine/repackaged/org/codehaus/jackson/impl/VERSION.txt'
exclude 'com/google/appengine/repackaged/org/apache/commons/codec/language/*'
}
(...)
}
Related
When I tried to add poi-ooxml in app/build.gradle file then this error is coming
"Execution failed' :app:transformClassesWithDexForDebug'.com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'java'' finished with non-zero exit value 1"
app/build.gradle :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "applicationID"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
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:design:23.4.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile files('libs/jxl.jar')
compile group: 'org.apache.poi', name: 'poi', version: '3.9'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'
}
Logcat
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2340Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72340Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2340Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72300Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42340Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2340Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet840Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable840Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:transformClassesWithDexForDebug
trouble processing "javax/xml/XMLConstants.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
1 error; aborting
**Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-8-oracle/bin/java'' finished with non-zero exit value 1**
Information:BUILD FAILED
Information:Total time: 59.141 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Apache POI will not work out of the box on Android due to various problems that you will run into when using bare Apache POI.
There are some projects that make it possible to use parts of Apache POI on Android:
https://github.com/andruhon/android5xlsx (for Android 5) and https://github.com/andruhon/AndroidReadXLSX (for Android 4), both are currently still based on Apache POI 3.12
https://github.com/centic9/poi-on-android/ (for Android 5, maintained by me), which can be more easily recompiled with newer versions of POI, e.g. it uses 3.15 currently
I faced this problem before, try to add a deafultConfig
defaultConfig {
// Enabling multidex support.
multiDexEnabled true
}
I wasn't sure what to name the question so bear with me.
I work on two machines, my PC and my Mac. Currently I have upgraded to Android Studio 2.0 on my PC to get all the new features and it is a mess. I need help.
So what is happening is that when I try to run the app the gradle build fails. It fails with this message :
Executing tasks: [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
Configuration on demand is an incubating feature.
Incremental java compilation is an incubating feature.
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2320Library
:app:prepareComAndroidSupportAppcompatV72320Library
:app:prepareComAndroidSupportDesign2320Library
:app:prepareComAndroidSupportRecyclerviewV72320Library
:app:prepareComAndroidSupportSupportV42320Library
:app:prepareComAndroidSupportSupportVectorDrawable2320Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources
:app:mergeDebugResources
:app:processDebugManifest
:app:processDebugResources
:app:generateDebugSources
:app:mockableAndroidJar UP-TO-DATE
:app:preDebugUnitTestBuild UP-TO-DATE
:app:prepareDebugUnitTestDependencies
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl
:app:processDebugAndroidTestManifest
:app:compileDebugAndroidTestRenderscript
:app:generateDebugAndroidTestBuildConfig
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:compileDebugJavaWithJavac
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:buildInfoDebugLoader
:app:transformClassesWithExtractJarsForDebug
:app:transformClassesWithInstantRunVerifierForDebug
:app:transformClassesWithJavaResourcesVerifierForDebug
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:transformResourcesWithMergeJavaResForDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK META-INF/BCKEY.SF
File1: C:\Users\Andy\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcpkix-jdk15on\1.51\6c8c1f61bf27a09f9b1a8abc201523669bba9597\bcpkix-jdk15on-1.51.jar
File2: C:\Users\Andy\.gradle\caches\modules-2\files-2.1\org.bouncycastle\bcprov-jdk15on\1.51\9ab8afcc2842d5ef06eb775a0a2b12783b99aa80\bcprov-jdk15on-1.51.jar
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: 15.114 secs
Here is a list of my dependencies
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.code.gson:gson:2.5'
compile 'com.hierynomus:sshj:0.15.0'
compile 'joda-time:joda-time:2.9.1'
compile 'de.greenrobot:eventbus:2.4.0'
compile 'com.android.support:support-v4:23.2.0'
compile 'com.android.support:design:23.2.0'
}
Now the odd thing is that if I run the exact same source code on my mac its fine. So what is going on? Is this a bug with v2.0, it seems unlikely though.
If you need any more info let me know!
Thanks
Andy
Hey so with some help I figued out that com.hierynomous:sshj was also wanting Bouncy Castle and therefor conflicting with the caked in Android one.
Hope this helps someone in the future.
I am using Comriva library to extract MFCC features to my speech recognition project. And i have imported the comriva core packages to my project. When i tired to build it im getting this error in gradle,
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:generateDebugResources UP-TO-DATE
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJava UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex UP-TO-DATE
:app:shrinkDebugMultiDexComponents UP-TO-DATE
:app:createDebugMainDexClassList UP-TO-DATE
:app:dexDebug
trouble processing "javax/xml/stream/events/StartElement.class":
Ill-advised or mistaken usage of a core class (java.* or javax.*)
when not building a core library.
This is often due to inadvertently including a core library file
in your application's project, when using an IDE (such as
Eclipse). If you are sure you're not intentionally defining a
core class, then this is the most likely explanation of what's
going on.
However, you might actually be trying to define a class in a core
namespace, the source of which you may have taken, for example,
from a non-Android virtual machine project. This will most
assuredly not work. At a minimum, it jeopardizes the
compatibility of your app with future versions of the platform.
It is also often of questionable legality.
If you really intend to build a core library -- which is only
appropriate as part of creating a full virtual machine
distribution, as opposed to compiling an application -- then use
the "--core-library" option to suppress this error message.
If you go ahead and use "--core-library" but are in fact
building an application, then be forewarned that your application
will still fail to build or run, at some point. Please be
prepared for angry customers who find, for example, that your
application ceases to function once they upgrade their operating
system. You will be to blame for this problem.
If you are legitimately using some code that happens to be in a
core package, then the easiest safe alternative you have is to
repackage that code. That is, move the classes in question into
your own package namespace. This means that they will never be in
conflict with core system classes. JarJar is a tool that may help
you in this endeavor. If you find that you cannot do this, then
that is an indication that the path you are on will ultimately
lead to pain, suffering, grief, and lamentation.
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 5.524 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
I didn't include any xml libraries so far like simple-xml.
This is my gradle.build file,
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "info.androidhive.sleepApp"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
// Enabling multidex support.
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:recyclerview-v7:22.2.0'
compile files('libs/jl1.0.jar')
compile files('libs/commons-logging-api.jar')
compile files('libs/cp.jar')
compile files('libs/http-2.2.1.jar')
compile files('libs/jama-1.0.2.jar')
compile files('libs/jl1.0.jar')
compile files('libs/jogg-0.0.7.jar')
compile files('libs/lucene-analyzers-3.0.0.jar')
compile files('libs/lucene-core-3.0.0.jar')
compile files('libs/lucene-queries-3.0.0.jar')
compile files('libs/lucene-queryparser-3.0.0.jar')
compile files('libs/lucene-snowball-3.0.3.jar')
compile files('libs/jorbis-0.0.15.jar')
compile files('libs/mdsj.jar')
compile files('libs/tritonus_remaining.jar')
compile files('libs/tritonus_share.jar')
compile files('libs/wstx-lgpl-3.0.1.jar')
compile files('libs/weka-stable-3.6.13.jar')
compile files('libs/stax-api-1.0.jar')
compile files('libs/mp3spi1.9.4.jar')
}
Please help me to overcome this problem.
Libraries you haven't explicitly included, can sometimes be brought into your build transitively - as in, a library you did add, depends on another library.
You can run gradle dependencies to show a tree of dependencies to analyze which dependency pulls in which transitive dependencies.
I figured out the issue it was the stax-api-1.0.jar this included the javax.xml.stream.events.* classes after removing the jar i was able to build it successfully. This jar came with the comriva that is why i didn't notice it.
I'm trying to implement Google sign in for Android and I'm following the instructoins via
https://developers.google.com/identity/sign-in/android/start-integrating
But while building the application I'm receiving the following error.
Information:Gradle tasks [:app:generateDebugSources,
:app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:preBuild UP-TO-DATE :app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest :app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2301Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics810Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library
UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesBase810Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement810Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity810Library
UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement810Library
UP-TO-DATE :app:prepareComGoogleAndroidGmsPlayServicesPlus810Library
UP-TO-DATE :app:prepareDebugDependencies :app:compileDebugAidl
UP-TO-DATE :app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE :app:generateDebugAssets
UP-TO-DATE :app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE :app:processDebugGoogleServices
No matching client found for package name 'com.questo.rugved.questo'
:app:generateDebugResources :app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE :app:processDebugResources
UP-TO-DATE :app:generateDebugSources UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareDebugAndroidTestDependencies
:app:compileDebugAndroidTestAidl UP-TO-DATE
:app:processDebugAndroidTestManifest UP-TO-DATE
:app:compileDebugAndroidTestRenderscript UP-TO-DATE
:app:generateDebugAndroidTestBuildConfig UP-TO-DATE
:app:generateDebugAndroidTestAssets UP-TO-DATE
:app:mergeDebugAndroidTestAssets UP-TO-DATE
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources UP-TO-DATE
:app:mergeDebugAndroidTestResources UP-TO-DATE
:app:processDebugAndroidTestResources UP-TO-DATE
:app:generateDebugAndroidTestSources UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE :app:compileDebugNdk
UP-TO-DATE :app:compileDebugSources UP-TO-DATE
:app:transformClassesAndResourcesWithExtractJarsForDebug
:app:transformClassesWithDexForDebug UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task
':app:transformClassesWithDexForDebug'.
com.android.build.transform.api.TransformException:
com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit
value 2 Information:BUILD FAILED Information:Total time: 1 mins 39.994
secs Information:1 error Information:0 warnings Information:See
complete output in console
My top level gradle is
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
My app level gradle is
<pre>
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
defaultConfig {
applicationId "com.questo.rugved.questo"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:design:23.+'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
}
please help.
Maybe this link helps you. link
That helped me:
android {
...
defaultConfig {
...
multiDexEnabled true
}
}
This problem occurs because of multiple inclusion of dependencies. You are including a dependency that is already specified in your build.gradle file. For example:
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.google.android.gms:play-services-identity:9.0.2'
the above specification of dependency will generate this problem, because play-services includes everything, including play-services-identity, & so, here the same dependency is included for multiple times.
The recommended option is to only include those dependencies that you actually need. If you need play services location & maps, only include these dependencies as:
compile 'com.google.android.gms:play-services-location:9.0.2'
compile 'com.google.android.gms:play-services-maps:9.0.2'
Without including everything with 'com.google.android.gms:play-services:9.0.2'.
In your specific case, I suspect the conflict is arising between google-services of the top level gradle file and play-services-identity & play-services-plus in the app level gradle file. Using only those services that you specifically need resolving multiple inclusion will resolve your issue.
In general, you should not use "multiDexEnabled true" if you don't have a strong & legitimate reason. Using it without knowing the actual problem means that you are bypassing a problem. You are allowing multiple overlapping dependencies yielding a potential source of api conflicts & bigger apk size.
Adding
dexOptions {
incremental = true;
preDexLibraries = false
javaMaxHeapSize "4g" // 2g should be also OK
}
in with in android in build.gradle works for me.
Had the same problem.
Mine was fixed by setting the JAVA_HOME variable to java 8 jdk
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
I'd been trying out Android annotations recently and everything had been working well until I decided to add applicationIdSuffix in buildTypes in my build.gradle file. Currently it looks like this:
buildTypes {
debug {
applicationIdSuffix '.debug'
}
...
}
And upon compiling I get the following log in gradle console:
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:pre_testBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72220Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:app:prepareDebugDependencies
:app:compileDebugAidl UP-TO-DATE
:app:compileDebugRenderscript UP-TO-DATE
:app:generateDebugBuildConfig UP-TO-DATE
:app:generateDebugAssets UP-TO-DATE
:app:mergeDebugAssets UP-TO-DATE
:app:generateDebugResValues UP-TO-DATE
:app:processDebugGoogleServices
No matching client found for package name 'org.me.myapp.debug'
:app:generateDebugResources
:app:mergeDebugResources UP-TO-DATE
:app:processDebugManifest UP-TO-DATE
:app:processDebugResources UP-TO-DATE
:app:generateDebugSources UP-TO-DATE
:app:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac
Note: Resolve log file to /dir/myapp/app/build/generated/source/apt/androidannotations.log
Note: Initialize AndroidAnnotations 3.3.1 with options {androidManifestFile=/dir/myapp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml}
Note: Start processing for 4 annotations on 18 elements
Note: AndroidManifest.xml file found with specified path: /dir/myapp/app/build/intermediates/manifests/full/debug/AndroidManifest.xml
Note: AndroidManifest.xml found: AndroidManifest [applicationPackage=org.me.myapp.debug, componentQualifiedNames=[org.me.myapp.ui.MainActivity_, net.hockeyapp.android.UpdateActivity], permissionQualifiedNames=[android.permission.ACCESS_WIFI_STATE, android.permission.ACCESS_NETWORK_STATE], applicationClassName=null, libraryProject=false, debugabble=false, minSdkVersion=15, maxSdkVersion=-1, targetSdkVersion=22]
error: The generated org.me.myapp.debug.R class cannot be found
Note: Found Android class: android.R
Note: Time measurements: [Whole Processing = 15 ms], [Extract Manifest = 4 ms], [Extract Annotations = 3 ms],
Note: Finish processing
Note: Start processing for 0 annotations on 0 elements
Note: Time measurements: [Whole Processing = 0 ms],
Note: Finish processing
1 error
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
I've tried cleaning and rebuilding again, removing generated directory from the project, but nothing helps. If I remove applicationIdsuffix from build.gradle file, everything works fine. How can I fix this problem?
For me this was happening because google-services.json was referring to my production package name. The best solution at the time of this writing seems to be to either write your own gradle tasks to switch between release and debug versions of the file, or to include both package names in the file:
google-services.json for different productFlavors
Remove this line from your build.gradle file:
resourcePackageName android.variant.applicationId
Edit: try to add this line to your apt block:
resourcePackageName "org.me.myapp"