jmessage-react-plugin
jmessage-react-plugin copied to clipboard
编译出问题了 Task :app:compileDebugJavaWithJavac FAILED
安装没问题. 编译错误:> Task :app:compileDebugJavaWithJavac FAILED
Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/6.2/userguide/command_line_interface.html#sec:command_line_warnings 269 actionable tasks: 30 executed, 239 up-to-date D:\program\migu\android\app\build\generated\rncli\src\main\java\com\facebook\react\PackageList.java:83: ����: ������ JMessageReactPackage�еĹ����� JMessageReactPackageӦ�õ���������; new JMessageReactPackage(false), ^ ��Ҫ: û�в��� �ҵ�: boolean ԭ��: ʵ�ʲ����б�����ʽ�����б����Ȳ�ͬ ע: D:\program\migu\android\app\src\debug\java\com\migua\ReactNativeFlipper.javaʹ�û�����ѹ�ʱ�� API�� ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣 1 ������
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app: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.
-
Get more help at https://help.gradle.org
我也是这个问题,你解决了么
这个问题困扰了一天,最后终于解决了
原因分析:这个问题的出现是因为今年1月份的时候对JMessageReactPackage.java做了一次commit,详细修改可见 https://github.com/jpush/jmessage-react-plugin/commit/4da1a83f5cb1deea91b9ce8e8b3857ebe0049bd0 。这个commit会导致更新后的JMessageReactPackage无法传递参数,因为在new JMessageModule(reactContext, false)中写死为false,用户无法传参,将JMessageReactPackage.java改为之前的版本就是正确的。按照文档走安装最新版本的话,用户100%会遇到这个问题。
解决方案:将node_modules/jmessage-react-plugin/android/src/io/jchat/android/JMessageReactPackage.java修改还原为之前版本,代码如下
package io.jchat.android;
import com.facebook.react.ReactPackage;
import com.facebook.react.bridge.JavaScriptModule;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.uimanager.ViewManager;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class JMessageReactPackage implements ReactPackage {
private boolean mShutdownToast;
public JMessageReactPackage(boolean shutdownToast) {
mShutdownToast = shutdownToast;
}
@Override
public List<NativeModule> createNativeModules(ReactApplicationContext reactContext) {
List<NativeModule> result = new ArrayList<>();
result.add(new JMessageModule(reactContext, mShutdownToast));
return result;
}
public List<Class<? extends JavaScriptModule>> createJSModules() {
return Collections.emptyList();
}
@Override
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
List<ViewManager> viewManagers = new ArrayList<>();
viewManagers.add(new BubbleMsgManager());
return viewManagers;
}
}