Gradle DSL method not found: 'multiDexEnabled ()'

I followed the multidex guide at https://developer.android.com/tools/building/multidex.html.

But I get this error. Gradle DSL method not found: 'multiDexEnabled ()' . I updated the Android built-in tools, the Android support repository, and the library. Here is my gradle.build file. Am I doing something wrong here?

Could not find method multiDexEnabled() for arguments [true] on ProductFlavorDsl_Decorated{name=main, minSdkVersion=ApiVersionImpl{mApiLevel=10, mCodename='null'}, targetSdkVersion=ApiVersionImpl{mApiLevel=17, mCodename='null'}, renderscriptTargetApi=-1, renderscriptSupportMode=null, renderscriptNdkMode=null, versionCode=-1, versionName=null, applicationId=test.com.app, testApplicationId=null, testInstrumentationRunner=null, testHandleProfiling=null, testFunctionalTest=null, signingConfig=null, resConfig=null}. 

build.gradle

 apply plugin: 'com.android.application' android { compileSdkVersion 19 buildToolsVersion "21.1.1" defaultConfig { applicationId "test.com.app" minSdkVersion 10 targetSdkVersion 17 // Enabling multidex support. multiDexEnabled true } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile project(':addThisSDK') compile project(':centeredContentButton') compile project(':googleplayservices_lib') compile files('libs/addthis0.0.8.jar') compile files('libs/adxtag2.4.6.jar') compile files('libs/android-support-v4.jar') compile files('libs/aws-android-sdk-1.7.1.1-debug.jar') compile files('libs/commons-lang-2.6.jar') compile files('libs/crittercism_v4_4_0_sdkonly.jar') compile files('libs/dd-plist.jar') compile files('libs/FiksuAndroidSDK_4.1.1.jar') compile files('libs/iqengines-sdk-barcode.jar') compile files('libs/irEventTracker-1.2.jar') compile files('libs/jolt-core-0.0.7.jar') compile files('libs/json-utils-0.0.7.jar') compile files('libs/jsoup-1.7.2.jar') compile files('libs/kooaba-api-v4-java.jar') compile files('libs/signpost-commonshttp4-1.2.1.1.jar') compile files('libs/signpost-core-1.2.1.1.jar') compile 'com.android.support:multidex:1.0.0' } 
+7
source share
5 answers

You must be running version 0.14.0 or later of the Android Gradle plugin. For more details on what is in each version, see the release notes for http://tools.android.com/tech-docs/new-build-system .

+4
source

Make sure the dependencies in your gradle application have the following 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 version of gradle installed.

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

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

In your AndroidManifest.xml. add the following line:

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

You can read all the documentation here.

+5
source

I also got this error when I put multiDexEnabled true in the wrong place. Make sure this is in the defaultConfig code block:

 android { ... defaultConfig { ... // Enabling multidex support. multiDexEnabled true } } 
+4
source

Set

 minSdkVersion 21 

It worked from me.

0
source

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

-1
source

Source: https://habr.com/ru/post/978130/


All Articles