Gradle DSL method not found : 'multiDexEnabled()'

自古美人都是妖i 提交于 2019-12-01 16:47:19

You have to be running version 0.14.0 or later of the Android Gradle plugin. See the release notes at http://tools.android.com/tech-docs/new-build-system for details on what's in each release.

Make sure the dependencies in your app's gradle file have this lines:

dependencies {
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'

}

Also, in your global (Project) gradle file, make sure you have the latest gradle version.

dependencies {

    classpath 'com.android.tools.build:gradle:0.14.0'
}

In your SDK manager, make sure you have the latest support libraries and repo.

In your AndroidManifest.xml. add the following line:

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

You can read the entire documentation here.

I also received this error when I placed the multiDexEnabled true command in the wrong location. Make sure it's in the defaultConfig code block:

android {
    ...

    defaultConfig {
        ...

        // Enabling multidex support.
        multiDexEnabled true
    }
}

Set

minSdkVersion 21

This worked form me.

Make sure that you have android:name="android.support.multidex.MultiDexApplication" in your Android manifest file in the application element.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!