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

自动link for安卓好像有点问题 #25

Open
litingjun2015 opened this issue Oct 20, 2016 · 2 comments
Open

自动link for安卓好像有点问题 #25

litingjun2015 opened this issue Oct 20, 2016 · 2 comments

Comments

@litingjun2015
Copy link

自动link返回成功后。

发现下面的步骤还是手动要做,否则报错。

android/app/src/main/java/<你的包名>/MainApplication.java中,public class MainApplication 之前增加:

import cn.reactnative.modules.wx.WeChatPackage;

如果react-native版本 >=0.18.0 在new MainReactPackage()之后增加

,new WeChatPackage()
@tdzl2003
Copy link
Member

特定版本的RN是有这个问题

@ccgitgit
Copy link

android/app/src/main/java/<你的包名>/MainApplication.java中添加如下两行:

...
import cn.reactnative.modules.wx.WeChatPackage; // 在public class MainApplication之前import

public class MainApplication extends Application implements ReactApplication {

private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) {
@OverRide
protected boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}

@Override
protected List<ReactPackage> getPackages() {
  return Arrays.<ReactPackage>asList(
      new WeChatPackage(), // 然后添加这一行
      new MainReactPackage()
  );
}

};

@OverRide
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
}
}

RN0.40 rnpm成功,但以上代码仍需要手改,麻烦确认下,建议改下readme。(引包就报undefined is not an obj)

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

3 participants