pwittchen / InfiniteScroll

Infinite Scroll (Endless Scrolling) for RecyclerView in Android
Apache License 2.0
190 stars 26 forks source link

Error adding dependency in gradle #16

Open rafagan opened 5 years ago

rafagan commented 5 years ago

I experiencing the following 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.0] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:9:5-97:19 to override.

My gradle:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.10'

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

    // Testes
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'

    // Retrofit
    implementation 'com.squareup.retrofit2:retrofit:2.4.0'
    implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
    implementation 'com.google.code.gson:gson:2.8.4'
    implementation 'com.github.mrmike:Ok2Curl:0.4.5'

    // Fabric
    implementation('com.crashlytics.sdk.android:crashlytics:2.9.1@aar') {
        transitive = true
    }

    // Architecture components
    implementation 'android.arch.lifecycle:extensions:1.1.1'
    implementation 'android.arch.paging:runtime:1.0.1'
    implementation 'android.arch.lifecycle:livedata:1.1.1'
    kapt 'android.arch.lifecycle:common-java8:1.1.1'
    kapt 'com.android.databinding:compiler:3.1.4'

    // AWS
    implementation 'com.amazonaws:aws-android-sdk-cognitoidentityprovider:2.8.4'
    implementation 'com.amazonaws:aws-android-sdk-s3:2.8.4'
    implementation 'com.amazonaws:aws-android-sdk-core:2.8.4'
    implementation 'com.amazonaws:aws-android-sdk-ddb:2.8.4'
//    implementation 'com.amazonaws:aws-android-sdk-ddb-document:2.8.4'

    // Others
    implementation 'com.github.sharish:CreditCardView:v1.0.4'
    implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
    implementation 'pl.bclogic:pulsator4droid:1.0.3'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'me.relex:circleindicator:1.2.1@aar'
    implementation 'org.jetbrains.anko:anko:0.10.4'
    implementation 'com.github.santalu:mask-edittext:1.0.3'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.github.pwittchen:infinitescroll:0.0.2'

    implementation project(':room')
}
lucasmpaim commented 5 years ago

This erros occurs because the class android.support.v4.app.CoreComponentFactory is in com.android.support:support-compat:28.0.0 and androidx.core:core:1.0.0 which caused the conflict, for fix you need to exclude the dependency.

implementation('com.github.pwittchen:infinitescroll:0.0.2') {
        exclude group: 'androidx.core', module: 'core'
}
pwittchen commented 5 years ago

This is the problem @lucasmpaim explained. You can use provided solution or version 0.0.1 of the library, which doesn't use code from androix packages and it should work.

rafagan commented 5 years ago

Thanks, I added inside dependencies:

implementation ('com.github.pwittchen:infinitescroll:0.0.2') {
        exclude group: 'androidx.core', module: '*'
        exclude group: 'com.google.android.material', module: 'material'
    }

And inside android:

packagingOptions {
        exclude 'META-INF/androidx.*'
        exclude 'META-INF/proguard/androidx-*'
    }
pwittchen commented 5 years ago

@rafagan is it working fine for you now?

rafagan commented 5 years ago

Actually no. But I got the old version and it still works.