0
我知道這是一個常見問題,但我已經檢查了所有其他帖子,並沒有一個幫助。它們中的很多是用於eclipse的,而android studio的不起作用。在Android Studio中定義多個dex文件
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/android/volley/VolleyError;
我已經試過什麼:
- 搜索通過重複VolleyError(只有一個VolleyError.java和一個VolleyError.class)文件。 從GitHub
- 重新導入項目
- 從GitHub下載然後從AS
- 刪除並重新安裝的Android的全新副本工作室開放
首先,我得到的,它是一個存儲庫中的錯誤,但沒有混帳,所以我只是刪除凌空(爲我的隊友工作)。然後,當所有其他4名成員開始工作時,我的攤位和蟲子都在那裏工作。還有4個警告,一個是下面,其餘的都是相似的:
Warning:warning: Ignoring InnerClasses attribute for an anonymous inner class
(org.apache.commons.logging.impl.WeakHashtable$1) that doesn't come with an
associated EnclosingMethod attribute. This class was probably produced by a
compiler that did not target the modern .class file format. The recommended
solution is to recompile the class from source, using an up-to-date compiler
and without specifying any "-target" type options. The consequence of ignoring
this warning is that reflective operations on this class will incorrectly
indicate that it is *not* an inner class.
如果有幫助,這是下面的gradle這個文件:
apply plugin: 'com.android.application'
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/commons-logging-1.2.jar')
compile files('libs/com.fasterxml.jackson.databind.jar')
compile files('libs/gson-2.3.1.jar')
compile files('libs/httpclient-4.5.1.jar')
compile files('libs/httpcore-4.4.3.jar')
compile files('libs/jackson-core-2.7.1.jar')
compile files('libs/sun.misc.BASE64Decoder.jar')
compile files('libs/jackson-annotations-2.7.1.jar')
compile files('libs/jackson-databind-2.7.1-1.jar')
compile 'com.android.support:appcompat-v7:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.android.support:gridlayout-v7:25.3.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'com.android.support:design:25.3.0'
compile 'com.android.volley:volley:1.0.0'
testCompile 'junit:junit:4.12'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.csc301.team7.era"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
}
去除兩個額外的凌空行在gradle輪流給我這個錯誤gradle:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/fasterxml/jackson/databind/AbstractTypeResolver;
但我找不到AbstractTypeResolver。
請幫助讓這個項目運行將不勝感激。
你嘗試 defaultConfig { 的applicationID 「com.csc301.team7.era」 的minSdkVersion 15 targetSdkVersion 25 的versionCode 1 的versionName 「1.0」 \t multiDexEnabled真正 } – Elsunhoty
multiDexEnabled真正 – Elsunhoty
@Elsunhoty謝謝你很多,這工作!你能把它作爲答案發布,以便我可以舉報嗎?那警告怎麼樣?我可以忽略它們嗎? –