Зависимости фрагментов навигации с помощью библиотек JetPack - PullRequest
0 голосов
/ 13 февраля 2019

Я разрабатываю приложение для Android с использованием библиотек Jetpack.Я хотел бы использовать навигацию тоже, чтобы определить навигацию более прохладным способом.Для этого я включаю (Android Studio делает это для меня) зависимость:

implementation 'android.arch.navigation:navigation-fragment:1.0.0-beta02'

Я использую библиотеки JetPack (не смотрите, как я их определяю, это работает):

   lifecycleVersion = '2.0.0'
    loggingRetrofitVersion = "3.9.0"
    butterKnife = "10.0.0"
    kriptonVersion = "5.1.0-rc.3"
    eventBusVersion = "3.1.1"

    okHttpVersion="3.13.1"
    kriptonVersion = "5.1.0-rc.3"
    aboutlibrariesVersion = "6.1.1"
    daggerVersion="2.21"
    glideVersion="4.8.0"

    // Testing
    jUnitVersion = '4.12'
    mockitoVersion = '2.13.+'
    jacocoVersion = '0.7.9'
    espressoVersion="3.1.0"

    // Libraries android
    appCompatVersion = '1.0.2'
    supportAnnotationVersion="1.0.0"
    multidexVersion = '2.0.0'
    cardviewVersion="1.0.0"
    constraintLayoutVersion="1.1.3"
    coordinatorLayoutVersion="1.0.0"
    recyclerViewVersion="1.0.0"
    materialVersion="1.1.0-alpha03"
    viewPagerVersion="1.0.0"

    // Presentation
    appDependencies = [
            "androidx.appcompat:appcompat:$appCompatVersion",
            "androidx.cardview:cardview:$cardviewVersion",
            "androidx.constraintlayout:constraintlayout:$constraintLayoutVersion",
            "androidx.coordinatorlayout:coordinatorlayout:$coordinatorLayoutVersion",
            "androidx.recyclerview:recyclerview:$recyclerViewVersion",
            "androidx.viewpager:viewpager:$viewPagerVersion",
            "com.google.android.material:material:$materialVersion",

            // ViewModel and LiveData
            "androidx.lifecycle:lifecycle-livedata-core:$lifecycleVersion",
            "androidx.lifecycle:lifecycle-runtime:$lifecycleVersion",
            "androidx.lifecycle:lifecycle-extensions:$lifecycleVersion",
            "androidx.lifecycle:lifecycle-extensions:2.1.0-alpha02",

           "org.greenrobot:eventbus:$eventBusVersion",

            "com.jakewharton:butterknife:$butterKnife",
            "com.abubusoft:kripton-android-library:$kriptonVersion",
            "com.squareup.okhttp3:logging-interceptor:$loggingRetrofitVersion",

            "com.google.dagger:dagger:$daggerVersion",    
            "com.squareup.retrofit2:converter-scalars:2.5.0",

            "io.reactivex:rxjava:1.1.8"

    ]

Поскольку я включил библиотечную навигацию, при попытке создать проект я получаю следующую ошибку:

> Task :app:processDebugManifest FAILED
D:\mobile\my-project\app\src\main\AndroidManifest.xml:22:18-86 Error:
    Attribute application@appComponentFactory value=(androidx.core.app.CoreComponentFactory) from [androidx.core:core:1.1.0-alpha03] AndroidManifest.xml:22:18-86
    is also present at [com.android.support:support-compat:28.0.0] AndroidManifest.xml:22:18-91 value=(android.support.v4.app.CoreComponentFactory).
    Suggestion: add 'tools:replace="android:appComponentFactory"' to <application> element at AndroidManifest.xml:7:5-99:19 to override.

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

Хорошо, я могу просто добавить новый тег ... но я хочу избежатьчто в моем проекте есть androidx и старая библиотека поддержки.

Как я могу это сделать?Есть ли android.arch.navigation:navigation-fragment эквивалентная библиотека для JetPack?Я нашел для этого, но ничего не нашел.

Заранее спасибо.

ОБНОВЛЕНИЕ : я запустил зависимости цели цели и результат (для конкретногобиблиотека):

+--- android.arch.navigation:navigation-fragment:1.0.0-beta02
|    +--- com.android.support:support-fragment:28.0.0
|    |    +--- com.android.support:support-compat:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:collections:28.0.0
|    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    +--- android.arch.lifecycle:runtime:1.1.1
|    |    |    |    +--- android.arch.lifecycle:common:1.1.1
|    |    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    |    +--- android.arch.core:common:1.1.1
|    |    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    |    \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    \--- com.android.support:versionedparcelable:28.0.0
|    |    |         +--- com.android.support:support-annotations:28.0.0
|    |    |         \--- com.android.support:collections:28.0.0 (*)
|    |    +--- com.android.support:support-core-ui:28.0.0
|    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    +--- com.android.support:support-core-utils:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    +--- com.android.support:documentfile:28.0.0
|    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:loader:28.0.0
|    |    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    |    +--- android.arch.lifecycle:livedata:1.1.1
|    |    |    |    |    |    +--- android.arch.core:runtime:1.1.1
|    |    |    |    |    |    |    +--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    |    |    |    |    \--- android.arch.core:common:1.1.1 (*)
|    |    |    |    |    |    +--- android.arch.lifecycle:livedata-core:1.1.1
|    |    |    |    |    |    |    +--- android.arch.lifecycle:common:1.1.1 (*)
|    |    |    |    |    |    |    +--- android.arch.core:common:1.1.1 (*)
|    |    |    |    |    |    |    \--- android.arch.core:runtime:1.1.1 (*)
|    |    |    |    |    |    \--- android.arch.core:common:1.1.1 (*)
|    |    |    |    |    \--- android.arch.lifecycle:viewmodel:1.1.1
|    |    |    |    |         \--- com.android.support:support-annotations:26.1.0 -> 28.0.0
|    |    |    |    +--- com.android.support:localbroadcastmanager:28.0.0
|    |    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    |    \--- com.android.support:print:28.0.0
|    |    |    |         \--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:customview:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    \--- com.android.support:support-compat:28.0.0 (*)
|    |    |    +--- com.android.support:viewpager:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    |    +--- com.android.support:coordinatorlayout:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    |    +--- com.android.support:drawerlayout:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    |    +--- com.android.support:slidingpanelayout:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    \--- com.android.support:customview:28.0.0 (*)
|    |    |    +--- com.android.support:interpolator:28.0.0
|    |    |    |    \--- com.android.support:support-annotations:28.0.0
|    |    |    +--- com.android.support:swiperefreshlayout:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    +--- com.android.support:support-compat:28.0.0 (*)
|    |    |    |    \--- com.android.support:interpolator:28.0.0 (*)
|    |    |    +--- com.android.support:asynclayoutinflater:28.0.0
|    |    |    |    +--- com.android.support:support-annotations:28.0.0
|    |    |    |    \--- com.android.support:support-compat:28.0.0 (*)
|    |    |    \--- com.android.support:cursoradapter:28.0.0
|    |    |         \--- com.android.support:support-annotations:28.0.0
|    |    +--- com.android.support:support-core-utils:28.0.0 (*)
|    |    +--- com.android.support:support-annotations:28.0.0
|    |    +--- com.android.support:loader:28.0.0 (*)
|    |    \--- android.arch.lifecycle:viewmodel:1.1.1 (*)
|    \--- android.arch.navigation:navigation-runtime:1.0.0-beta02
|         +--- com.android.support:support-core-utils:28.0.0 (*)
|         \--- android.arch.navigation:navigation-common:1.0.0-beta02
|              \--- com.android.support:support-compat:28.0.0 (*)
+--- androidx.core:core:1.0.1 -> 1.1.0-alpha03 (*)
+--- junit:junit:4.12

Ответы [ 2 ]

0 голосов
/ 13 февраля 2019

найдите ниже зависимости

com.android.support:support-compat:28.0.0 

и замените просто на androidx.appcompat:appcompat:1.0.0

Поскольку класс CoreComponentFactory доступен в обеих зависимостях, и поэтому он конфликтует как дублирующий класс

androidx.core.app.CoreComponentFactory

android.support.v4.app.CoreComponentFactory

0 голосов
/ 13 февраля 2019

добавьте эту библиотеку:

    implementation 'androidx.core:core:1.0.1'

Обновление :

И проверьте ваш gradle.properties:

android.useAndroidX=true
android.enableJetifier=true
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...