Skip to content
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

大佬,您好,我调用init方法,安卓会报错,ios是调用成功 #15

Open
dengma0 opened this issue Dec 5, 2020 · 12 comments

Comments

@dengma0
Copy link

dengma0 commented Dec 5, 2020

截屏2020-12-05 下午2 36 05

@jaywcjlove
Copy link
Member

@dengma0 不知道你什么情况,你只能自行调试功能。你是 react-native 版本什么的,可能是多种原因造成的。

@dengma0
Copy link
Author

dengma0 commented Dec 5, 2020

我的谁63.3版本的大佬

@dengma0
Copy link
Author

dengma0 commented Dec 5, 2020

@jaywcjlove

@jaywcjlove
Copy link
Member

@dengma0 你是跑我的实例报这个错误吗?我们还遇到与 定位组件冲突报错。

@dengma0
Copy link
Author

dengma0 commented Dec 5, 2020

是引入了你的react-native-transport-location
在我的安卓app打包运行的时候,调用了init.inti()初始化SDK,就会报这个错了

@jaywcjlove
Copy link
Member

@dengma0 不清楚与他包是否冲突,你要自行实例测试,下面代码是否加入

// 加载 @uiw/react-native-transport-location
TransportLocationUtil.setContext(this);

@dengma0
Copy link
Author

dengma0 commented Dec 5, 2020

您好,我用了你的exmple,init返回 1---> success
但是start()的时候模拟器会有这个错误信息了
截屏2020-12-05 下午5 02 40

@dengma0
Copy link
Author

dengma0 commented Dec 5, 2020

@jaywcjlove

@dengma0
Copy link
Author

dengma0 commented Dec 11, 2020

安卓调用要加在MainActivity.java这个文件里面
截屏2020-12-11 上午9 57 05

@jaywcjlove
Copy link
Member

@dengma0 上面发给你了,再发一下

// 加载 @uiw/react-native-transport-location
import com.uiwjs.react.transport.location.TransportLocationUtil;

// 加载 @uiw/react-native-transport-location
TransportLocationUtil.setContext(this);

@jaywcjlove jaywcjlove pinned this issue Dec 11, 2020
@dengma0
Copy link
Author

dengma0 commented Dec 12, 2020

按照你的这个,回报错,调用start的时候,提示没有Activity,放到MainActivity.java就可以init,start,stop调用没没问题了
@jaywcjlove

@jaywcjlove
Copy link
Member

@dengma0 我这个之前调试没有问题,你的 MainActivity.java 复制给我看看添加什么内容呢?

package com.example;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "example";
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants