How do make sure there is no conflict of “v7 appco

2019-02-27 16:41发布

问题:

I have a android library with com.android.support:appcompat-v7:23.0.1 dependency in the gradle.

Say any applicaion with different version com.android.support:appcompat-v7:23.3.0is in the build.gradle of that application uses my library.

Below are the list of questions I have doubt.

  1. which version does the android take? Lower one or Higher one? How do i see it?

  2. Won't there be any conflict if i use different version like 24 or 25 and above or same?

  3. How do i make sure there is no conflict of v7 appcompat when any app uses my library?

回答1:

  1. which version does the android take? Lower one or Higher one? How do i see it?

Gradle uses the higher one.
You can use the command gradlew dependencies to check the dependencies tree.

  1. Won't there be any conflict if i use different version like 24 or 25 and above or same?
  2. How do i make sure there is no conflict of v7 appcompat when any app uses my library?

In general the best way to maintain a library and to avoid the conflicts is to update the library always with the latest support libraries.

What if the compiledSDK of application is 23 with appcompat-v7:23.3.0 and and that of the library is 24 with appcompat-v7:24+. Which all support libraries does the android take?

If your library uses support libraries v24, the library and the app will require to be compiled with the same level = 24.