不变违规:requireNativeComponent:在UIManager react native中找不到AIRMap

问题描述 投票:3回答:1

我正在使用React Native,我需要在我的应用程序上使用Map,因为我正在尝试使用react-native-maps。但是当我安装它并尝试使用它时,我得到了这些红色屏幕:

enter image description here

我已按照此链接中的所有安装步骤和示例进行操作:

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时,会发生这种情况:

FAILURE:构建因异常而失败。

  • 出了什么问题:任务执行失败':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 \ interm ediates \ 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运行以获得完整的见解。
  • https://help.gradle.org获得更多帮助

在33s内构建失败48个可操作的任务:24个已执行,24个最新无法在设备上安装应用程序,请阅读上面的错误以获取详细信息。确保您运行的是Android模拟器或已连接设备并设置了Android开发环境:https://facebook.github.io/react-native/docs/getting-started.html

reactjs react-native react-native-maps
1个回答
-1
投票

我按照以下步骤做到了:

  1. npm i --save react-native-maps
  2. react-native link react-native-maps

iOS版

  1. 我需要在https://facebook.github.io/react-native/docs/linking-libraries-ios之后手动链接lib

Android的

  1. 在Android上,我只需要在我的AndroidManifest.xml上为Google Maps API添加:

<meta-data android:name="com.google.android.geo.API_KEY" android:value="ENTER_HERE_YOUR_GOOGLEMAPS_API_KEY"/>


  1. 别忘了重建你的App!

react-native run-ios / react-native run-android

© www.soinside.com 2019 - 2025. All rights reserved.