报错信息:
> Task :react-native-charts-wrapper:compileDebugJavaWithJavac FAILED
D:\P\app\node_modules\react-native-charts-wrapper\android\src\main\java\com\github\wuxudong\rncharts\listener\RNOnChartGestureListener.java:3: 错误: 程序包android.support.annotation不存在
import android.support.annotation.NonNull;
^
D:\P\app\node_modules\react-native-charts-wrapper\android\src\main\java\com\github\wuxudong\rncharts\listener\RNOnChartGestureListener.java:93: 错误: 找不到符号
@NonNull
^
符号: 类 NonNull
位置: 类 RNOnChartGestureListener
注: D:\P\app\node_modules\react-native-charts-wrapper\android\src\main\java\com\github\wuxudong\rncharts\charts\CustomFormatter.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
注: 某些输入文件使用了未经检查或不安全的操作。
注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
2 个错误
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ‘:react-native-charts-wrapper: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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use ‘–warning-mode all’ to show the individual deprecation warnings.
See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings
解决方案
出现这个问题还是因为androidx的问题,所以把RNOnChartGestureListener.java中出现NonNull的删除掉就可以了,具体说明一下删除RNOnChartGestureListener.java第3行以及93行代码即可