Shahnaz Khan
Shahnaz Khan

Reputation: 1155

Gradle project sync failed for android support multidex library

I am trying to add Multidex library to my project. I added following as dependency in my 'app/build.gradle' -

complie 'com.android.support:multidex:1.0.1'

when i try to sync i can see following error

Error:Could not find method complie() for arguments [com.android.support:multidex:1.0.1] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK Manager. 

i have Android Support Repository installed.

SDK Manager snapshot

Can someone help me? Thanks in Advance.

Upvotes: 1

Views: 5005

Answers (2)

Eswar
Eswar

Reputation: 172

Just make sure that you are editing the correct build.gradle file. You will get this error when editing android/build.gradle instead of android/app/build.gradle.

Upvotes: 2

Raju
Raju

Reputation: 1223

add multiDexEnabled = true in your build.gradle

android {
defaultConfig {
    ...
    multiDexEnabled = true
}
}

dependencies {
  ...
  compile 'com.android.support:multidex:1.0.0'
  ...
}

add this to manifest file

android:name="android.support.multidex.MultiDexApplication"

and your Activity class

    protected void attachBaseContext(Context base) {
     super.attachBaseContext(base);
     MultiDex.install(this);
     }

Upvotes: 3

Related Questions