Android 找不到参数的方法multiDexEnabled()
我的环境如下:Android 找不到参数的方法multiDexEnabled(),android,eclipse,gradle,Android,Eclipse,Gradle,我的环境如下: Eclipse:Luna Service Release 2 (4.4.2) with Gradle IDE Pack 3.6.x + 0.17 plugin Android SDK: Androd 5.1.1 (API level 22) @Override protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.i
Eclipse:Luna Service Release 2 (4.4.2) with Gradle IDE Pack 3.6.x + 0.17 plugin
Android SDK: Androd 5.1.1 (API level 22)
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
我在Eclipse中为现有的android项目生成了Gradle构建文件。并更改build.gradle,如下所示,以执行多重索引
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile project(':design')
compile project(':materialish-progress')
compile project(':PhotoView-AndroidLibrary')
compile project(':pulltorefresh')
compile project(':sweet-alert-dialog-library')
compile project(':viewpager_indicator_AndroidLibrary')
compile project(':Volley')
compile project(':android-support-v7-appcompat')
compile 'com.android.support:multidex:1.0.0'
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
multiDexEnabled true
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src','.apt_generated']
resources.srcDirs = ['src','.apt_generated']
aidl.srcDirs = ['src','.apt_generated']
renderscript.srcDirs = ['src','.apt_generated']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
// Move the tests to tests/java, tests/res, etc...
instrumentTest.setRoot('tests')
// Move the build types to build-types/<type>
// For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
// This moves them out of them default location under src/<type>/... which would
// conflict with src/ being used by the main source set.
// Adding new build types or product flavors should be accompanied
// by a similar customization.
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
但当我运行gradle构建时,出现了“找不到方法multiDexEnabled()”错误。我已经找到了很多解决方案,但没有找到工作。有人能帮忙吗?谢谢
E:\workspace3\dianzi-Android>gradle build
FAILURE: Build failed with an exception.
* Where:
Build file 'E:\workspace3\dianzi-Android\build.gradle' line: 31
* What went wrong:
A problem occurred evaluating project ':dianzi-Android'.
> Could not find method multiDexEnabled() for arguments [true] on ProductFlavorD
sl_Decorated{name=main, minSdkVersion=ApiVersionImpl{mApiLevel=14, mCodename='nu
ll'}, targetSdkVersion=ApiVersionImpl{mApiLevel=22, mCodename='null'}, renderscr
iptTargetApi=-1, renderscriptSupportMode=null, renderscriptNdkMode=null, version
Code=-1, versionName=null, applicationId=null, testApplicationId=null, testInstr
umentationRunner=null, testHandleProfiling=null, testFunctionalTest=null, signin
gConfig=null, resConfig=null}.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
您是否有意添加了“eclipse”和“gradle”标记?