sensorsdata/sa-sdk-android

sensor报错,导致安卓无法运行RN项目

Closed this issue · 3 comments

执行 yarn android,期望安装app到设备上,但一直失败。

红色报错信息如下

> Task :sensorsdata-analytics-react-native:compileDebugJavaWithJavac FAILED
 
 ...
 
 FAILURE: Build failed with an exception.
 
 * What went wrong:
 Execution failed for task ':sensorsdata-analytics-react-native:compileDebugJavaWithJavac'.
 > Compilation failed; see the compiler error output for details.

package.json

"sensorsdata-analytics-react-native": "2.1.0",

@wustzhy 你好,你这边能提供更多的日志吗?或者是否有 Demo 提供一下呢?

@wustzhy 你好,你这边能提供更多的日志吗?或者是否有 Demo 提供一下呢?

执行yarn成功后,执行yarn android,日志如下

(base)  ~/Desktop/gitfiles/StartPineapple  ➦ 91f33644  yarn android              
yarn run v1.22.10
warning ../../../package.json: No license field
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1562 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...

> Configure project :app
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
===> building appVersion:2.1.1 with versionCode:150
===> Env in package.json Config:【development】
===> Env in package.json appStoreBuild:【false】
===> Matched buildEnv:[umengKey:5f51f8533739314483bbf93e, hostAddress:https://livereminder-dev.deepleaper.com, dataChannel:development, enableChannel:false] --- key:development --- appStoreBuild:false
WARNING: DSL element 'android.viewBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.viewBinding'.
It will be removed in version 5.0 of the Android Gradle plugin.
===> output channel builds path: /Users/yestinzhao/Desktop/gitfiles/StartPineapple/android/app/build/outputs/channels
===> Name:Kaiboluo_2.1.1_202110292030_debug.apk
===> parent:[/Users/yestinzhao/Desktop/gitfiles/StartPineapple/android/app/build/outputs/apk/debug]
===> Name:Kaiboluo_2.1.1_202110292030_release.apk
===> parent:[/Users/yestinzhao/Desktop/gitfiles/StartPineapple/android/app/build/outputs/apk/release]

> Task :react-native-update:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: librnupdate.so.

> Task :sensorsdata-analytics-react-native:compileDebugJavaWithJavac FAILED

> Task :image-selector:compileDebugJavaWithJavac

> Task :react-native-webview:compileDebugJavaWithJavac

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.5/userguide/command_line_interface.html#sec:command_line_warnings
541 actionable tasks: 142 executed, 399 up-to-date
/Users/yestinzhao/Desktop/gitfiles/StartPineapple/node_modules/sensorsdata-analytics-react-native/android/src/main/java/com/sensorsdata/analytics/RNSensorsAnalyticsModule.java:147: 错误: 找不到符号
            SensorsDataAPI.sharedInstance().trackTimerBegin(eventName);
                                           ^
  符号:   方法 trackTimerBegin(String)
  位置: 类 SensorsDataAPI
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
1 个错误
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /Users/yestinzhao/Desktop/gitfiles/StartPineapple/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sensorsdata-analytics-react-native: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 13s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/yestinzhao/Desktop/gitfiles/StartPineapple/node_modules/sensorsdata-analytics-react-native/android/src/main/java/com/sensorsdata/analytics/RNSensorsAnalyticsModule.java:147: 错误: 找不到符号
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@wustzhy 你好,你这边能提供更多的日志吗?或者是否有 Demo 提供一下呢?

执行yarn成功后,执行yarn android,日志如下

(base)  ~/Desktop/gitfiles/StartPineapple  ➦ 91f33644  yarn android              
yarn run v1.22.10
warning ../../../package.json: No license field
$ react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1562 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...

> Configure project :app
WARNING: The option setting 'android.enableR8=false' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
Warning: The 'kotlin-android-extensions' Gradle plugin is deprecated. Please use this migration guide (https://goo.gle/kotlin-android-extensions-deprecation) to start working with View Binding (https://developer.android.com/topic/libraries/view-binding) and the 'kotlin-parcelize' plugin.
===> building appVersion:2.1.1 with versionCode:150
===> Env in package.json Config:【development】
===> Env in package.json appStoreBuild:【false】
===> Matched buildEnv:[umengKey:5f51f8533739314483bbf93e, hostAddress:https://livereminder-dev.deepleaper.com, dataChannel:development, enableChannel:false] --- key:development --- appStoreBuild:false
WARNING: DSL element 'android.viewBinding.enabled' is obsolete and has been replaced with 'android.buildFeatures.viewBinding'.
It will be removed in version 5.0 of the Android Gradle plugin.
===> output channel builds path: /Users/yestinzhao/Desktop/gitfiles/StartPineapple/android/app/build/outputs/channels
===> Name:Kaiboluo_2.1.1_202110292030_debug.apk
===> parent:[/Users/yestinzhao/Desktop/gitfiles/StartPineapple/android/app/build/outputs/apk/debug]
===> Name:Kaiboluo_2.1.1_202110292030_release.apk
===> parent:[/Users/yestinzhao/Desktop/gitfiles/StartPineapple/android/app/build/outputs/apk/release]

> Task :react-native-update:stripDebugDebugSymbols
Unable to strip the following libraries, packaging them as they are: librnupdate.so.

> Task :sensorsdata-analytics-react-native:compileDebugJavaWithJavac FAILED

> Task :image-selector:compileDebugJavaWithJavac

> Task :react-native-webview:compileDebugJavaWithJavac

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.5/userguide/command_line_interface.html#sec:command_line_warnings
541 actionable tasks: 142 executed, 399 up-to-date
/Users/yestinzhao/Desktop/gitfiles/StartPineapple/node_modules/sensorsdata-analytics-react-native/android/src/main/java/com/sensorsdata/analytics/RNSensorsAnalyticsModule.java:147: 错误: 找不到符号
            SensorsDataAPI.sharedInstance().trackTimerBegin(eventName);
                                           ^
  符号:   方法 trackTimerBegin(String)
  位置: 类 SensorsDataAPI
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
1 个错误
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: /Users/yestinzhao/Desktop/gitfiles/StartPineapple/node_modules/react-native-webview/android/src/main/java/com/reactnativecommunity/webview/RNCWebViewManager.java使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':sensorsdata-analytics-react-native: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 13s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/yestinzhao/Desktop/gitfiles/StartPineapple/node_modules/sensorsdata-analytics-react-native/android/src/main/java/com/sensorsdata/analytics/RNSensorsAnalyticsModule.java:147: 错误: 找不到符号
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

您好,Andorid SDK 升级,造成 RN 调用的方法不存在,麻烦您升级到 2.2.0 版本