0

i am getting an ERROR message while working on android project based on voice assistant

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:8:5-31:19 to override.

Manifest

`<?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
 package="com.example.rohit.myapplication">
 <uses-permission android:name="android.permission.CAMERA"></uses-
  permission>
 <uses-permission android:name="android.permission.RECORD_AUDIO" />
  <uses-permission 
 android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
 <uses-permission android:name="android.permission.CALL_PHONE" />
 <application
     android:allowBackup="true"
    android:icon="@mipmap/op"
    android:label="Voice Assistant"
    android:roundIcon="@mipmap/op"
    android:supportsRtl="true"
    android:theme="@style/AppTheme"
    tools:replace="android:appComponentFactory">
    <activity android:name=".SlashScreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <meta-data
        android:name="com.google.gms.vision.DEPENDENCIES"
        android:value="ocr" />

    <activity android:name=".display" />
    <activity android:name=".help" />
    <activity android:name=".OCRActivity"></activity>
   </application>

  </manifest>'

BUILD Gradle

   'apply plugin: 'com.android.application'

    android {
  compileSdkVersion 26
   defaultConfig {
     applicationId "com.example.rohit.myapplication"
    minSdkVersion 15
    //noinspection OldTargetApi
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"



testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
  }
  buildTypes {
     release {
         minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard 
 rules.pro'
     }
   }
   }

  dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  //noinspection GradleCompatible
  implementation 'com.android.support:appcompat-v7:28.0.0'
  implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  testImplementation 'junit:junit:4.12'

  //noinspection GradleCompatible
  implementation 'com.google.android.gms:play-services-vision:19.0.0'

   implementation 'com.android.support:design:28.0.0'
  }'

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).

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
  • Possible duplicate of [Manifest Merger fails for appComponentFactory](https://stackoverflow.com/questions/52135251/manifest-merger-fails-for-appcomponentfactory) – Taseer Oct 26 '19 at 14:30
  • If you are in Android Studio, go to your manifest.xml file and change the view from "Text" to "Merged" (below the code white page); there you can find more details and shortcuts – Luca Murra Oct 26 '19 at 14:45

1 Answers1

1

You are using com.google.android.gms:play-services-vision:19.0.0 which depends on the AndroidX version. Play Services Change Log. Try using version 17.0.0, it will solve the issue hopefully. Play Services Change Log

Abdul Rahman Shamair
  • 580
  • 1
  • 11
  • 22