错误:无法解析':react-native-maps @ debug / compileClasspath'的依赖项:无法解析androidx.appcompat:appcompat:1.0.0

时间:2019-07-08 15:01:38

标签: android reactjs react-native gradle dependencies

我要做的就是在基本应用程序上安装react native映射。我一直在生成与随机错误。我尝试了几种不同的gradle版本,但仍然没有运气。有人可以帮忙吗?

重新安装React本机地图 新鲜项目 更改gradle版本 更改SDK版本等 已研究。很多!

// 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

2 个答案:

答案 0 :(得分:0)

这与androidx更新有关,除非您使用的是我认为是今天发布的React Native 0.60,否则您需要将android实现限制为Google需要androidx之前的版本。

在我们的项目中,我们必须在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'
}

我们的依赖关系必须限制为:

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'

我们还需要将所有:+依赖项约束到特定版本,以确保这些依赖项没有发布不兼容的更新。因此,我们将react native实现更新为当前使用的版本,另外,您将需要研究jsc实现以找到与之配合使用的正确版本。

万一重要,我们将使用gradle 3.3.1和SDK 28.0.3。

让我知道这是否没有足够的道理。我们可能做的更多,但是如果我没有记错的话,那是我需要进行的更改,以确保我没有使用androidx。您可能还需要其他版本的地图。

答案 1 :(得分:0)

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

android.enableJetifier=false