Closed magic3584 closed 1 year ago
我周末把这两个的高德 sdk 都升级下应该就可以了
Thanks buddy 大佬辛苦
Thanks author! I had the same problem.
Waiting to be released online... I have noticed that the version of react native has been updated too, I'm wonder whether it is still available with 0.68.2 If it's not available, could u please tell me how to update the dependencies?
android 版在 RN 最新版测试通过了,但 ios 还没有测,我直接发到 npm 吧,晚点我再测 ios
Both packages were updated! I'm starting test on iOS right away!
稍等,react-native-amap3d 还没发布成功
Yeah, found it🤣
好了
刚用这个库,就赶上了最新版本,nice!!
Tested with react native 0.68.2 on iOS:
package name | version |
---|---|
react-native-amap3d | 3.2.0 |
react-native-amap-geolocation | 1.2.1 |
Installing AMapFoundation (1.8.0)
Installing AMapLocation (2.9.0)
The AMap3DMap is still not be installed. Could u please where should I fork and how to update the dependencies? I'm going to fix it and make a PR.
新版本安卓跑失败了,上个版本是成功的。
FAILURE: Build completed with 2 failures.
What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class com.amap.api.fence.DistrictItem found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.DistrictItem$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFence found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFence$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFenceClient found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFenceListener found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.PoiItem found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.PoiItem$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocation found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocation$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClient found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$2 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationMode found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationProtocol found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationPurpose found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$GeoLanguage found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationListener found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationQualityReport found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.APSService found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordUtil found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordinateConverter found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordinateConverter$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordinateConverter$CoordType found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.DPoint found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.DPoint$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.UmidtokenInfo found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.UmidtokenInfo$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.UmidtokenInfo$a found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0)
Go to the documentation to learn how to Fix dependency resolution errors.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
What went wrong: java.lang.StackOverflowError (no error message)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 24s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build completed with 2 failures.
What went wrong: Execution failed for task ':app:checkDebugDuplicateClasses'.
A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable Duplicate class com.amap.api.fence.DistrictItem found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.DistrictItem$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFence found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFence$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFenceClient found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.GeoFenceListener found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.PoiItem found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.fence.PoiItem$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocation found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocation$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClient found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$2 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationMode found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationProtocol found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$AMapLocationPurpose found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationClientOption$GeoLanguage found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationListener found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.AMapLocationQualityReport found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.APSService found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordUtil found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordinateConverter found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordinateConverter$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.CoordinateConverter$CoordType found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.DPoint found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.DPoint$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.UmidtokenInfo found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.UmidtokenInfo$1 found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0) Duplicate class com.amap.api.location.UmidtokenInfo$a found in modules jetified-3dmap-9.6.0 (com.amap.api:3dmap:9.6.0) and jetified-location-6.2.0 (com.amap.api:location:6.2.0)
Go to the documentation to learn how to Fix dependency resolution errors.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
What went wrong: java.lang.StackOverflowError (no error message)
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
@magic3584 把你的错误提示再发完整点
使用下面版本的时候,android 是正常使用的,但是 iOS 是运行时崩溃,参照本 issue 第三种情况。 | package name | version |
---|---|---|
react-native-amap3d | 3.1.1 | |
react-native-amap-geolocation | 1.1.0 |
当 pod install 的时候,完成的依赖安装如下
Installing AMap3DMap (9.2.1)
Installing AMapFoundation (1.6.9)
Installing AMapLocation (2.6.9)
Installing react-native-amap-geolocation (1.1.0)
Installing react-native-amap3d (3.1.1)
大佬刚更新过后的两个包版本如下
package name | version |
---|---|
react-native-amap3d | 3.2.0 |
react-native-amap-geolocation | 1.2.1 |
此时 pod install, 完成的依赖安装如下
Installing AMapFoundation (1.8.0)
Installing AMapLocation (2.9.0)
Installing react-native-amap-geolocation (1.2.1)
与前次相比,缺少了 AMap3DMap 和 react-native-amap3d,相当于本仓库的包没有被安装。
ios 确实已经是最新版了:
https://github.com/CocoaPods/Specs/blob/master/Specs/5/f/c/AMap3DMap/9.6.0/AMap3DMap.podspec.json iOS 最新版本是 9.6.0, "~> 9.5.0"这种写法并不能匹配成功。 不过我感觉也不是这个问题,大佬也可以更新下试试
发布了个新版本,再试试
@jefn76 试试在 android/app/build.gradle 的 dependencies {} 里加入这段:
implementation(project(':react-native-amap-geolocation')) {
exclude group: 'com.amap.api', module: 'location'
}
测试版本如下 | package name | version |
---|---|---|
react-native-amap3d | 3.2.1 | |
react-native-amap-geolocation | 1.2.1 |
有新崩溃
另外大佬,iOS 如果更新最新版本依赖,需要修改以下文件内 https://github.com/qiuxiang/react-native-amap3d/blob/main/lib/ios/react-native-amap3d.podspec
s.dependency 'AMap3DMap', "~> 9.5.0"
to
s.dependency 'AMap3DMap', "~> 9.6.0"
升级 AMap3DMap 到 9.6.0 后,还是同一个方法崩溃。我需要学一下 rn 怎么封装原生组件。
我等下用 xcode 看下
也许可能是我们的问题?明天我得看下代码是怎么写的,打印的也没有 MapView
我试了 example 是没有问题的
明天再试试新建的项目
@jefn76 试试在 android/app/build.gradle 的 dependencies {} 里加入这段:
implementation(project(':react-native-amap-geolocation')) { exclude group: 'com.amap.api', module: 'location' }
谢谢大佬,跑成功了!
我试了 example 是没有问题的
大佬请问 example 怎么跑起来?没找到 iOS 的 project
在外面 react-native init example
,然后把 example/ios 复制到 这个项目里来,然后在这个项目正常的 pos install,react-native run-ios
报错了,首先是react-native run-ios的时候,报了警告:Package react-native-amap3d contains invalid configuration: "dependency.platforms.ios.project" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this. 然后调用AMapSdk.init()后,app报错: ERROR TypeError: Cannot read property 'initSDK' of null
This error is located at: in App in RCTView (created by View) in View (created by AppContainer) in RCTView (created by View) in View (created by AppContainer) in AppContainer in AwesomeProject(RootComponent), js engine: hermes
打开Pods文件夹,发现并没有link到:
我还是先改回之前的结构。@jefn76 发了新版本,再试试
我还是先改回之前的结构。@jefn76 发了新版本,再试试
成功了,完美!
在外面
react-native init example
,然后把 example/ios 复制到 这个项目里来,然后在这个项目正常的 pos install,react-native run-ios
不行啊, nom run iOS 报错如下
还是之前同样的问题
下载的依赖关系
package.json里面的版本
在外面
react-native init example
,然后把 example/ios 复制到 这个项目里来,然后在这个项目正常的 pos install,react-native run-ios不行啊
这已经和 ios 项目没关系了,这是 js bundle 错误
不对,是原生的错,你先试试提示的操作,重新 pod install,yarn start --reset-cache
不对,是原生的错,你先试试提示的操作,重新 pod install,yarn start --reset-cache
可以了,我的错,如下修改就可以了。
接下来用最新版本的库去看我们项目的代码了,所以可能还是我们的代码有问题,但是相同代码 android 可以跑 emmm 我再研究研究,辛苦大佬~
RN 项目和原生耦合太深了,为了排除原生项目配置的问题,我干脆把 example 的原生项目都移除了,构建的时候再 react-native init 一个新的。我只能保证在新项目里能跑起来,其他项目跑不起来大概就是配置问题。
build action 可以作为参考: https://github.com/qiuxiang/react-native-amap3d/blob/f50289bfd0fbb066b46dbfb9563452696a3b2f02/.github/workflows/build.yml#L8-L19
但是大佬,本 issue 的问题仍然存在,依赖如下时,仍然无法导入地图的库
Installing AMapFoundation (1.8.0) Installing AMapLocation (2.9.0) Installing react-native-amap-geolocation (1.2.1)
请教这个 action 如何执行?
这个 action 只测了 android
准备写下 ios 的 action,可以 fork 下来,自己改,提交了就会运行
大佬这两个库的兼容问题还会去查吗?这俩库一般都搭配使用的吧
我只能晚上回去再看,公司没有 mac
现在写下 ios 的 action,估计也能看出一些问题
@magic3584 看起来是没有问题的
https://github.com/qiuxiang/react-native-amap3d/actions/runs/4170573648/jobs/7219670017
而且上面 @jefn76 也反馈没问题了
针对两个版本的 react native 0.68.2 和 0.71.2,分别创建新项目使用相同版本的两个库 | package name | version |
---|---|---|
react-native-amap3d | 3.2.3 | |
react-native-amap-geolocation | 1.2.1 |
测试结果如下:
Installing AMapFoundation (1.8.0) Installing AMapLocation (2.9.0) Installing react-native-amap-geolocation (1.2.1)
仍然缺少地图库
Installing AMap3DMap (9.6.0) Installing AMapFoundation (1.8.0) Installing AMapLocation (2.9.0) Installing react-native-amap-geolocation (1.2.1) Installing react-native-amap3d (3.2.3)
可以正常安装两个库。
不确定是否是本仓库以前的包所依赖的 RN 版本导致的。 还需要再进一步去验证
看起来是 RN 升级过后查找原生依赖的策略发生了一些变化,这种事也发生过,现在主要受 react-native.config.js
影响,还有一些隐含的策略,为此我看过,调试过 RN 这部分的源码。但现在过去了这么久,以至于我都忘了为什么要写两个 podspec 才能让 RN 查找到依赖。
https://github.com/qiuxiang/react-native-amap3d/blob/main/react-native-amap3d.podspec https://github.com/qiuxiang/react-native-amap3d/blob/main/lib/ios/react-native-amap3d.podspec
react-native-amap-geolocation 这个项目没有问题是因为 xcodeproj 的存在,这就是其中隐含的查找策略
我现在懒得深究这个问题了,就只保证能兼容最新的 RN
好的大佬,感谢您及时跟进解决,我再研究研究。如果您以后再看到相关文档解释,烦请再在这里贴一下
I could not found the best compatible versions, I have tested below conditions on iOS, the react native version is 0.68.2:
The AMap3DMap will be removed when pod install:
There is no build error in rn but then comes the error when running on iOS:
requireNativeComponent:"AMapView" was not found in the UIManager
Dependency confict when pod install:
Crashed when running: