I have an gradle error everytime I run the app

1758 views android
4

I am working with an android project and every time I run the app there is an error of this type :

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-alpha1] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory). Suggestion: add 'tools:replace="android:appComponentFactory"' to element at AndroidManifest.xml:10:5-44:19 to override.

and even if I try to do it the way it told me there is another error.

this is the build.gradle file :

apply plugin: 'com.android.application'

android {
compileSdkVersion 28
defaultConfig {
    applicationId "com.community.jboss.visitingcard"
    minSdkVersion 19
    targetSdkVersion 28
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
buildToolsVersion '28.0.3'
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
//the intro library
implementation 'com.github.msayan:tutorial-view:v1.0.6'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation "com.android.support:preference-v7:28.0.0"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
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'
}

and this is the manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.community.jboss.visitingcard">

<!--
    TODO: Add location/GPS access permissions
    TODO: Change the Label of the Activities according to the Activity's 
context
    TODO: Change App Icon .i.e., ic_launcher
-->
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:roundIcon="@mipmap/ic_launcher_round"
    android:supportsRtl="true"
    android:theme="@style/AppTheme">
    <activity
        android:name=".LoginActivity"
        android:label="@string/app_name"
        android:theme="@style/AppTheme.NoActionBar" />
    <activity android:name=".VisitingCard.VisitingCardActivity" />
    <activity android:name=".IntroScreens.SliderActivity">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <!-- TODO: Add Google Maps API key here -->
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/google_maps_key" />

    <activity
        android:name=".Maps.MapsActivity"
        android:label="@string/title_activity_maps"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" />
    <activity android:name=".VisitingCard.ViewVisitingCard" />
    <activity
        android:name=".SettingsActivity"
        android:label="@string/title_activity_settings" />
    <activity android:name=".IntroActivity"></activity>
</application>

</manifest>

answered question

1 Answer

0

Add the following line in your manifest :

tools:replace="android:appComponentFactory

Like this :

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
tools:replace="android:appComponentFactory>

//Your code here

</application>

posted this

Have an answer?

JD

Please login first before posting an answer.