问题
3 weeks back, I had Google iosched source downloaded and imported into my android studio. I could install & run the app in my emulator as well as my devices connected to my machine. However, last week, when I tried to run the same Android Studio project, I have started getting "FAILURE: Build failed with an exception. - com.android.dex.DexIndexOverflowException".
Android SDK Tools - 23.0.5
Android SDK Platform-tools - 21
Android SDK Build-tools - 21.1.1
Android 5.0 (API 21) - SDK Platform Rev 1
ARM EABI v7s System Image - Rev 1
I tried to make changes as recommended in Configuring Your App for Multidex with Gradle but no luck.
android/build.gradle:
android {
compileSdkVersion 14
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
...
compile 'com.android.support:multidex:1.0.0'<br>
}
AndroidManifest.xml
android:name="android.support.multidex.MultiDexApplication">
But I started getting the below exception.
A problem occurred evaluating project ':android'.
Could not find method multiDexEnabled() for arguments [true] ...
I am not clear how can an app project that was running well couple weeks before can get into this kind of problem? What could have changed and where am I going wrong? Someone pls help me.
Note: In the same machine & Android Studio, I have one of our own apps which continues to run without any problem. it's target Sdk Version was 19. I could change it to 21 and run it on devices/emulator running from android ICS to Android L.
回答1:
multiDexEnabled property configured in Gradle plugin.
In your main build.gradle file, make sure that its version is at least 0.14.0:
buildscript {
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
}
}
来源:https://stackoverflow.com/questions/26971074/google-iosched-com-android-dex-dexindexoverflowexception-method-id-not-in