Hector-Chong / native-wechat

A React Native library for supporting Wechat APIs on Android and iOS
https://native-wechat.hector.im
MIT License
133 stars 11 forks source link

Android build failed #4

Closed rickychan0611 closed 1 year ago

rickychan0611 commented 1 year ago

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.

2: Task failed with an exception.

rickychan0611 commented 1 year ago

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?

}