Search code examples
androidjava-native-interfaceandroid-multidex

"Unsupported method: SourceProvider.getJniDirectories()" vs "Gradle DSL method not found: 'multiDexEnabled()'"


I have an app that has many dependencies "Unable to execute dex: method ID not in [0, 0xffff]: 65536" after update repositories.

Then, I found the solution here.

However, after follow those instructions, I started getting the error "Gradle DSL method not found: 'multiDexEnabled()".

Then, I found that the solution was to update gradle, by adding "classpath.'com.android.tools.build:gradle:0.14.0'" to dependencies.

Then, I started getting the error "Unsupported method: SourceProvider.getJniDirectories()", and I found many posts saying that the solution is to set gradle back to "0.13.+".

But, gradle 0.13.+ doesn't recognise multiDexEnabled and shows my first error "Gradle DSL method not found: 'multiDexEnabled()'".

I need to use multiDex because of the many dependencies I use and also I use Jni. So, one solution breaks the other one.

[UPDATE] A information that can help: I migrated my project from Eclipse to Android Studio because I didn't find a solution for multidex on Eclipse.

Has anyone had same problem? Is there a solution for that?

Thanks!


Solution

  • Just update your Android Studio to 9.+ version. Try Help - Check for update. If no one update was found switch to the Canary channel (Help - Check for update - Updates).