当我运行它时,显示以下错误

时间:2019-10-26 14:29:12

标签: android manifest voice-recognition

在基于语音助手的android项目上工作时,我收到错误消息

错误:清单合并失败:来自[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-的属性application @ appComponentFactory value =(android.support.v4.app.CoreComponentFactory) 91     也存在于[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value =(androidx.core.app.CoreComponentFactory)。     建议:在AndroidManifest.xml:8:5-31:19的元素上添加'tools:replace =“ android:appComponentFactory”'以进行覆盖。

清单

`<?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>'

内置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'
  }'

清单合并失败

Attribute application @ appComponentFactory value =(android.support.v4.app.CoreComponentFactory)来自[com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91     也出现在[androidx.core:core:1.0.0] AndroidManifest.xml:22:18-86 value =(androidx.core.app.CoreComponentFactory)。

1 个答案:

答案 0 :(得分:0)

您使用的是com.google.android.gms:play-services-vision:19.0.0,具体取决于AndroidX版本。 Play Services Change Log。尝试使用版本17.0.0,它将有望解决此问题。 Play Services Change Log