我尝试启动android项目并获取错误
Error Code: 2
Output: UNEXPECTED TOP-LEVEL EXCEPTION: com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
我的gradle文件:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
applicationId "nit.livetex.livetexsdktestapp"
minSdkVersion 10
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
dependencies {
compile files("libs/sdk.jar")
compile 'com.android.support:appcompat-v7:21.0.0'
}
我认为这是因为在sdk.jar中使用了support-library。 我应该在哪里添加排除规则?
答案 0 :(得分:1)
我不确定,但你可以试试吗?
compile('com.android.support:appcompat-v7:21.0.0') {
exclude group: 'com.android.support', module: 'support-v4'
}
或
compile files("libs/sdk.jar"){
exclude group: 'com.android.support', module: 'support-v4'
}