我正在使用React Native,并且在我的应用程序上需要一个Map,为此,我正在尝试使用react-native-maps。但是当我安装它并尝试使用它时,我得到了以下红色屏幕:
在此链接中,我已按照所有安装步骤进行操作和示例:
https://github.com/react-community/react-native-maps
我的视图代码没有什么错,但是配置中可能缺少某些东西。
这是我的环境:
"react-native-maps": "github:react-community/react-native-maps"
"react": "16.5.0"
"react-native": "0.57.0"
我正在使用github链接添加react-native-maps,因为有人在react-native-maps的“问题”页面中说过(这里是一个协作者说> https://github.com/react-community/react-native-maps/issues/2539#issuecomment-428291213的链接<),但即使这样做也不起作用。
我忘了提到链接lib时发生的情况:
失败:构建失败,并出现异常。
出了什么问题:任务':app:transformDexArchiveWithExternalLibsDexMergerForDebug'的执行失败。
com.android.builder.dexing.DexArchiveMergerException:合并dex归档文件时出错: D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 47.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 50.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 35.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 41.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 38.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 44.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 53.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 3.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 21.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 26.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 18.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 8.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 27.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 12.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 25.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 4.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 9.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 14.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 22.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 17.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 1.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 13.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 5.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 0.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 23.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 16.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 29.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 6.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 10.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 19.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 20.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 2.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 24.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 11.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 7.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 28.jar, D:\ Projetos \ atitur \ android \ app \ build \ intermediates \ transforms \ dexBuilder \ debug \ 15.jar 了解如何解决此问题,网址为 https://developer.android.com/studio/build/dependencies#duplicate_classes。 程序类型已经存在: android.support.v4.app.ActionBarDrawerToggle $ Delegate
尝试:使用--stacktrace选项运行以获取堆栈跟踪。使用--info或--debug选项运行以获取更多日志输出。使用--scan运行以获取完整的见解。
- 获得更多帮助
在33秒内成功建立48项可执行的任务:已执行24项,最新的24项 无法在设备上安装该应用,请阅读以上错误 细节。确保您正在运行Android模拟器或设备 连接并设置您的Android开发环境: https://facebook.github.io/react-native/docs/getting-started.html
答案 0 :(得分:-1)
我已经按照以下步骤操作了:
npm i --save react-native-maps
react-native link react-native-maps
iOS
Android
AndroidManifest.xml
中添加Google Maps API: <meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ENTER_HERE_YOUR_GOOGLEMAPS_API_KEY"/>
react-native run-ios
/ react-native run-android