Error on Gradle at building app - android

I'm trying to build my app in Android Studio 0.8.2. The problem comes when I try to run it. For some reason gradle have conflicts with some thing. I'm trying to do the app from API 9 to the latest API 20.
This is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.victor.martin.conex"
minSdkVersion 9
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.wu-man:android-oauth-client:0.0.3'
compile 'com.mcxiaoke.volley:library:1.0.6'
compile 'com.android.support:support-v4:19.+'
}
I'm getting this error:
Information:Gradle tasks [:app:assembleDebug]
:app:preBuild
:app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72000Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42000Library 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
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Android\android-studio\sdk\build-tools\android-4.4W\dx.bat --dex --num-threads=4 --output C:\Workspace\Android\Conex\app\build\intermediates\dex\debug C:\Workspace\Android\Conex\app\build\intermediates\classes\debug C:\Workspace\Android\Conex\app\build\intermediates\dependency-cache\debug C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\android-oauth-client-0.0.3-49fd75ef5b0a817054f5916ff5ab54e14808bab3.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\classes-7cc46d0cb0bae00ca10de80a1f015bec4e31990d.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\classes-b29c1edb89ef40290152f03d9eac909b3feba18a.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-api-client-1.15.0-rc-d02487f9cafb438018cb25fdba9a44f98cf578bc.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-api-client-android-1.15.0-rc-2abbb143ab6f5e10640eed5256568f576dd7d007.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-http-client-1.15.0-rc-e1df4461fab23a152b7aa66b5221d5c8e854fd8d.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-http-client-android-1.15.0-rc-d496a1d3909f037794a2cc73756ec0c2ac3346ea.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-http-client-jackson-1.15.0-rc-6595d29ac939c4b4e5b634f7da95f46bdaf00182.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-oauth-client-1.15.0-rc-371af28ee7d739206128093901d5ef9e5519b749.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\google-oauth-client-java6-1.15.0-rc-50af844006b6ff8d209e3d5c8ae5b38586f91492.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\internal_impl-20.0.0-c7b6cee3a8d4437effbd77e1ecb6a9d27cdb5787.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\jackson-core-asl-1.9.11-85252fb7001ef3b907562364baf07c747edc12f4.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\jsr305-1.3.9-b07eb97c334893379d7579e0a7c4b42eac8b531f.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\library-1.0.6-f0b390752520f3c6c5541488c776ff9e909930ea.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\support-annotations-20.0.0-5d7e4cb3743aa3140da033e815058188449d4cce.jar C:\Workspace\Android\Conex\app\build\intermediates\pre-dexed\debug\support-v4-r7-d8c1273a1566346364957be294afebac8a389992.jar
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:594)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:552)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:533)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:170)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:439)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:287)
at com.android.dx.command.dexer.Main.run(Main.java:230)
at com.android.dx.command.dexer.Main.main(Main.java:199)
at com.android.dx.command.Main.main(Main.java:103)
Information:BUILD FAILED
Information:Total time: 1 mins 4.713 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
What is the problem, maybe support libraries duplicated. How I can solve this?
Thanks

Related

Execution failed for task ':app:transformClassesWithMultidexlistForDebug'

ERROR
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: 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
my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.0 rc3"
defaultConfig {
applicationId "com.example.sagar.shavanma"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:support-v4:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.github.nirhart:parallaxscroll:1.0'
compile 'com.google.code.gson:gson:2.6.2'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
Gridle
:app:preBuild UP-TO-DATE
:app:preDebugBuild UP-TO-DATE
:app:checkDebugManifest
:app:preReleaseBuild UP-TO-DATE
:app:prepareComAndroidSupportAnimatedVectorDrawable2330Library UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72330Library UP-TO-DATE
:app:prepareComAndroidSupportCardviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2330Library UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42330Library UP-TO-DATE
:app:prepareComAndroidSupportSupportVectorDrawable2330Library UP-TO-DATE
:app:prepareComAndroidVolleyVolley100Library UP-TO-DATE
:app:prepareComGithubNirhartParallaxscroll10Library 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
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources
:app:prePackageMarkerForDebug
:app:transformClassesWithJarMergingForDebug
:app:collectDebugMultiDexComponents
:app:transformClassesWithMultidexlistForDebug
ProGuard, version 5.2.1
Reading program jar [G:\Projects\Shavanma\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
Reading library jar [C:\Users\shree\AppData\Local\Android\sdk\build-tools\24.0.0-preview\lib\shrinkedAndroid.jar]
Preparing output jar [G:\Projects\Shavanma\app\build\intermediates\multi-dex\debug\componentClasses.jar]
Copying resources from program jar [G:\Projects\Shavanma\app\build\intermediates\transforms\jarMerging\debug\jars\1\1f\combined.jar]
:app:transformClassesWithMultidexlistForDebug FAILED
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
com.android.build.api.transform.TransformException: 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
try add this in your build.gradle file:
under dependency
compile 'com.android.support:multidex:1.0.0'
then create a global application class for your app:
import android.support.multidex.MultiDex;
public class Global_class extends Application {
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
add this class in your manifest file under application tag
<application
android:name="com.package_name.Global_class"
</application>

ParseException: bad class file magic (cafebabe) or version (0034.0000)

I tried even with compileOptions (build.gradle) and JDK 1.7 getting this error:
Error:com.android.dx.cf.iface.ParseException:
bad class file magic (cafebabe) or version (0034.0000)
I just wanna connect to firebird database with jaybird library.
OS: Windows 10
Android Studio 1.5.1
Libs: jaybird-full-2.2.9.jar
Gradle Version: 2.8
Android Plugin Version: 1.5.0
app>build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.domain.aaa1"
minSdkVersion 10
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/jaybird-2.2.9.jar')
}
Grandle Build 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:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:preDebugAndroidTestBuild UP-TO-DATE
:app:prepareComAndroidSupportMultidex101Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library 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:transformClassesWithJarMergingForDebug UP-TO-DATE
:app:collectDebugMultiDexComponents UP-TO-DATE
:app:transformClassesWithMultidexlistForDebug UP-TO-DATE
:app:transformClassesWithDexForDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error: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
UNEXPECTED TOP-LEVEL EXCEPTION:
Error: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
2 errors; aborting
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_66\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 55.925 secs
Information:3 errors
Information:0 warnings
Information:See complete output in console

Android Compile Error :app:preDexDebug for project with two modules

I have a Android project with two modules.
One is the App, which is the main project.
The other is the domain, which is a pure java module, where I'll put entities, services, etc.
When I compile the project, it's not working, and the message is:
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_51\bin\java.exe'' finished with
non-zero exit value 1
Here is my app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.jedi.testeandroid"
minSdkVersion 16
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.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':domain')
}
And here is my domain gradle.build
apply plugin: 'java'
dependencies {
runtime fileTree(include: ['*.jar'], dir: 'libs')
}
And here is the error log
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
:domain:compileJava UP-TO-DATE
:domain:processResources UP-TO-DATE
:domain:classes UP-TO-DATE
:domain:jar UP-TO-DATE
:app:prepareComAndroidSupportAppcompatV72311Library UP-TO-DATE
:app:prepareComAndroidSupportDesign2311Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72311Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42311Library 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: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:processDebugJavaRes UP-TO-DATE
:app:compileDebugJavaWithJavac UP-TO-DATE
:app:compileDebugNdk UP-TO-DATE
:app:compileDebugSources UP-TO-DATE
:app:preDexDebug
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:574)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:311)
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)
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:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_51\bin\java.exe'' finished with non-zero exit value 1
Information:BUILD FAILED
Information:Total time: 21.054 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
Can you try if adding the below in your build.gradle file helps:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
As Suhas said, it was a compatibility problem.
But the correct file to edit is the java module's build.gradle, and this is how it looks like, after edit.
apply plugin: 'java'
group 'com.jedi.domain'
//noinspection GroovyUnusedAssignment
sourceCompatibility = JavaVersion.VERSION_1_7
//noinspection GroovyUnusedAssignment
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
runtime fileTree(include: ['*.jar'], dir: 'libs')
}
Finally, this other post helps a lot.

Unexpected-High-Level-Exception in Android Studio

I am working on project called as Google Places and Maps which shows the current location and nearby places.
I added the four jar files:-
1.android-google-maps-api11.jar
2.google-api-client-1.10.3-beta.jar
3.google-http-client-1.10.3-beta.jar
4.google-play-services.jar
Its is working fine during build-gradle but throwing exception while running the project
here is what i am getting
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:prepareComGoogleAndroidGmsPlayServices6587Library 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
: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\abhi\AppData\Local\Android\sdk\build-tools\21.1.2\dx.bat --dex -- no-optimize --output C:\android\sdk\extras\google\m2repository\com\google\android\PlacesandMaps\app\b uild\intermediates\dex\debug --input- list=C:\android\sdk\extras\google\m2repository\com\google\android\PlacesandMaps\ app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Lcom/google/ads/AdRequest$ErrorCode;
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: 1 mins 25.598 secs
Information:1 error
Information:0 warnings
Information:See complete output in console
And here is my Build.gradle in which dependencies are there
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.abhi.placesandmaps"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
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:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile files('libs/google-api-client-1.10.3-beta.jar')
compile files('libs/google-http-client-1.10.3-beta.jar')
compile files('libs/android-google-maps-api11.jar')
compile files('libs/google-play-services.jar')
}
Don't juse jar files from Google. Use the new aar files. Here is the bug:
compile 'com.google.android.gms:play-services:6.5.87'
compile files('libs/google-play-services.jar')
There you include the play services twice remove the jar line.
The first line in your dependencies (compile fileTree(include: ['*.jar'], dir: 'libs')) will include the jar a second time, so remove the jar file from your libs directory too.
In general I'm not sure what the other jars do, but I guess they are part of the play services.

UNEXPECTED TOP-LEVEL EXCEPTION android studio

I am develoind an android studio project , everything was ok until i added
compile 'com.android.support:recyclerview-v7:+' to build.gradle file. I have been searching for 2 days for solution but haven't find yet.
Information:Gradle tasks [:app:assembleDebug] :app:preBuild :app:compileDebugNdk UP-TO-DATE
:app:preDebugBuild
:app:checkDebugManifest
:app:preReleaseBuild
:app:prepareComAndroidSupportAppcompatV72100Library UP-TO-DATE
:app:prepareComAndroidSupportRecyclerviewV72102Library UP-TO-DATE
:app:prepareComAndroidSupportSupportV42102Library UP-TO-DATE
:app:prepareComGithubMrengineer13Snackbar040Library UP-TO-DATE
:app:prepareComGoogleAndroidGmsPlayServices6171Library 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
:app:preDexDebug
:app:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command: /Users/mobven/Desktop/Android SDK/sdk/build-tools/21.1.0/dx --dex --output /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/dex/debug /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/classes/debug /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/dependency-cache/debug /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/android-support-4.0-96f0e9cf7990afcb0b54c3d327a3aced85a5af15.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-20f85e113689efd0f4d808bbf1312e09c43bdc49.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-440f6b09f10e8e30a1118a4d2d43be583bad0959.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-5a02f8ebc8798b4c3710b33fb2c074683173cb80.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-6989a5d493505095675afd12d6931b51cf429992.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/classes-a6edf6fa0c3d2cb2cec1edb40923a7d765d78fb0.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/gson-2.3-7dd4601f2faeb82b5beefe363da658c9ae925581.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/internal_impl-21.0.2-1aafd0446915d1011bb9668a6ac8f1defcf9191b.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/parceler-0.2.13-68a2a9c6331b436a4224a892389405276283d547.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/parceler-api-0.2.13-1072eb832cf4d87fb253f15aa798d90ebce68715.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/picasso-2.4.0-f12467e4b369fb01d4a49695801fd3e502b511b8.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/retrofit-1.6.1-3e3f707b537476742224240911665405915f3e6d.jar /Users/mobven/Desktop/HesapAlMaterial/app/build/intermediates/pre-dexed/debug/support-annotations-21.0.2-8c0b808a6eea01eb2d7e9f3bb66927cb2d265768.jar Error Code: 2 Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/v4/app/BackStackRecord$Op;
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:302)
at com.android.dx.command.dexer.Main.run(Main.java:245)
at com.android.dx.command.dexer.Main.main(Main.java:214)
at com.android.dx.command.Main.main(Main.java:106)
this is build.grade file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "com.mobven.hesapal"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
} }
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.google.android.gms:play-services:6.1.71'
compile 'com.github.mrengineer13:snackbar:0.4.0'
compile 'com.squareup.retrofit:retrofit:1.6.1'
compile 'com.google.code.gson:gson:2.3'
compile 'org.parceler:parceler:0.2.13'
compile files('libs/picasso-2.1.1.jar') }
Thanx in advance
Found solution
I removed
compile 'org.parceler:parceler:0.2.13'
and it started to working.I think parcelled lib is also referring supportV4 but I'm not %100 sure why it started to work or why its not working with parcelled lib.Anyway i posted solution if anyone has same problem .
Please check again libs folder, you first line at `dependencies' will include all jars from that folder. Maybe there still exists one of library from your current list of dependencies.
compile fileTree(dir: 'libs', include: ['*.jar'])

Categories

Resources