Can't add XStream file dependency to Android Studio project - android

I have downloaded and added xstream-1.4.8.jar to my Android Studio project. When I build the project it works fine but when I try to run it I get the following error from the Gradle Build window:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library 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:compileDebugJava UP-TO-DATE
:app:preDexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing com/thoughtworks/xstream/mapper/LambdaMapper.class
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_25\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 14.974 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
I have looked at the related answers on here and none of the suggested solutions work for me.
Thanks in advance.

XStream 1.4.8 is compiled for Java 8 and the latest version Android supports is Java 7.
One solution is to use XStream 1.4.7, that works with Android, and another to download XStream 1.4.8 sources and compile them yourself. In that case you will have to remove LambdaMapper.java and possibly some other problematic classes.
Also you can have issues with different versions of xmlpull parser used. In that case you can exclude one from compiling.
compile('com.thoughtworks.xstream:xstream:1.4.7') {
exclude group: 'xmlpull', module: 'xmlpull'
}

Related

Adding Lucene to Android Studio project

I have problems with adding Lucene 6.2.0 to my Android Studio 2.1.2 project. However, adding this library to IntelliJ IDEA is not a problem. I tried copying Lucene files to my libs folder and then adding jar files listed here as libraries (Right click => Add as library). Build.gradle was looking fine:
compile files('libs/lucene-6.2.0/queryparser/lucene-queryparser-6.2.0.jar')
compile files('libs/lucene-6.2.0/demo/lucene-demo-6.2.0.jar')
compile files('libs/lucene-6.2.0/core/lucene-core-6.2.0.jar')
compile files('libs/lucene-6.2.0/analysis/common/lucene-analyzers-common-6.2.0.jar')
Information:Gradle tasks [:app:clean, :app:generateDebugSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies, :app:generateDebugAndroidTestSources, :app:assembleDebug]
:app:clean
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2400Library
:app:prepareComAndroidSupportAppcompatV72400Library
:app:prepareComAndroidSupportCardviewV72340Library
:app:prepareComAndroidSupportCustomtabs2340Library
:app:prepareComAndroidSupportDesign2400Library
:app:prepareComAndroidSupportRecyclerviewV72400Library
:app:prepareComAndroidSupportSupportV42400Library
:app:prepareComAndroidSupportSupportVectorDrawable2400Library
:app:prepareComFacebookAndroidFacebookAndroidSdk4150Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
: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:mergeDebugAndroidTestShaders
:app:compileDebugAndroidTestShaders
:app:generateDebugAndroidTestAssets
:app:mergeDebugAndroidTestAssets
:app:generateDebugAndroidTestResValues UP-TO-DATE
:app:generateDebugAndroidTestResources
:app:mergeDebugAndroidTestResources
:app:processDebugAndroidTestResources
:app:generateDebugAndroidTestSources
:app:incrementalDebugJavaCompilationSafeguard
:app:compileDebugJavaWithJavac
:app:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
Note: C:\Users\Tomek\AndroidStudioProjects\UniversalSoundboard\app\src\main\java\com\tomaszstankowski\universalsoundboard\adapters\SoundListAdapter.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\Tomek\AndroidStudioProjects\UniversalSoundboard\app\src\main\java\com\tomaszstankowski\universalsoundboard\custom\singletons\SoundBank.java uses 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
:app:mergeDebugJniLibFolders
:app:transformNative_libsWithMergeJniLibsForDebug
:app:processDebugJavaRes UP-TO-DATE
:app:transformResourcesWithMergeJavaResForDebug
:app:transformResourcesAndNative_libsWithJavaResourcesVerifierForDebug
:app:transformClassesWithInstantRunForDebug
:app:transformClasses_enhancedWithInstant+reloadDexForDebug
:app:incrementalDebugTasks
:app:prePackageMarkerForDebug
:app:fastDeployDebugExtractor
:app:generateDebugInstantRunAppInfo
:app:coldswapKickerDebug
:app:transformClassesWithInstantRunSlicerForDebug
:app:transformClassesWithDexForDebug
To run dex in process, the Gradle daemon needs a larger heap.
It currently has approximately 910 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to more than 2048 MB.
To do this set org.gradle.jvmargs=-Xmx2048M in the project gradle.properties.
For more information see https://docs.gradle.org/current/userguide/build_environment.html
Error:PARSE ERROR:
Error:unsupported class file version 52.0
Error:...while parsing org/apache/lucene/analysis/ar/ArabicAnalyzer.class
Error:1 error; aborting
:app:transformClassesWithDexForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_73\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 40.184 secs
Information:5 errors
Information:0 warnings
Information:See complete output in console
Tried adding these libraries as Dependencies from Maven Central but the result was the same as above.
Error:unsupported class file version 52.0
Error:...while parsing org/apache/lucene/analysis/ar/ArabicAnalyzer.class
I also tried this way:
compile fileTree(dir: 'libs', include: '*.jar')
My app ran without any errors but Lucene classes were not recognized.
What I'm doing wrong?
Problem seems to be solved now.
Error:unsupported class file version 52.0
Means that library was written in Java 8 (version 52.0) and android API still doesn't support Java 8 strongly enough to use such libraries even if you have selected JDK 1.8+ in your Android Studio project settings. Correct me if I'm wrong.

Finished with non-zero exit value 1

Problem Solved:
Re-installed Java and got
java.lang.OutOfMemoryError: GC overhead limit exceeded
Added the following within the android block in gradle and it worked
dexOptions {
incremental true
javaMaxHeapSize "4g"
}
Thank you everyone!
----------------------------------------------------------------------------
I'm getting a java error when I try to run an app that has both facebook and paypal sdk as dependencies. It works fine when I comment the facebook sdk dependency on gradle, but I need facebook login to work for my application too. Please help.
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.google.android.gms:play-services-identity:8.1.0'
compile 'com.google.android.gms:play-services-plus:8.1.0'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'org.lucasr.twowayview:twowayview:0.1.4'
compile 'com.facebook.android:facebook-android-sdk:4.8.2'
compile files('libs/PayPalAndroidSDK-2.12.1.jar')
compile files('libs/httpcore-4.4.3.jar')
compile files('libs/httpclient-4.5.1.jar')
}
The error message:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportMediarouterV72220Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAds830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAnalytics830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppindexing830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppinvite830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAppstate830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesAuth830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBase830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesBasement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesCast830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesDrive830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesFitness830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGames830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesGcm830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesIdentity830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesLocation830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMaps830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesMeasurement830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesNearby830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPanorama830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesPlus830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesSafetynet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesVision830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWallet830Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServicesWearable830Library UP-TO-DATE
:app:prepareOrgLucasrTwowayviewTwowayview014Library 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:compileDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:packageAllDebugClassesForMultiDex
:app:shrinkDebugMultiDexComponents
:app:createDebugMainDexClassList
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: Exception parsing classes
at com.android.dx.command.dexer.Main.processClass(Main.java:752)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:718)
at com.android.dx.command.dexer.Main.access$1200(Main.java:85)
at com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1645)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:672)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:569)
at com.android.dx.command.dexer.Main.runMultiDex(Main.java:366)
at com.android.dx.command.dexer.Main.run(Main.java:275)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Caused by: com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.parseClass(Main.java:764)
at com.android.dx.command.dexer.Main.access$1500(Main.java:85)
at com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1684)
at com.android.dx.command.dexer.Main.processClass(Main.java:749)
... 12 more
1 error; aborting
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.7.0_79\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 39.781 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
If you have any libraries in your libs folder --> Right Click > Add as library
Then delete this line > compile fileTree(include: ['*.jar'], dir: 'libs')
OR
It must have been a problem with the Java install. Remove all traces of Java and reinstall. Answer here Android java.exe finished with non-zero exit value 1
Please make sure your Minimum SDK more or equal to API Level-15, check your project libs folder and make sure it should not have any 'Face Book' (.jar) files.
if you have two classes or variables with the same name except in first caracter (for me one starts with a capital letter) this will cause the problem if you're using java 1.8

EXCEPTION Multiple dex files define - Android Studio

Can anyone please help me with this? I dont know what does this mean. To give you a back up I updated my sdk with 23 and then i got 101 errors regarding HTTPClient not being resolved.
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72310Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42310Library 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:compileDebugJava UP-TO-DATE
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\Akula\AppData\Local\Android\sdk\build-tools\23.0.1\dx.bat --dex --no-optimize --output D:\NewAndroidstudioworkspace\ToReachMe\app\build\intermediates\dex\debug --input-list=D:\NewAndroidstudioworkspace\ToReachMe\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lorg/apache/http/ConnectionClosedException;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
Information:BUILD FAILED
Information:Total time: 9.118 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
add code in gradle:
defaultConfig {
..
..
multiDexEnabled true
}

Gradle Build Errors

Message Gradle Build
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72103Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42103Library 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:compileDebugJava
Note: C:\Users\Jhun-PC\AndroidStudioProjects\SFELAPCO\app\src\main\java\com\example\jhun_pc\sfelapco\Transfer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:preDexDebug UP-TO-DATE
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\Jhun-PC\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex --no-optimize --output C:\Users\Jhun-PC\AndroidStudioProjects\SFELAPCO\app\build\intermediates\dex\debug --input-list=C:\Users\Jhun-PC\AndroidStudioProjects\SFELAPCO\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
Information:BUILD FAILED
Information:Total time: 2 mins 28.956 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Looks like you are using dependencies from two different version of support library, making
Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs available in both libraries, which generates conflict on build.
It's better to check your dependency graph. Open Terminal from studio,and cd to your app module and run this command ..\gradlew -q dependencies. It will list all dependencies with parent dependencies, chances are high that you will find your conflicting Support Library there.
In Case of any confusion, update your question with your dependency graph. And beware of your jar files from your libs directory. I fear it may be skipped by dependency graph...

Android Studio 1.0 - "local path doesn't exist" with external library project

Even the "Studio Android 0.8.x" I could reference an external library project as a module of my project.
In settings.gradle file:
include ':app'
// sinapse library
include ':SinapseLibrary2.1'
project(':SinapseLibrary2.1').projectDir = new File('/Users/douglas/AndroidStudioProjects/SinapseLibrary2.1/library')
After the 0.9.x version that is not possible. When I run the app I get the message below.
I use the same project library within several other projects.
This is a bug, or is there an alternative?
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:SinapseLibrary2.1:compileLint
:SinapseLibrary2.1:copyReleaseLint UP-TO-DATE
:SinapseLibrary2.1:mergeReleaseProguardFiles UP-TO-DATE
:SinapseLibrary2.1:preBuild
:SinapseLibrary2.1:preReleaseBuild
:SinapseLibrary2.1:checkReleaseManifest
:SinapseLibrary2.1:prepareReleaseDependencies
:SinapseLibrary2.1:compileReleaseAidl UP-TO-DATE
:SinapseLibrary2.1:compileReleaseRenderscript UP-TO-DATE
:SinapseLibrary2.1:generateReleaseBuildConfig UP-TO-DATE
:SinapseLibrary2.1:generateReleaseAssets UP-TO-DATE
:SinapseLibrary2.1:mergeReleaseAssets UP-TO-DATE
:SinapseLibrary2.1:generateReleaseResValues UP-TO-DATE
:SinapseLibrary2.1:generateReleaseResources UP-TO-DATE
:SinapseLibrary2.1:packageReleaseResources UP-TO-DATE
:SinapseLibrary2.1:processReleaseManifest UP-TO-DATE
:SinapseLibrary2.1:processReleaseResources UP-TO-DATE
:SinapseLibrary2.1:generateReleaseSources UP-TO-DATE
:SinapseLibrary2.1:compileReleaseJava UP-TO-DATE
:SinapseLibrary2.1:processReleaseJavaRes UP-TO-DATE
:SinapseLibrary2.1:packageReleaseJar UP-TO-DATE
:SinapseLibrary2.1:compileReleaseNdk UP-TO-DATE
:SinapseLibrary2.1:packageReleaseJniLibs UP-TO-DATE
:SinapseLibrary2.1:packageReleaseLocalJar UP-TO-DATE
:SinapseLibrary2.1:packageReleaseRenderscript UP-TO-DATE
:SinapseLibrary2.1:bundleRelease UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareCromoledRemoteControlSinapseLibrary21UnspecifiedLibrary 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:compileDebugJava UP-TO-DATE
:app:preDexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
...while parsing br/ind/sinapse/library/BuildConfig.class
1 error; aborting
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Users/douglas/ferramentas/adt-bundle-mac-x86_64-20140702/build-tools/21.1.2/dx --dex --output /Users/douglas/AndroidStudioProjects/CromoledRemoteControl/app/build/intermediates/pre-dexed/debug/classes-b4d0e7e6eb67c94397ec32d2b0a00147807d74d7.jar /Users/douglas/AndroidStudioProjects/CromoledRemoteControl/app/build/intermediates/exploded-aar/CromoledRemoteControl/SinapseLibrary2.1/unspecified/classes.jar
Error Code:
1
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dx.cf.iface.ParseException: bad class file magic (cafebabe) or version (0034.0000)
at com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:472)
at com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)
at com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)
at com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)
at com.android.dx.command.dexer.Main.processClass(Main.java:704)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
at com.android.dx.command.dexer.Main.access$300(Main.java:83)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
at com.android.dx.command.dexer.Main.processOne(Main.java:632)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:280)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
...while parsing br/ind/sinapse/library/BuildConfig.class
1 error; aborting
Information:BUILD FAILED
Information:Total time: 2.351 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
It is not so sure but I have experienced a similar error message as "local path doesn't exist".
My problem was solved by executing "Sync Project with Gradle Files" with the button on the Toolbar.
thank you for your attention. Finally solved the problem, but I could not understand what was the cause.
I undid the project changes that were using the version of "Android 0.8.x Studio" and then imported again in the "Android Studio 1.0.1". Updated the proguard parameters, etc.
Now it's all right. Thank you.

Categories

Resources