Έχω την επόμενη τάξη
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
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.material:material:1.0.0-rc01'
}
Αλλά όταν θέλω να φτιάξω την εφαρμογή παίρνω το επόμενο αρχείο καταγραφής:
Manifest merger failed : Attribute application@appComponentFactory value=(android.support.v4.app.CoreComponentFactory) from [com.android.support:support-compat:28.0.0-alpha3] AndroidManifest.xml:22:18-91
is also present at [androidx.core:core:1.0.0-alpha3] AndroidManifest.xml:22:18-86 value=(androidx.core.app.CoreComponentFactory).
Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:5:5-19:19 to override.
Εντάξει! Πηγαίνετε στο manifest και κάντε το:
<?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="ru.chopcode.myapplication">
<application
tools:replace="android:appComponentFactory"
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">
</application>
</manifest>
Στη συνέχεια, λαμβάνω αυτό το σφάλμα στο Logcat μου:
Manifest merger failed with multiple errors, see logs that I have Linked with it
Απλά αλλάξτε το "rc01" στην πρώτη και την τελευταία γραμμή μέσα στις εξαρτήσεις σε "alpha1", Αυτό λειτουργεί για μένα
Απλά αφαιρέστε την εξάρτηση android.support
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
Παραπομπή από τις Οδηγίες Υλικού
Αν δεν θέλετε να μεταβείτε ακόμα στα νέα πακέτα androidx και com.google.android.material, μπορείτε να χρησιμοποιήσετε τα Material Components μέσω της εξάρτησης com.android.support:design:28.0.0-alpha3.
Σημείωση: Δεν θα πρέπει να χρησιμοποιείτε ταυτόχρονα τις εξαρτήσεις com.android.support και com.google.android.dependencies στην εφαρμογή σας.
Η απλή αφαίρεση αυτής της εξάρτησης λειτουργεί μια χαρά
implementation 'com.android.support:appcompat-v7:28.0.0-rc01'
Εδώ είναι το πλήρες παράδειγμα εξαρτήσεων
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.0.0-beta01'
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'
}
Δημιουργήστε ένα νέο έργο και συγκρίνετε τα αρχεία build.gradle και αντικαταστήστε όλα τα
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
και άλλες εξαρτήσεις με τις ίδιες που υπήρχαν στο νέο έργο Κάτι τέτοιο
implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
implementation 'androidx.constraintlayout:constraintlayout:1.1.2'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
implementation 'androidx.core:core-ktx:1.0.0-alpha3'
Και στη συνέχεια διορθώνονται οι εισαγωγές για τη χρήση του androidx στα αρχεία kotlin.