addisonElliott / SegmentedButton

Segmented Control/Button with animation for Android API 16+
Apache License 2.0
148 stars 39 forks source link

Build error #9

Closed ghost closed 5 years ago

ghost commented 5 years ago

Spec: compileSdkVersion 28 minSdkVersion 19 targetSdkVersion 28

Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 is also present at [androidx.core:core:1.0.1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:5:5-20:19 to override.

After add 'tools:replace="android:appComponentFactory"' to manifest Manifest merger failed with multiple errors, see logs

addisonElliott commented 5 years ago

Thanks for posting the issue.

From a basic search, it seems to be because I use androidx rather than the support libraries. See here for more info: https://stackoverflow.com/questions/51742697/android-manifest-merger-fails-after-adding-dependency-com-google-android-materia

Are you able to upgrade to AndroidX? If not, what do you suggest I do to fix this problem in the library?

addisonElliott commented 5 years ago

I just remembered that a similar library ButterKnife uses AndroidX as well. Try adding android.useAndroidX=true in gradle.properties.

If that fixes your problem, then maybe I can include a note in the README.

ghost commented 5 years ago

thanks alot for you response.

Now, i still using kotlin without andoidx. i have not planning for upgrade to androidx. And also have not suggestion about this issue.

addisonElliott commented 5 years ago

No problem. Did you try adding android.useAndroidX=true to your gradle.properties? Give that a try and report back to me first

If that doesn't work, let me experiment with a solution this weekend and get back to you.

Also, if you like this library (and assuming we can get it working for you), don't forget to star the repository! The stars will help others find & use this library.

addisonElliott commented 5 years ago

I've came up with a solution that will work for now.

I released a version of SegmentedButton that uses the Android support library rather than AndroidX. The version is 3.1.3-support. Change this in your Gradle file and it should work. I tested this on my machine using Android support library and Kotlin as well.

The README contains more information on this setup now as well. However, this approach is only temporary to give developers time to switch to AndroidX. With that in mind, I would recommend switching to AndroidX as soon as possible.

Closing this issue. Make a comment here if you're having issues and I'll re-evaluate.

ghost commented 5 years ago

thank very much for your solution and response. Sorry, now i can't to contribution about this project. Hopefully in the future I can contribute keep you the spirit