bma*_*man 7 android android-studio android-gradle-plugin android-multidex
我按照https://developer.android.com/tools/building/multidex.html上的multidex指南进行操作
但是我发现这个错误没有找到Gradle DSL方法:'multiDexEnabled()'.我更新了Android内置工具,Android支持存储库和库.这是我的gradle.build文件.我在这里做错了吗?
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}.
Run Code Online (Sandbox Code Playgroud)
的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'
}
Run Code Online (Sandbox Code Playgroud)
The*_*eIT 16
当我将multiDexEnabled true
命令放在错误的位置时,我也收到了这个错误。确保它在 defaultConfig 代码块中:
android {
...
defaultConfig {
...
// Enabling multidex support.
multiDexEnabled true
}
}
Run Code Online (Sandbox Code Playgroud)
确保应用程序的gradle文件中的依赖项具有以下行:
dependencies {
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:appcompat-v7:21.0.0'
Run Code Online (Sandbox Code Playgroud)
}
此外,在您的全局(项目)gradle文件中,请确保您拥有最新的gradle版本.
dependencies {
classpath 'com.android.tools.build:gradle:0.14.0'
}
Run Code Online (Sandbox Code Playgroud)
在SDK管理器中,确保您拥有最新的支持库和存储库.
在你的AndroidManifest.xml中.添加以下行:
android:name="android.support.multidex.MultiDexApplication"
Run Code Online (Sandbox Code Playgroud)
您可以在此处阅读整个文档.
您必须运行 0.14.0 或更高版本的 Android Gradle 插件。有关每个版本的详细信息,请参阅http://tools.android.com/tech-docs/new-build-system上的发行说明。
归档时间: |
|
查看次数: |
11320 次 |
最近记录: |