qiuxiang / react-native-amap3d

react-native 高德地图组件,使用最新 3D SDK,支持 Android + iOS
https://qiuxiang.github.io/react-native-amap3d/api/
MIT License
1.27k stars 327 forks source link

TypeError: Cannot read property 'initSDK' of null #818

Open liucaptainapp opened 7 months ago

liucaptainapp commented 7 months ago
"react-native": "0.72.6",
"react-native-amap-geolocation": "^1.2.3",
"react-native-amap3d": "^3.2.4",

ios模拟器和真机没问题,但是安卓模拟器会报错

启动项目控制台会警告⚠️

TypeError: Cannot read property 'initSDK' of null
TypeError: Cannot read property 'initSDK' of null

点开地图页面的时候就会报错❌,我猜估计是上一步初始化SDK出问题了

Invariant Violation: requireNativeComponent: "AMapView" was not found in the UIManager.

我在源码中打印AMapSdk为null

import { NativeModules } from "react-native";

const { AMapSdk } = NativeModules;

export function init(apiKey?: string) {
  console.log(AMapSdk) // null
  AMapSdk.initSDK(apiKey);
}

export function getVersion(): Promise<string> {
  return AMapSdk.getVersion();
}

react-native-amap-geolocation也会出现⚠️

TypeError: Cannot read property 'initSDK' of null

安卓打包的时候报着个错

> Task :app:stripReleaseDebugSymbols
Unable to strip the following libraries, packaging them as they are: libAMapSDK_MAP_v9_6_0.so.

> Task :app:checkReleaseDuplicateClasses FAILED

FAILURE: Build failed with an exception.
liucaptainapp commented 7 months ago

我貌似找到问题了 但是需要作者改一下

warn 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.

翻译

包react-innative-amap3d包含无效配置:不允许使用“dependent.platforms.ios.project”。请使用“react native config”命令验证它是否正确链接,并就此与包维护人员联系。

liucaptainapp commented 7 months ago

@qiuxiang 能不能跟新一下 react-native: 0.72.6

shrkh commented 7 months ago

@qiuxiang 能不能跟新一下 "react-native": "0.73.0",
TypeError: Cannot read property 'initSDK' of null

liucaptainapp commented 7 months ago

@qiuxiang 能不能跟新一下 "react-native": "0.73.0", TypeError: Cannot read property 'initSDK' of null 我还以为就我一个人有问题

shrkh commented 7 months ago

@liucaptainapp ,然后你怎么解决得?

liucaptainapp commented 7 months ago

@shrkh 没改 估计只有等作者更新一下了

liucaptainapp commented 7 months ago

安卓打包的时候react-native-amap-geolocation和react-native-amap3d有冲突

shrkh commented 7 months ago

唉,好难哦

shrkh commented 7 months ago

@qiuxiang 作者大佬能不能跟新一下 "react-native": "0.73.1", TypeError: Cannot read property 'initSDK' of null

Jazenx commented 4 months ago

iOS 可以试下加入 arm64 选项,我也是同样问题,现在可以 debug 调试了。

image
wuyuyjin commented 3 months ago

我也遇到了同样的问题,要命啊,我以为是我的问题,用是"react-native": "0.72.6",TypeError: Cannot read property 'initSDK' of null,咋处理啊,各位大佬们

liucaptainapp commented 3 months ago

我也遇到了同样的问题,要命啊,我以为是我的问题,用是"react-native": "0.72.6",TypeError: Cannot read property 'initSDK' of null,咋处理啊,各位大佬们

感觉需要作者修改下配置,我现在用webview凑活用着

wuyuyjin commented 3 months ago

我也遇到同样的问题,要命啊,我还以为是我的问题,用的是"react-native": "0.72.6",TypeError: Cannot read property 'initSDK' of null,处理咋啊,各位大佬我们

需要感觉作者修改下配置,我现在用webview活用着

感谢🙏

LukeGongde commented 3 months ago

@qiuxiang 能不能跟新一下 "react-native": "0.73.0", TypeError: Cannot read property 'initSDK' of null