0

I am trying to use latest libraries as part of my requirement. I did upgraded the gradle version to 3.1.4 and all the support libraries with the matching compile and target SDK versions, But when building project I am getting

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:28:5-122:19 to override.

My app-build.gradle looks like this:

buildscript {
repositories {
    maven { url 'https://maven.fabric.io/public' }
}

dependencies {
    classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "propelit.actionopps.com.propelit"
    minSdkVersion 21
    targetSdkVersion 28
    versionCode 7
    versionName "1.7"
    multiDexEnabled true
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    useLibrary 'org.apache.http.legacy'

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
externalNativeBuild {

}
}
repositories {
mavenCentral()
mavenLocal()
flatDir {
    dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
implementation(name: 'HERE-sdk', ext: 'aar')
implementation 'com.victor:lib:1.0.4'
implementation 'com.google.code.gson:gson:2.8.5'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:preference-v14:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.github.markushi:circlebutton:1.1'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.android.support:support-vector-drawable:28.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5+'
implementation 'com.github.lzyzsd:circleprogress:1.2.1'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'com.google.firebase:firebase-core:17.0.0'
implementation 'com.android.support:multidex:1.0.3'
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'

}

apply plugin: 'com.google.gms.google-services'

My project level build.gradle looks like this

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

repositories {
    maven {
        url 'https://maven.fabric.io/public'
    }
    google()
    jcenter()

}
dependencies {
    classpath 'com.android.tools.build:gradle:3.4.1'
    classpath 'io.fabric.tools:gradle:1.29.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    classpath 'com.google.gms:google-services:4.3.0'
}
}

allprojects {
repositories {
    google()
    jcenter()
    mavenCentral()
    mavenLocal()
    maven { url "https://jitpack.io"
    }
    maven {
        url 'https://maven.google.com/'
    }
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

enter image description here

Anyone please put a light on what I might be doing wrong here?

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841
GeekWithGlasses
  • 572
  • 2
  • 12
  • 30

1 Answers1

0

Since I think you're using libraries from both new AndroidX and old Android Support from the error saying about both androidx.core.app.CoreComponentFactory and android.support.v4.app.CoreComponentFactory, please add the following in your gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

This should resolve these dependency conflicts. Hope it helps!

SaadAAkash
  • 3,065
  • 3
  • 19
  • 25
  • I did it, Its not showing a red underline now but again on building project I am getting this: ` org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures. Caused by: org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'. Caused by: org.gradle.api.internal.tasks.compile.CompilationFailedException: Compilation failed; see the compiler error output for details.` – GeekWithGlasses Jul 03 '19 at 21:24
  • So what's the compiler error this time? Please add it to the post. – SaadAAkash Jul 03 '19 at 21:26
  • see this answer & fix the error listed under java compiler or inform us of the errors so we can help. https://stackoverflow.com/a/50586433/11040422 – SaadAAkash Jul 03 '19 at 21:27
  • In all of the activities I am getting `error: package android.support.v7.app does not exist`. – GeekWithGlasses Jul 03 '19 at 21:30
  • @GeekWithGlasses, another thing I just noticed in your `build.gradle`. Add `buildToolsVersion "28.0.0"` and sync and let me know if this compilation error persists – SaadAAkash Jul 03 '19 at 21:30
  • @GeekWithGlasses, okay so your project is missing the support library from the SDK. – SaadAAkash Jul 03 '19 at 21:32
  • I added buildToolsVersion to 28 and if you notice my first comment the error there is coming from java compiler only, I copied that stack trace from there itself. – GeekWithGlasses Jul 03 '19 at 21:33
  • In SDK manager I don't see any available library update. – GeekWithGlasses Jul 03 '19 at 21:33
  • check this out https://ibb.co/q7DKxck – GeekWithGlasses Jul 03 '19 at 21:36
  • If i further extend the error logs I only get error: package android.support.v7.app does not exist error: cannot find symbol class AppCompatActivity – GeekWithGlasses Jul 03 '19 at 21:37
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/195952/discussion-between-ahmedaljubair-and-geekwithglasses). – SaadAAkash Jul 03 '19 at 21:50