-
Notifications
You must be signed in to change notification settings - Fork 332
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to compatible with react-native-amap-geolocation ? #778
Comments
我周末把这两个的高德 sdk 都升级下应该就可以了 |
Thanks buddy |
Thanks author! I had the same problem. |
Waiting to be released online... |
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:
Installing AMapFoundation (1.8.0)
Installing AMapLocation (2.9.0) The AMap3DMap is still not be installed. |
新版本安卓跑失败了,上个版本是成功的。 FAILURE: Build completed with 2 failures. 1: Task failed with an exception.
2: Task failed with an exception.
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. FAILURE: Build completed with 2 failures. 1: Task failed with an exception.
2: Task failed with an exception.
|
ios 确实已经是最新版了:
|
@magic3584 把你的错误提示再发完整点 |
使用下面版本的时候,android 是正常使用的,但是 iOS 是运行时崩溃,参照本 issue 第三种情况。
当 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) 大佬刚更新过后的两个包版本如下
此时 pod install, 完成的依赖安装如下 Installing AMapFoundation (1.8.0)
Installing AMapLocation (2.9.0)
Installing react-native-amap-geolocation (1.2.1) 与前次相比,缺少了 AMap3DMap 和 react-native-amap3d,相当于本仓库的包没有被安装。 |
https://github.com/CocoaPods/Specs/blob/master/Specs/5/f/c/AMap3DMap/9.6.0/AMap3DMap.podspec.json |
发布了个新版本,再试试 |
@jefn76 试试在 android/app/build.gradle 的 dependencies {} 里加入这段: implementation(project(':react-native-amap-geolocation')) {
exclude group: 'com.amap.api', module: 'location'
} |
测试版本如下
有新崩溃 另外大佬,iOS 如果更新最新版本依赖,需要修改以下文件内
to
|
升级 AMap3DMap 到 9.6.0 后,还是同一个方法崩溃。我需要学一下 rn 怎么封装原生组件。 |
我等下用 xcode 看下 |
我试了 example 是没有问题的 |
明天再试试新建的项目 |
谢谢大佬,跑成功了! |
大佬请问 example 怎么跑起来?没找到 iOS 的 project |
在外面 |
报错了,首先是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. This error is located at: |
我还是先改回之前的结构。@jefn76 发了新版本,再试试 |
成功了,完美! |
不对,是原生的错,你先试试提示的操作,重新 pod install,yarn start --reset-cache |
RN 项目和原生耦合太深了,为了排除原生项目配置的问题,我干脆把 example 的原生项目都移除了,构建的时候再 react-native init 一个新的。我只能保证在新项目里能跑起来,其他项目跑不起来大概就是配置问题。 build action 可以作为参考: react-native-amap3d/.github/workflows/build.yml Lines 8 to 19 in f50289b
|
请教这个 action 如何执行? |
这个 action 只测了 android |
准备写下 ios 的 action,可以 fork 下来,自己改,提交了就会运行 |
大佬这两个库的兼容问题还会去查吗?这俩库一般都搭配使用的吧 |
我只能晚上回去再看,公司没有 mac |
现在写下 ios 的 action,估计也能看出一些问题 |
针对两个版本的 react native 0.68.2 和 0.71.2,分别创建新项目使用相同版本的两个库
测试结果如下:
仍然缺少地图库
可以正常安装两个库。 不确定是否是本仓库以前的包所依赖的 RN 版本导致的。 |
看起来是 RN 升级过后查找原生依赖的策略发生了一些变化,这种事也发生过,现在主要受 https://github.com/qiuxiang/react-native-amap3d/blob/main/react-native-amap3d.podspec |
react-native-amap-geolocation 这个项目没有问题是因为 xcodeproj 的存在,这就是其中隐含的查找策略 我现在懒得深究这个问题了,就只保证能兼容最新的 RN |
好的大佬,感谢您及时跟进解决,我再研究研究。如果您以后再看到相关文档解释,烦请再在这里贴一下 |
做个记号,我也遇到了 |
一样,你解决了吗 |
@ziqiya解决了,用的: 在 android/app/build.gradle 的 dependencies {} 里加入这段: |
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:
The text was updated successfully, but these errors were encountered: