目录

React Native 个推安卓引用依赖项失败 ERROR: Unable to resolve dependency for

React Native 2020-02-18 阅读 321 评论 0

问题

公司的 React Native 的项目以前集成了 react-native-getui 个推推送,后来升级到了 1.1.35 版本,个推模块的build.gradle如下:

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation "com.android.support:support-v4:25+"
    implementation "com.facebook.react:react-native:+"  // From node_modules
    implementation 'com.getui:sdk-for-google-play:4.3.5.9'
    implementation 'com.getui:mzp-for-google-play:1.0.9'
    implementation 'com.getui:xmp-for-google-play:1.0.6'
    implementation 'com.getui:hwp-for-google-play:1.0.6'
}

但是在android studio编译的时候,出现以下错误,无法解析依赖项。

ERROR: Unable to resolve dependency for ':react-native-getui@debug/compileClasspath': Could not resolve com.getui:sdk-for-google-play:4.3.5.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debug/compileClasspath': Could not resolve com.getui:mzp-for-google-play:1.0.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debug/compileClasspath': Could not resolve com.getui:xmp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debug/compileClasspath': Could not resolve com.getui:hwp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugAndroidTest/compileClasspath': Could not resolve com.getui:sdk-for-google-play:4.3.5.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugAndroidTest/compileClasspath': Could not resolve com.getui:mzp-for-google-play:1.0.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugAndroidTest/compileClasspath': Could not resolve com.getui:xmp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugAndroidTest/compileClasspath': Could not resolve com.getui:hwp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugUnitTest/compileClasspath': Could not resolve com.getui:sdk-for-google-play:4.3.5.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugUnitTest/compileClasspath': Could not resolve com.getui:mzp-for-google-play:1.0.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugUnitTest/compileClasspath': Could not resolve com.getui:xmp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@debugUnitTest/compileClasspath': Could not resolve com.getui:hwp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@release/compileClasspath': Could not resolve com.getui:sdk-for-google-play:4.3.5.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@release/compileClasspath': Could not resolve com.getui:mzp-for-google-play:1.0.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@release/compileClasspath': Could not resolve com.getui:xmp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@release/compileClasspath': Could not resolve com.getui:hwp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@releaseUnitTest/compileClasspath': Could not resolve com.getui:sdk-for-google-play:4.3.5.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@releaseUnitTest/compileClasspath': Could not resolve com.getui:mzp-for-google-play:1.0.9.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@releaseUnitTest/compileClasspath': Could not resolve com.getui:xmp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui


ERROR: Unable to resolve dependency for ':react-native-getui@releaseUnitTest/compileClasspath': Could not resolve com.getui:hwp-for-google-play:1.0.6.
Show Details
Affected Modules: android-react-native-getui

解决

回头看了 react-native-getui 的文档说明:

本插件采用maven方式引入sdk,故需要在android/build.gradle中添加 maven 地址

 maven {
    url "http://mvn.gt.igexin.com/nexus/content/repositories/releases/"
}
最后更新 2020-02-18