Манифест слияния возникает, когда Android Studio 3.2 обновлен на 3.1.4 - PullRequest
0 голосов
/ 26 сентября 2018

Я хочу использовать последнюю версию Android Studio, и я импортировал старую версию кода и обновил Android Studio после обновления. Я столкнулся со следующей ошибкой после обновления gradle для Android Studio

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 <application> element
 at AndroidManifest.xml:5:1-38:15 to override.

Я добавил один тег, упомянутый в вышеупомянутой ошибке, добавленный в манифест

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

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.GET_ACCOUNTS" />

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

, но после этого возникает другая ошибка, пожалуйста, предложите мне исправить эту ошибку, я застрял за один день до

    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processDebugManifest'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73)
    at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59)    

Мой файл Gradle

     compileSdkVersion 28
    defaultConfig {
        applicationId "app.digiskills.com.digiskillsapp"
        minSdkVersion 19
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout: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'
    implementation 'com.google.android.gms:play-services-auth:15.0.1'
    implementation 'pub.devrel:easypermissions:0.3.0'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
    implementation('com.google.api-client:google-api-client-android:1.25.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    implementation('com.google.apis:google-api-services-youtube:v3-rev205-1.25.0') {
        exclude group: 'org.apache.httpcomponents'
    }
    implementation files('libs/YouTubeAndroidPlayerApi.jar')

    implementation 'com.google.dagger:dagger:2.10'
//    implementation 'com.google.dagger:dagger-compiler:2.10'
    implementation 'com.android.support:design:28.0.0'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.10'
    implementation "com.mikepenz:materialdrawer:6.1.0"

Ответы [ 4 ]

0 голосов
/ 26 сентября 2018

Добавьте android:appComponentFactory к вашему манифесту

<application
  android:appComponentFactory="android.support.v4.app.CoreComponentFactory"
  tools:replace="android:appComponentFactory">
0 голосов
/ 26 сентября 2018

Добавление: tools:replace="android:appComponentFactory" к AndoridManifest.xml также не решило проблему для меня.

Как указано здесь , а также здесь ( Getting Started ) вам, вероятно, нужно будет перейти по адресу:

Refactor -> Migrate to Android X

И после этого все будет в порядке.

Обратите внимание, что вам также необходимо изменить xmlкоды на стороне xml.

Например (они должны начинаться с androidx):

<androidx.appcompat.widget.Toolbar
0 голосов
/ 26 сентября 2018

наконец-то я решил свою проблему, заменив эту

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
    implementation 'com.android.support.constraint:constraint-layout:1.1.1'

    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'

    implementation 'com.android.support:design:28.0.0-alpha3'
    implementation 'com.android.support:cardview-v7:28.0.0-alpha3'
}
0 голосов
/ 26 сентября 2018

В общем, чтобы увидеть, что является ошибкой, вы можете увидеть объединенный файл манифеста в Android studio

  1. Перейти к вашему файлу манифеста

enter image description here

Нажмите на нижнюю вкладку «Объединенный манифест»

enter image description here

На правом экране в разделе «Другие файлы манифеста» проверьте наличие ошибок, связанных с graddle
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...