0
votes

comment installer des dépendances pour migrer vers androidx

J'essaie de créer mon application React-native, mais elle renvoie cette erreur:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext {
        buildToolsVersion = "27.0.3"
        minSdkVersion = 23
        compileSdkVersion = 28
        targetSdkVersion = 26
        supportLibVersion = "28.0.0"
        playServicesVersion = "16.0.0"
    }
    repositories {
        jcenter()
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        maven { url "https://jitpack.io" }
        maven { url "https://maven.google.com" }
        mavenLocal()
        google()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
        maven {
            url 'https://maven.google.com/'
            name 'Google'
        }
        jcenter()
    }
}

subprojects {
    project.configurations.all {
        resolutionStrategy.eachDependency { details ->
            if (details.requested.group == 'com.android.support'
                    && !details.requested.name.contains('multidex') ) {
                details.useVersion "28.0.0"
            }
        }
    }
    afterEvaluate {
        android {
            compileSdkVersion 28
            buildToolsVersion "27.0.3"

            defaultConfig {
                targetSdkVersion 27
            }
        }
    }
}

ext {
    buildToolsVersion = "27.0.3"
    minSdkVersion = 16
    compileSdkVersion = 28
    targetSdkVersion = 27
    supportLibVersion = "27.1.0"
}

mon fichier build.gradle a:

implementation "com.android.support:appcompat-v7:28.+"

mon fichier app / build.gradle a:

implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"

J'ai également essayé avec:

android.useAndroidX=true
android.enableJetifier=true

en ouvrant le projet dans Android Studio, le bouton "Migrer vers AndroidX" n'apparaît pas.

qu'est-ce que je fais de mal?

désolé, je suis très novice en java et je n'ai aucune idée de comment gérer ça :(


voici mon fichier build.gradle

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':app:lintVitalRelease'.
> Could not resolve all task dependencies for configuration ':app:releaseRuntimeClasspath'.
   > Could not find any version that matches androidx.appcompat:appcompat:28.+.
     Versions that do not match:
       - 1.1.0-rc01
       - 1.1.0-beta01
       - 1.1.0-alpha05
       - 1.1.0-alpha04
       - 1.1.0-alpha03
       - + 10 more
     Searched in the following locations:
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/appcompat/appcompat/
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/appcompat/appcompat/
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/appcompat/appcompat/
       - https://jitpack.io/androidx/appcompat/appcompat/maven-metadata.xml
       - https://jitpack.io/androidx/appcompat/appcompat/
       - https://maven.google.com/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/appcompat/appcompat/
       - https://dl.google.com/dl/android/maven2/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/appcompat/appcompat/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/appcompat/appcompat/
       - https://maven.google.com/androidx/appcompat/appcompat/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/appcompat/appcompat/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/appcompat/appcompat/
     Required by:
         project :app > project :react-native-device-info
         project :app > project :react-native-splash-screen
         project :app > project :react-native-maps
   > Could not find any version that matches androidx.legacy:legacy-support-v4:28.+.
     Versions that do not match:
       - 1.0.0
       - 1.0.0-rc02
       - 1.0.0-rc01
       - 1.0.0-beta01
       - 1.0.0-alpha3
       - + 1 more
     Searched in the following locations:
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/legacy/legacy-support-v4/
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/legacy/legacy-support-v4/
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/legacy/legacy-support-v4/
       - https://jitpack.io/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - https://jitpack.io/androidx/legacy/legacy-support-v4/
       - https://maven.google.com/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/legacy/legacy-support-v4/
       - https://dl.google.com/dl/android/maven2/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/legacy/legacy-support-v4/
       - https://maven.google.com/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/legacy/legacy-support-v4/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/legacy/legacy-support-v4/
     Required by:
         project :app > project :react-native-device-info
         project :app > project :react-native-firebase
   > Could not find any version that matches androidx.media:media:28.+.
     Versions that do not match:
       - 1.1.0-rc01
       - 1.1.0-beta02
       - 1.1.0-beta01
       - 1.1.0-alpha04
       - 1.1.0-alpha03
       - + 9 more
     Searched in the following locations:
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/media/media/
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/media/media/
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/media/media/
       - https://jitpack.io/androidx/media/media/maven-metadata.xml
       - https://jitpack.io/androidx/media/media/
       - https://maven.google.com/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/media/media/
       - https://dl.google.com/dl/android/maven2/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/media/media/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/media/media/
       - https://maven.google.com/androidx/media/media/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/media/media/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/media/media/
     Required by:
         project :app > project :react-native-device-info
   > Could not find any version that matches androidx.exifinterface:exifinterface:28.+.
     Versions that do not match:
       - 1.1.0-beta01
       - 1.1.0-alpha01
       - 1.0.0
       - 1.0.0-rc02
       - 1.0.0-rc01
       - + 3 more
     Searched in the following locations:
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/m2repository/androidx/exifinterface/exifinterface/
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/google/m2repository/androidx/exifinterface/exifinterface/
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/Library/Android/sdk/extras/android/m2repository/androidx/exifinterface/exifinterface/
       - https://jitpack.io/androidx/exifinterface/exifinterface/maven-metadata.xml
       - https://jitpack.io/androidx/exifinterface/exifinterface/
       - https://maven.google.com/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/.m2/repository/androidx/exifinterface/exifinterface/
       - https://dl.google.com/dl/android/maven2/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/exifinterface/exifinterface/maven-metadata.xml
       - file:/Users/myuser/myproject/node_modules/react-native/android/androidx/exifinterface/exifinterface/
       - https://maven.google.com/androidx/exifinterface/exifinterface/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/exifinterface/exifinterface/maven-metadata.xml
       - https://jcenter.bintray.com/androidx/exifinterface/exifinterface/
     Required by:
         project :app > project :react-native-camera


10 commentaires

vous les mettez dans build.gradle?


ce projet est-il un natif de réaction?


si vous avez un nombre décent de bibliothèques, je vous recommande de vérifier cette réponse car ce serait une agitation pour vous plus tard sur stackoverflow.com/a / 51798538/7586266


oui c'est natif de réaction


pouvez-vous coller la ligne appcompat de gradle?


@PradipVadher implémentation "com.android.support:appcompat-v7:${rootProject.ext.supportL‌ ibVersion}"


ce sera androidx.appcompat: appcompat: 1.0.0 vérifier la documentation pour tout autre chose également developer.android.com/jetpack/androidx/migrate


supportLibVersion? est supérieur à 28,0,0?


vérifie ça ? medium.com/google-developer-experts/ …


mis à jour avec mon fichier build.gradle


3 Réponses :


0
votes

très probablement, sans avoir vu le build.gradle , le numéro de version complet pourrait être migré:

implementation "com.android.support:appcompat-v7:28.0.0"


0 commentaires

0
votes

essayez ceci,

implementation "com.android.support:appcompat-v7:28.0.0"

après 28.0.0 appcompat converti en androidx , donc "androidx .....: 1.0 .0 "is it self implementation" com.android.support:appcompat-v7:29.0.0 "

support: appcompat n'est pas autorisé supérieur à" 28.0.0 "


0 commentaires

0
votes

Le studio Android propose une option pour migrer un projet Android existant vers Androidx dans la barre de menu Menu-> Refactoriser-Migrer vers AndroidX


0 commentaires