Hector-Chong / native-wechat

A React Native library for supporting Wechat APIs on Android and iOS

Home Page:https://native-wechat.hector.im

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android build failed

rickychan0611 opened this issue · comments

Hi, I was trying to run npx react-native run-android, but it failed. Could you help? Thank you so much.

BUILD FAILED in 7s

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.bat app:installDebug -PreactNativeDevServerPort=8081
G:\peaceful-channel-app\RN0710RC3\node_modules\native-wechat\android\src\main\java\com\hector\nativewechat\NativeWechatModuleImpl.java:94: error: cannot find symbol
wxApi = WXAPIFactory.createWXAPI(reactContext, id, true);
^
symbol: variable id
location: class NativeWechatModuleImpl
G:\peaceful-channel-app\RN0710RC3\node_modules\native-wechat\android\src\main\java\com\hector\nativewechat\NativeWechatModuleImpl.java:95: error: cannot find symbol
wxApi.registerApp(id);
^
symbol: variable id
location: class NativeWechatModuleImpl
Note: G:\peaceful-channel-app\RN0710RC3\node_modules\native-wechat\android\src\main\java\com\hector\nativewechat\NativeWechatModuleImpl.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':native-wechat:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • 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.
==============================================================================

2: Task failed with an exception.

  • 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.
==============================================================================

NativeWechatModule.java in newarch may have problem
@ReactMethod
public void registerApp(ReadableMap request) {
moduleImpl.registerApp(id); // id <= request?
}

NativeWechatModuleImpl.java
public void registerApp(ReadableMap request) {
appid = request.getString("appid");
registered = true;

wxApi = WXAPIFactory.createWXAPI(reactContext, id, true); //id <= appid?
wxApi.registerApp(id); // id <= appid?

}