0

I am perfectly aware that similar questions exist in the site, but none of them solved my issue. The word is, I am trying to use "openimaj" library into my android application, in android studio. everything works fine before importing the dependency

'org.openimaj:core-audio:1.3.1'

But when I import this dependency the following error appears!

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:\ProgramFiles\Java\jdk1.8.0_66\bin\java.exe'' 
finished with non-zero exit value 2

Please notice that I utilized the tutorial from http://www.openimaj.org/UseLibrary.html. It is based on Maven build configuration, but I convert it into gradle form. here is my app level gradle.build:

apply plugin: 'com.android.application'
apply plugin: 'maven'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.2"

    defaultConfig {
        applicationId "com.shadan.voicerecognitionmodule"
        minSdkVersion 19
        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 ('org.openimaj:core-audio:1.3.1')  //I TRY TO IMPORT THIS
}

and my project level build.gradle is:

 // Top-level build file where you can add configuration options common to all sub-projects/modules.

 buildscript {
     repositories {
         jcenter()
     }
     dependencies {
         classpath 'com.android.tools.build:gradle:1.5.0'

         // NOTE: Do not place your application dependencies here; they belong
         // in the individual module build.gradle files
     }
 }

 allprojects {
     repositories {
         jcenter()
         maven { url "http://snapshots.openimaj.org" }
         maven { url "http://maven.openimaj.org" }
     }
 }

 task clean(type: Delete) {
     delete rootProject.buildDir
 }

EDIT:

my gradle console error is:

 UNEXPECTED TOP-LEVEL EXCEPTION:
 com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
     at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:484)
     at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:261)
    at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:473)
    at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:161)
    at com.android.dx.merge.DexMerger.merge(DexMerger.java:188)
    at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:504)
    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)



  FAILED

 FAILURE: Build failed with an exception.

 * What went wrong:
 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 2

 * Try:
 Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Shadan Golestan
  • 106
  • 1
  • 6
  • 2
    "But when I import this dependency the following error appears!" -- the real error message appears higher in the Gradle console. Scroll upwards to find out what your real problem is. – CommonsWare Feb 22 '16 at 18:36
  • Sometimes the most relevant error message can only be seen when when running with the --debug flag on the command line with gradlew. If you can, please post that here. – Doug Stevenson Feb 22 '16 at 19:04
  • @CommonsWare : thanks for your reply. I have edited my question – Shadan Golestan Feb 22 '16 at 19:07

0 Answers0