Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

android - Gradle exclude module does not work?

When checking for library dupplication, I ran androidDependencies and got this:

+--- com.melnykov:floatingactionbutton:1.2.0
|    --- com.android.support:recyclerview-v7:21.0.2
+--- me.drakeet.materialdialog:library:1.2.2
+--- Android Workspace:SwipeLibrary:unspecified
|    --- LOCAL: android-support-v4.jar
--- com.android.support:appcompat-v7:22.0.0
     --- com.android.support:support-v4:22.0.0
          --- LOCAL: internal_impl-22.0.0.jar

so I excluded android support v4 in the app build.gradle: (theres no file in libs folder)

   compile(project(':SwipeLibrary')) {
    exclude module: 'support-v4'
}

but apparently it does not work. The dexDebug still throws UNEXPECTED TOP-LEVEL EXCEPTION: java.lang.IllegalArgumentException: already added. How can I get rid of this issue?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

For everyone who has the same problem as me (dexDebug throws Exception saying a library is already added - related to support_v4) maybe this will help you: Go to bin/dexedLibs and find the redundant libraries (in my case it is the nineoldandroids since android_support_v4 already has it) and rebuild your project. However you should do this at your own risk so remember to back up the files before attempting to delete them.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...