Gradle DSL method not found : 'multiDexEnabled()'

后端 未结 6 1784
无人及你
无人及你 2021-01-17 23:55

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

But I get this error Gradle DSL method not found : \'multiDexEnab

相关标签:
6条回答
  • 2021-01-18 00:37

    In app/build.gridle under defaultConfig add:

    defaultConfig {
       
        ...
        multiDexEnabled true
        ...
    }
    

    Then, at the bottom, add this code exactly like this if you dont have dependencies block already:

    dependencies {
        ...
        implementation "com.android.support:multidex:1.0.3"
        ...
    }
    

    Finally, in pubspec.yaml under dependencies add:

    firebase_core: ^0.5.0+1
    

    After these changes your app should work properly.

    0 讨论(0)
  • 2021-01-18 00:40

    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.

    0 讨论(0)
  • 2021-01-18 00:40

    Set

    minSdkVersion 21
    

    This worked form me.

    0 讨论(0)
  • 2021-01-18 00:40

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

    0 讨论(0)
  • 2021-01-18 00:41

    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
        }
    }
    
    0 讨论(0)
  • 2021-01-18 00:54

    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.

    0 讨论(0)
提交回复
热议问题