首页 > 解决方案 > 任务“:react-native-pjsip:compileReleaseJavaWithJavac”执行失败

问题描述

我正在尝试构建一个从 github 克隆的 react-native 项目。这是 github 项目

之后npm install。我试过了react-native run-android,我得到了这个:

/var/www/html/test/sipsip/react-native-pjsip-app/node_modules/react-native-pjsip/android/src/main/java/com/carusto/ReactNativePjSip/PjSipModulePackage.java:12: error: PjSipModulePackage is not abstract and does not override abstract method createJSModules() in ReactPackage
public class PjSipModulePackage implements ReactPackage {
       ^
/var/www/html/test/sipsip/react-native-pjsip-app/node_modules/react-native-pjsip/android/src/main/java/com/carusto/ReactNativePjSip/PjActions.java:307: error: cannot find symbol
                    value.put(mapKey, map.getArray(mapKey).toArrayList());
                                                          ^
  symbol:   method toArrayList()
  location: interface ReadableArray
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors
:react-native-pjsip:compileReleaseJavaWithJavac FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-pjsip:compileReleaseJavaWithJavac'.
> 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.

BUILD FAILED

Total time: 24.355 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

我尝试了很多解决方案,但没有一个解决了我的问题。你知道如何解决这个问题吗?

附加信息:
react-native 版本:

react-native-cli: 2.0.1
react-native: 0.41.2

标签: react-nativereact-native-android

解决方案


删除 /ios 和 /android 文件夹
然后运行react-native eject


推荐阅读