如果我在gradle這個文件寫代碼程序兼容性-V7:22.1.0不工作
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 9
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.0.0'
}
所有工作涼爽。但如果我改變
compile 'com.android.support:appcompat-v7:22.1.0'
我的應用程序崩潰。 Android工作室推薦我更換版本爲22.1.0
但如果我chage版本 - 崩潰。
Error:Execution failed for task ':app:dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
C:\Users\zen_75\AppData\Local\Android\sdk\build-tools\22.0.1\dx.bat --dex --no-optimize --output C:\projects\android-customer\app\build\intermediates\dex\debug --input-list=C:\projects\android-customer\app\build\intermediates\tmp\dex\debug\inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536
at com.android.dx.merge.DexMerger$6.updateIndex(DexMerger.java:502)
at com.android.dx.merge.DexMerger$IdMerger.mergeSorted(DexMerger.java:277)
at com.android.dx.merge.DexMerger.mergeMethodIds(DexMerger.java:491)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:168)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
at com.android.dx.command.dexer.Main.run(Main.java:246)
at com.android.dx.command.dexer.Main.main(Main.java:215)
at com.android.dx.command.Main.main(Main.java:106)
我該如何修復它,或者離開它?
編輯:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion '22.0.1'
defaultConfig {
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.1.0'
}
更改文件 - 不行!
可能重複[錯誤,當我的gradle包括圖書館(http://stackoverflow.com/questions/29839332/error-when-i-include-gradles-library) – Yurets
你在一次旅行。 –
[問題更新到最新的appcompat和支持庫]的可能重複(http://stackoverflow.com/questions/26515378/issue-updating-to-latest-appcompat-and-support-library) – mmlooloo