gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 02:05:31 26 4
gpt4 key购买 nike

我无法安装 react native react-native-maps,当我尝试使用 react-native run-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.

我尝试了不同的方法,但没有任何效果。我尝试了此链接中的内容(但它已被弃用):

cannot evaluate module 'react-native-maps' : Configuration with name 'default' not found

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

最佳答案

我在 git hub 上针对 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

关于react-native - react native 无法安装 react-native-maps (Android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43742424/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com