error: cannot find symbol method registerActivityLifecycle(MainApplication)

标签: #<Tag:0x00007f657f314c28>

插件版本:
“dependencies”: {
“jcore-react-native”: “^1.3.7”,
“jpush-react-native”: “^2.5.9”,
“react”: “16.8.6”,
“react-native”: “0.60.5”
},

最新版本的example无法运行,报错提示同标题

你是如何调用的,是否有修改了 example 里面的调用

说明下你的操作步骤,开启 debug 给出详细的日志

git clone https://github.com/jpush/jpush-react-native.git

在命令行中cd jpush-react-native/example,执行npm install, 运行example:react-native run-android

没有修改任何example内的代码,并且在开发项目中使用同样配置,产生相同的报错

Debug Log:


* 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

BUILD FAILED in 25s

error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/yzhou/code/react_native/jpush-react-native/example/android/app/src/main/java/com/epass_app/MainApplication.java:48: error: cannot find symbol
    JPushModule.registerActivityLifecycle(this);
               ^
  symbol:   method registerActivityLifecycle(MainApplication)
  location: class JPushModule
1 error

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

BUILD FAILED in 25s

    at checkExecSyncError (child_process.js:611:11)
    at execFileSync (child_process.js:629:13)
    at runOnAllDevices (/Users/yzhou/code/react_native/jpush-react-native/example/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
    at buildAndRun (/Users/yzhou/code/react_native/jpush-react-native/example/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
    at then.result (/Users/yzhou/code/react_native/jpush-react-native/example/node_modules/@react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)```

日志里有这句话:
error Failed to install the app. Make sure you have the Android development environment
先确认下本地android开发环境是不是正常的

用GitHub上一个example版本可以运行,但是会有点击通知无法唤醒app的问题,这两个问题在GitHub的issue里都有提到,但是没有人给出解答。

用哪一个 example 可以运行?

点击通知无法唤醒 App 的问题参考