Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DexIndexException, DexException #60

Open
stanch opened this issue May 27, 2015 · 5 comments
Open

DexIndexException, DexException #60

stanch opened this issue May 27, 2015 · 5 comments

Comments

@stanch
Copy link

stanch commented May 27, 2015

Hi,

I’m not very familiar with the plugin, but it seems that this would be the right place to ask about these exceptions (from https://groups.google.com/forum/#!topic/macroid/IIZ2iyie6h0):

This compiles fine in AndroidStudio but when I tried to run it (assembleDebug) I was getting the DexIndexException for too many methods. I tried enabling MultiDex (according to their wiki and android docs), but this just gave me a new exception:

DexException: Too many classes in --main-dex-list, main dex capacity exceeded

@hermanbanken
Copy link

+1, I'm having this too.

UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Too many classes in --main-dex-list, main dex capacity exceeded
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:494)
    at com.android.dx.command.dexer.Main.runMultiDex(Main.java:334)
    at com.android.dx.command.dexer.Main.run(Main.java:244)
    at com.android.dx.command.dexer.Main.main(Main.java:215)
    at com.android.dx.command.Main.main(Main.java:106)

when running gradle dexDevDebug --info, and also when I try to run tests.

@hermanbanken
Copy link

My build.gradle looks like this. Lots of duplicate scala dependencies, cause some libraries conflict with versions 2.11.2, 2.11.4 and 2.11.6.

buildscript {
    repositories {
        mavenCentral()
    }

    dependencies {
        classpath "com.android.tools.build:gradle:1.1.3"
        classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.4"
    }
}

repositories {
    jcenter()
    maven {
        url "https://jitpack.io"
    }
}

apply plugin: "com.android.application"
apply plugin: "jp.leafytree.android-scala"

android {
    compileSdkVersion "android-22"
    buildToolsVersion "22.0.1"

    defaultConfig {
        targetSdkVersion 22
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "com.android.test.runner.MultiDexTestRunner"
    }

    dexOptions {
        preDexLibraries false
        javaMaxHeapSize "2g"
    }

    packagingOptions{
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
    }

    productFlavors {
        dev {
            minSdkVersion 15
        }

        prod {
            minSdkVersion 8
        }
    }
}

dependencies {
    compile "com.android.support:multidex:1.0.1"
    compile "io.reactivex:rxscala_2.11:0.24.1"
    compile "io.reactivex:rxandroid:0.24.0"
    compile 'com.androidplot:androidplot-core:0.6.1'
    compile 'com.nitayjoffe.thirdparty.net.robowiki.knn:knn-benchmark:0.1'
    compile 'com.github.tavendo:AutobahnAndroid:v0.5.2'
    compile 'edu.emory.mathcs:JTransforms:2.4'

    androidTestCompile 'org.scalatest:scalatest_2.11:2.2.5'
    androidTestCompile 'org.mockito:mockito-all:1.10.19'
    androidTestCompile "com.android.support:multidex-instrumentation:1.0.1", { exclude module: "multidex" }

    // Correct scala libs:
    compile "com.typesafe.zinc:zinc:0.3.7"
    compile "org.scala-lang:scala-library:2.11.6"
    compile "org.scala-lang:scala-compiler:2.11.6"
    compile "org.scala-lang:scala-reflect:2.11.6"
    androidTestCompile "org.scala-lang:scala-library:2.11.6"
    androidTestCompile "org.scala-lang.modules:scala-xml_2.11:1.0.3"
    androidTestCompile "org.scala-lang:scala-compiler:2.11.6"
    androidTestCompile "org.scala-lang:scala-reflect:2.11.6"
}

tasks.withType(ScalaCompile) {
    scalaCompileOptions.useAnt = false
    scalaCompileOptions.deprecation = false
    scalaCompileOptions.additionalParameters = ["-feature"]
}

@bj0
Copy link

bj0 commented Jun 2, 2015

I posted the original message in macroid's forums. My dependencies are much simpler than hermanbanken:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.1.1'
    compile 'org.scala-lang:scala-library:2.11.6'
    compile 'org.macroid:macroid_2.11:2.0.0-M4'
    compile 'com.noveogroup.android:android-logger:1.3.1'
    compile "com.android.support:multidex:1.0.1"
}

@swhgoon
Copy link

swhgoon commented Jun 30, 2015

+1, I'm having this too...
try doing http://blog.osom.info/2014/12/too-many-methods-in-main-dex.html

@cmlocker
Copy link

I'm having this too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants