react native 无法安装 react-native-maps (Android)

react native can't install react-native-maps (Android)

我无法安装 react native react-native-maps,当我尝试使用 react-native 运行-android 构建时出现此错误(我没有尝试 iOS 还):

A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugApk'. Configuration with name 'default' not found.

我按照这里的说明操作:

https://github.com/airbnb/react-native-maps/blob/master/docs/installation.md

当我 运行 :

react-native link

我得到:

rnpm-install info iOS module react-native-maps is already linked
rnpm-install info Android module react-native-geocoder is already linked
rnpm-install info iOS module react-native-geocoder is already linked

它似乎在 iOS 上有效,但在 android 上无效,尽管对于地理编码器它有效(并且服务工作正常)。

所以我按照手册说明进行了编辑(但我仍然得到上面的错误):

android/app/build.gradle
android/settings.gradle
MainApplication.java
android\app\src\main\AndroidManifest.xml (was already edited for geocoder).

我确实玩了一下 build.gradle 中的版本号 :

// instructed in the installation guide -> build fail see above
compile project(':react-native-maps')
// Version 0.12.1 and earlier -> Build success but ERROR 500 in the app
compile 'com.airbnb.android:react-native-maps:0.12.1'
// Version 0.12.2 and later -> error see below

A problem occurred configuring project ':app'. Could not resolve all dependencies for configuration ':app:_debugApkCopy'. Could not find com.airbnb.android:react-native-maps:0.12.2.

我尝试了不同的方法,但没有任何效果。我尝试了这个 link 中的东西(但它接缝已弃用):

注意:我使用的是 react-native 0.42.0

您尝试过使用 react-native-maps v0.13.0 吗?我也在 RN42 上,那个版本适合我。

我在 git 中心为 react-native-maps 项目发布了一个问题并得到了解决方案 there

对于那些遇到同样问题的人,我的解决方案是更改 android/settings.gradle 的说明缺少 /lib/

这给出:

include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')

如果仍然无法正常工作,您可以尝试从 node_modules/react-native-maps/

中删除 .babelrc