Ошибки манифеста и сборки - PullRequest
0 голосов
/ 30 июня 2019

Получил все эти ошибки внезапно все ошибки сборки «Сбой манифеста с множественными ошибками в Android Studio»

вот когда я делаю предложение заменить на Android Studio, когда я не получаю это

"Ошибка слияния манифеста: Атрибут 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). Предложение: добавьте 'tools: replace = "android: appComponentFactory"' к элементу на AndroidManifest.xml: 9: 5-43: 19, чтобы переопределить. "

Манифест

 <application

            android:allowBackup="true"
            android:icon="@drawable/messengered"
            android:label="@string/app_name"
            android:roundIcon="@drawable/messengered"
            android:supportsRtl="true"
            android:theme="@style/AppTheme"
            tools:ignore="GoogleAppIndexingWarning"
            >

        <activity android:name=".NewMessegesActivity">
            <meta-data android:name="android.support.PARENT_ACTIVITY"
                       android:value=".LatestMessagesActivity"/>
        </activity>

        <activity android:name=".LatestMessagesActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

        <activity android:name=".LoginActivity">
        </activity>

        <activity android:name=".RegisterActivity">
        </activity>

    </application>

это приложение Gradle

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.+'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.3'
    implementation 'com.google.firebase:firebase-auth:16.0.3'
    implementation 'com.google.firebase:firebase-storage:16.0.1'
    implementation 'com.google.firebase:firebase-database:16.0.1'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.xwray:groupie:2.3.0'

    implementation 'com.android.support:recyclerview-v7:28.+'
    implementation 'com.squareup.picasso:picasso:2.71828'
    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'

}

после того, как я попробовал отмеченное решение, я получил ошибку компиляции и исправил ее, изменив зависимости от 'android.support' на 'androidx.support', как это

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'androidx.core:core-ktx:1.0.2'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.firebase:firebase-core:17.0.0'
    implementation 'com.google.firebase:firebase-auth:18.0.0'
    implementation 'com.google.firebase:firebase-storage:18.0.0'
    implementation 'com.google.firebase:firebase-database:18.0.0'
    implementation 'de.hdodenhof:circleimageview:3.0.0'
    implementation 'com.xwray:groupie:2.3.0'
    implementation 'com.android.support:recyclerview-v7:28.0.0'
    implementation 'com.squareup.picasso:picasso:2.71828'
    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'
} 

затем переназначил макеты на 'AppCompatActivity ()', потому что произошли ошибки, которые исправят это в манифесте

Ответы [ 2 ]

0 голосов
/ 30 июня 2019

Проблема в том, что ваша сборка использует как старое пространство имен com.android.support, так и новое пространство имен androidx.

Чтобы решить именно эту проблему, Google создал свой инструмент "jetifier", см. StackOverflow / Что такое Jetifier для получения дополнительной информации и как его использовать.

0 голосов
/ 30 июня 2019

Вы можете добавить эти две строки в ваш файл манифеста

tools:replace="android:appComponentFactory"
android:appComponentFactory="whateverString"

Вот так

<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"
    android:usesCleartextTraffic="true"
    tools:replace="android:appComponentFactory"
    android:appComponentFactory="whateverString">

Надеюсь, его работыдля тебя ...

...