I created a google maps activity in Intellij Idea 2016.2.2, but when i added my api key the 64k limit exceed
error occurred. i know that we have to enable multidex true
in build.gradle
but the issue is that my 'build.gradle' files looks like this:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files } } allprojects {repositories {
jcenter()
}
}
task clean(type: Delete) { delete rootProject.buildDir }
(sorry for messed up alignment of code)
1- So as there is no defaultConfig here and when i tries to add it manually it gives me error.
2- And when i added this line in my manifest
"android:name="android.support.multidex.MultiDexApplication">"
again error.
I tried everything written here https://developer.android.com/studio/build/multidex.html and also in other questions people asked about this problem nothing worked. Anyone knows how to resolve the issue? I'll be thankful :)
if your project contains one module (that is app
), you should have two build.gradle
files:
The first one is for your project (that is the one you are posting the snippet from), you should neither add dependencies there (as noted in the commented out line there), nor you should alter defaultConfig
there.
The other one is for your app
module. This is where you should add your dependencies, and set multiDexEnabled true
. you should see defaultConfig
block there.