嘿,在添加大量文件后,我有一个大型 android 项目,我开始得到
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define
所以我搜索了我的问题,我发现一个解决方案是将此属性添加到 Gradle 文件中,但是在我成功添加项目构建之后
但是当我运行项目时,我的一些片段和活动出现 NoClassDef 错误
这是我的毕业典礼
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "cloudappers.com.rta_ca"
minSdkVersion 17
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dexOptions {
preDexLibraries = false
}
}
allprojects {
repositories {
mavenCentral()
jcenter()
maven { url 'https://github.com/leonardocardoso/mvn-repo/raw/master/maven-deploy' }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':bounceScroller')
compile project(':SwipeMenu')
compile project(':indicator')
compile files('libs/android-async-http.jar')
compile('com.weiwangcn.betterspinner:library:1.1.0') {
exclude group: 'com.android.support', module: 'appcompat-v7'
}
compile files('libs/org.apache.commons.io.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.easing:library:1.0.1@aar'
compile 'com.daimajia.androidanimations:library:1.1.3@aar'
compile 'com.edmodo:cropper:1.0.1'
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.leocardz:aelv:1.1@aar'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.google.android.gms:play-services-ads:7.8.0'
compile 'com.google.android.gms:play-services-identity:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.android.support:multidex:1.0.0'
}
它适用于 android 5 但不适用于 4.4 及更早版本
有什么帮助吗?