Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat

时间:2022-09-03 22:35:29

* 有详细的多个解决方案

http://*.com/questions/20989317/multiple-dex-files-define-landroid-support-v4-accessibilityservice-accessibility


Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat


1. 双击 查看 dependencies ,或执行如下脚本


Run gradle -q dependencies (or gradle -q :projectName:dependencies) to generate a dependency report. You should see where r7 is coming from, such as:

compile - Classpath for compiling the main sources. +--- com.commonsware.cwac:camera-v9:0.5.4 | +--- com.actionbarsherlock:actionbarsherlock:4.4.0 | | \--- com.google.android:support-v4:r7 | +--- com.commonsware.cwac:camera:0.5.4 | \--- com.android.support:support-v4:18.0.+ -> 18.0.0 \--- com.android.support:support-v4:18.0.+ -> 18.0.0

Then, use the exclude directive to block that dependency. In my case, it is coming from my CWAC-Camera library, and so I use:


module 的这样写 ~ 

dependencies { compile('com.commonsware.cwac:camera-v9:0.5.4') { exclude module: 'support-v4' } compile 'com.android.support:support-v4:18.0.+' }

或是项目的 ,这样写~


configurations { dependencies { compile(project(':Android-SDK')) { compile.exclude module: 'support-v4' } } }

以上方法失败的话可以是 排查的 module不对 , 排查一遍 所有module 的 Dependencies  ,- 掉 * v4  或 其他有冲突的 项  即可以 运行 assembleRelease ~


Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatMultiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompat