Search code examples
androidandroid-gradle-pluginandroiddesignsupportandroid-appcompat

How import android design support library with custom appcompat-v7?


I use Android Studio for my project.
I want to use custom appcompat-v7 library in my android project.
Android design support library has it own appcompat-v7 library.

my gradle

compile(':mycustomAppcompat-v7')
compile 'com.android.support:design:23.2.0'

My problem:
I have two appcompat-v7 library that come from:

1-My custom library.
2-Design support needed.

how can i fix it?
thank you


Solution

  • You can exclude specific modules from libraries you compile with gradle. This feature is valuable in a number of specific situations, like when you have conflicting or duplicated modules as in your case. To fix this, you can explicitly determine which modules you would like to exclude from compilation in gradle as follows:

    compile('com.android.support:design:23.2.0'){ 
        exclude module: 'appcompat-v7' 
    }
    

    This says you want to compile com.android.support:design:23.2.0 but you want to exclude its appcompat-v7 module since you are utilizing your custom one.