2015-03-12 2 views
2

В проекте Android команда в основном по-прежнему использует Eclipse, были добавлены некоторые сторонние библиотеки, а затем Android Studio не запускается на устройстве anf при запуске gradle построить там ошибка:Android build не удается выполнить com.android.dex.DexException: несколько файлов dex определяют Landroid/support

:preDexDebug      
warning: Ignoring InnerClasses attribute for an anonymous inner class 
(com.umeng.socialize.bean.a) 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. 
warning: Ignoring InnerClasses attribute for an anonymous inner class 
(com.umeng.socialize.bean.b) 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. 

и так далее warning: Ignoring InnerClasses attribute 10 до 20 раз для различных файлов

(ОБНОВЛЕНИЕ эти предупреждения кажутся старше проблема, см Dx warning issues with latest Android SDK датированное 2 ноября '11, также в Many issues after upgrading to Android Studio 1.0)

warning: Ignoring InnerClasses attribute for an anonymous inner class 
(com.tencent.mm.sdk.b.b) 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. 

:dexDebug      
UNEXPECTED TOP-LEVEL EXCEPTION: 
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl; 
     at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596) 
     at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554) 
     at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535) 
     at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171) 
     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) 

:dexDebug FAILED   

FAILURE: Build failed with an exception. 

* What went wrong: 
Execution failed for task ':dexDebug'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_05\bin\java.exe'' finished with no 
n-zero exit value 2 

* Try:   
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. 

BUILD FAILED 

Пытались с

buildToolsVersion "19.1.0" 
compileSdkVersion 19 

и

buildToolsVersion "22" 
compileSdkVersion 22 

и

buildToolsVersion "21.1.2" 
compileSdkVersion 21 

как для

compile 'com.android.support:appcompat-v7:19.0.+' 

и компиляции 'com.android.support:appcompat-v7:21.0.+'

Затмение ADT не имеет никаких проблем. Как преодолеть с помощью gradle/Android Studio?

+0

Используете ли вы в вашем р roject, любая библиотека любого типа, которая уже включает поддержку android v4 и экспортирует ее? –

ответ

1

Благодаря Гильермо Мерино для намека. Да, есть android-support-v4.jar.

решаемые с exclude в

dependencies { 
    compile fileTree(dir: 'libs', include: '*.jar', exclude: 'android-support-*.jar') 
    //... 
} 

смотри также

+0

Если вы ответили на свой вопрос, отметьте его правильно. –

Смежные вопросы