0

I'm try to use this button style this link But I had Implementation error, my build.gradle like that:

That's my dependencies :

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.android.volley:volley:1.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}

And the error:

ERROR: 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-19:19 to override.

How can I fix that?

guipivoto
  • 18,327
  • 9
  • 60
  • 75
FatalError
  • 153
  • 12

1 Answers1

1

I guess this error is happening because their latest version is using AndroidX but your app is still using Support Library.

So, I guess there are two possibilities:

  • Downgrade library version

Checking their release history, it seems the AndroidX was introduced on version v2.0.0. So, use an old version: v.1.14.0. Just use implementation 'br.com.simplepass:loading-button-android:1.14.0'

  • Migrate to AndroidX.

You may also consider to migrate to Android X since Android Support library is now deprecated. For any case, you may want to check first solution to ensure the problem is really being caused by the AndroidSupport/AndroidX conflict

Edit

Just sharing more info since you are not aware about the AndroidX.

When developing an Android App, you probably want to build a single APK which works in different Android Versions. However, as you may imagine, there are some differences between different Android versions such as methods that are no longer used (deprecated) or were added later etc. Features that exists in a version but not in others etc. For this reason, you will end up using the Android Support Library. It is a special library which helps you to support several Android versions. Not only that, but some views such as ConstraintLayout, RecyclerView and CardView were released as a library.. as part of the Android Support Library.

In your build gradle, we can see that you are already using the Android Support Library:

implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'

However, on last year, Android deprecated the Support Library and created the AndroidX. In a certain way, it is the same thing.. Just a different name..

Sooner or later, you will migrate your app to Android X since support library won't be updated anymore.

However, not only you app will migrate to AndroidX but some third party library will move to AndroidX as well. In this case, we have the library LoadingButtonAndroid that started to used the android X in version v.2.0.0. However, since you didn't migrate your app yet, you have some this kind of conflit. So, you fix by either using an old version of LoadingButtonAndroid or by migrating your app to AndroidX.

HERE you can find how to migrate your app to AndroidX. Usually, it is a very simple process. However, Android Studio always forget to change some import and you have to manually change from support library to androidx.

Automatically or manually, migrating to AndroidX just means that you have to update your imports from android.support.v7.app.AppCompatActivity to androidx.appcompat.app.AppCompatActivity

As you can see, class name is the same and there's no code changes... All the views are the same.. Just their package (import) that is different.

guipivoto
  • 18,327
  • 9
  • 60
  • 75