简体   繁体   中英

ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.0

All I am trying to do is install react native maps on a basic application. I keep getting random errors with the build. I have tried several different gradle versions and still no luck. Can anyone help?

Reinstalling react native maps Fresh project Changing gradle versions Changing SDK versions etc Researched. A lot!

// app (build.gradle)

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.facebook.react:react-native:+"  // From node_modules

    implementation(project(':react-native-maps')){
        exclude group: 'com.google.android.gms', module: 'play-services-base'
        exclude group: 'com.google.android.gms', module: 'play-services-maps'
    }
    implementation 'com.google.android.gms:play-services-base:10.0.1'
    implementation 'com.google.android.gms:play-services-maps:10.0.1'

    // JSC from node_modules
    if (useIntlJsc) {
        implementation 'org.webkit:android-jsc-intl:+'
    } else {
        implementation 'org.webkit:android-jsc:+'
    }
}

// react-native-maps (build.gradle)

dependencies {
  compileOnly('com.facebook.react:react-native:+') {
    exclude group: 'com.android.support'
  }
  implementation "com.android.support:appcompat-v7:${safeExtGet('supportLibVersion', '28.0.0')}"
  implementation "com.google.android.gms:play-services-base:10.0.1"
  implementation "com.google.android.gms:play-services-maps:10.0.1"
  implementation 'com.google.maps.android:android-maps-utils:0.5'
}

ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.0.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.core:core:1.0.0.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.vectordrawable:vectordrawable:1.0.0.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:28.0.0.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.appcompat:appcompat:1.0.2.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.core:core:1.0.1.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.vectordrawable:vectordrawable:1.0.1.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.core:core:1.0.0.
Show Details
Affected Modules: react-native-maps


ERROR: Unable to resolve dependency for ':react-native-maps@debug/compileClasspath': Could not resolve androidx.vectordrawable:vectordrawable:1.0.0.
Show Details
Affected Modules: react-native-maps


    WARNING: The specified Android SDK Build Tools version (26.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.0.
    Android SDK Build Tools 28.0.3 will be used.
    To suppress this warning, remove "buildToolsVersion '26.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
    Remove Build Tools version and sync project

This is related to the androidx update, unless you are using React Native 0.60, which I think was released today, you will need to constrain your android implementations to versions previous to Google requiring androidx.

In our project, we had to add the following at the bottom of our app/build.gradle :

configurations.all {
    resolutionStrategy.force 'com.google.android.gms:play-services-gcm:16.1.0', 'com.google.android.gms:play-services-basement:15.0.0'
}

our dependencies needed to be constrained to :

implementation 'com.facebook.react:react-native:0.59.3'  // From node_modules    
implementation 'com.android.support:appcompat-v7:27.0.1'
implementation 'com.google.android.gms:play-services-base:16.1.0'
implementation 'com.google.android.gms:play-services-gcm:16.1.0'

We also needed to constrain all :+ dependencies to specific versions to make sure that those dependencies haven't released incompatible updates. Thus we updated our react native implementation to our currently used version, plus you will need to research your jsc implementations to find the correct version to use with them.

Incase it matters, we are using gradle 3.3.1 and SDK 28.0.3.

Let me know if that didn't make enough sense. There may have been more we did, but if I'm remembering correctly those were the changes I needed to make to ensure I wasn't using androidx. You may also need a different version of maps as well.

gradle/wrapper/gradle.properties尝试设置:

android.enableJetifier=false

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM