0

I added the AppCombatActivity v7 23. Which generated a few errors and I sorted them out. However while running the application, I am getting a multiple dex error -

com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;

What I have done till now which didn't work-

  1. Removing the annotations jar from the SDK.
  2. Removing the v4 android-support-v4.jar

The code compiles when I remove the compile statement from the gradle.

Here is my gradle -

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
    compile 'com.github.deano2390:MaterialShowcaseView:1.0.5@aar'
    compile 'com.android.support:appcompat-v7:23.0.1'
}

PS - Even compiled with 22.0.+

Entire error report -

    Information:Gradle tasks [:assembleDebug]
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:preReleaseBuild UP-TO-DATE
:prepareComAndroidSupportAppcompatV72301Library UP-TO-DATE
:prepareComAndroidSupportSupportV42301Library UP-TO-DATE
:prepareComGithubDeano2390MaterialShowcaseView105Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:processDebugJavaRes UP-TO-DATE
:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:compileDebugNdk UP-TO-DATE
:compileDebugSources
:preDexDebug
:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
    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)
Error:Execution failed for task ':dexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_20\bin\java.exe'' finished with non-zero exit value 2
Information:BUILD FAILED
Information:Total time: 19.656 secs
Information:1 error
Information:0 warnings
Information:See complete output in console

I ran the gradlew too. Here is the log -

Unzipping C:\Users\Sanved\.gradle\wrapper\dists\gradle-2.4-all\3i2gobhdl0fm2tosnn15g540i0\gradle-2.4-all.zip to C:\Users\Sanved\.gradle\wrapper\dists\gradle-2.4-all\3i2gobhdl0fm2tosnn15g540i0
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.2.3/gradle-1.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle-core/1.2.3/gradle-core-1.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/builder/1.2.3/builder-1.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint/24.2.3/lint-24.2.3.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/5.1/proguard-gradle-5.1.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-parent/5.1/proguard-parent-5.1.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-model/1.2.3/builder-model-1.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-test-api/1.2.3/builder-test-api-1.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/sdklib/24.2.3/sdklib-24.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/sdk-common/24.2.3/sdk-common-24.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/common/24.2.3/common-24.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/manifest-merger/24.2.3/manifest-merger-24.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/ddms/ddmlib/24.2.3/ddmlib-24.2.3.pom
Download https://repo1.maven.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.pom
Download https://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/7/oss-parent-7.pom
Download https://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.pom
Download https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/5.0.3/asm-5.0.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom
Download https://repo1.maven.org/maven2/org/ow2/ow2/1.3/ow2-1.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.pom
Download https://repo1.maven.org/maven2/com/google/code/gson/gson/2.2.4/gson-2.2.4.pom
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-checks/24.2.3/lint-checks-24.2.3.pom
Download https://repo1.maven.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.pom
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-base/5.1/proguard-base-5.1.pom
Download https://repo1.maven.org/maven2/com/android/tools/annotations/24.2.3/annotations-24.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/layoutlib/layoutlib-api/24.2.3/layoutlib-api-24.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/dvlib/24.2.3/dvlib-24.2.3.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/33/commons-parent-33.pom
Download https://repo1.maven.org/maven2/org/apache/apache/13/apache-13.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1.1/httpcomponents-client-4.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/project/4.1.1/project-4.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-client/4.1/httpcomponents-client-4.1.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava/17.0/guava-17.0.pom
Download https://repo1.maven.org/maven2/com/google/guava/guava-parent/17.0/guava-parent-17.0.pom
Download https://repo1.maven.org/maven2/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.pom
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-api/24.2.3/lint-api-24.2.3.pom
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-analysis/5.0.3/asm-analysis-5.0.3.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.pom
Download https://repo1.maven.org/maven2/org/apache/httpcomponents/httpcomponents-core/4.1/httpcomponents-core-4.1.pom
Download https://repo1.maven.org/maven2/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/5/commons-parent-5.pom
Download https://repo1.maven.org/maven2/org/apache/apache/4/apache-4.pom
Download https://repo1.maven.org/maven2/commons-codec/commons-codec/1.4/commons-codec-1.4.pom
Download https://repo1.maven.org/maven2/org/apache/commons/commons-parent/11/commons-parent-11.pom
Download https://repo1.maven.org/maven2/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.pom
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle/1.2.3/gradle-1.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/gradle-core/1.2.3/gradle-core-1.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/builder/1.2.3/builder-1.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint/24.2.3/lint-24.2.3.jar
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-gradle/5.1/proguard-gradle-5.1.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-model/1.2.3/builder-model-1.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/builder-test-api/1.2.3/builder-test-api-1.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/sdklib/24.2.3/sdklib-24.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/sdk-common/24.2.3/sdk-common-24.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/common/24.2.3/common-24.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/build/manifest-merger/24.2.3/manifest-merger-24.2.3.jar
Download https://repo1.maven.org/maven2/com/android/tools/ddms/ddmlib/24.2.3/ddmlib-24.2.3.jar
Download https://repo1.maven.org/maven2/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar
Download https://repo1.maven.org/maven2/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar
Download https://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
Download https://repo1.maven.org/maven2/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.jar
Download https://repo1.maven.org/maven2/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
Download https://repo1.maven.org/maven2/com/android/tools/lint/lint-checks/24.2.3/lint-checks-24.2.3.jar
Download https://repo1.maven.org/maven2/org/eclipse/jdt/core/compiler/ecj/4.4/ecj-4.4.jar
Download https://repo1.maven.org/maven2/net/sf/proguard/proguard-base/5.1/proguard-base-5.1.jar

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'AIVVA'.
> Could not resolve all dependencies for configuration ':classpath'.
   > Could not download proguard-base.jar (net.sf.proguard:proguard-base:5.1)
      > Could not get resource 'https://repo1.maven.org/maven2/net/sf/proguard/proguard-base/5.1/proguard-base-5.1.jar'.
         > Failed to move file 'C:\Users\Sanved\AppData\Local\Temp\gradle_download7702719224180984692bin' into filestore at 'C:\Users\Sanved\.gradle\caches\modules-2\files-2.1\net.sf.proguard\proguard-base\5.1\dc606dd778fe4685be16d5a171782ccfe0ef5637\proguard-base-5.1.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: 10 mins 0.155 secs
Sanved
  • 921
  • 13
  • 19
  • 1
    Please run `./gradlew youtProjectName:dependencies` and provide the result in your post. – droidpl Oct 04 '15 at 15:16
  • Sure, give me a moment – Sanved Oct 04 '15 at 15:26
  • I added the gradlew output log. Please check it out. – Sanved Oct 04 '15 at 16:20
  • The execution of this command has failed because it cannot resolve this dependency > Could not get resource 'https://repo1.maven.org/maven2/net/sf/proguard/proguard-base/5.1/proguard-base-5.1.jar'. This is not the valid output I was trying to get – droidpl Oct 04 '15 at 16:42
  • Any suggestions what I must do now to get things back on track. – Sanved Oct 04 '15 at 16:53
  • This command tells you the dependencies tree, which is useful in your case to know which dependencies are being repeated. Which .jar's do you have in the libs folder? Maybe this is causing your problem – droidpl Oct 04 '15 at 19:56
  • I checked the libs folder, there was a support-v4 library there. I removed it. Thanks mate. Rewrite the comment as an answer so that I close the thread by selecting it as the answer. – Sanved Oct 05 '15 at 07:22

2 Answers2

1

The MaterialShowCaseView already has the appcompat-v7.

You should exclude it like this in you build.gradle:

compile("com.github.deano2390:MaterialShowcaseView:1.0.5@aar") {
    exclude group: 'com.android.support', module:'appcompat-v7'
}
compile 'com.android.support:appcompat-v7:23.0.1'
JpCrow
  • 4,881
  • 4
  • 32
  • 46
  • Did that, the error still remains. I even tried putting it before and after the app-combat dependency. – Sanved Oct 04 '15 at 15:22
  • Did you clean your proyect? – JpCrow Oct 04 '15 at 15:26
  • It remains even after cleaning. I think I should reinstall a few things and see if that checks. And yes, I do not like Android Studio at all. – Sanved Oct 04 '15 at 16:15
  • I excluded the appcompat-v7 from the appcompat as well. Something like this - compile("com.github.deano2390:MaterialShowcaseView:1.0.5@aar") { exclude group: 'com.android.support', module:'appcompat-v7' } compile ("com.android.support:appcompat-v7:23.0.1"){ exclude group: 'com.android.support', module:'appcompat-v7' } That doesn't help either. – Sanved Oct 04 '15 at 16:40
1

You can use the following command to check the dependencies of your project. ./gradlew youtProjectName:dependencies

This command tells you which is your dependencies tree, which is useful in your case to know which dependencies are being repeated. It is also likely you have some repeated dependencies in your libs folder

droidpl
  • 5,872
  • 4
  • 35
  • 47