picker
picker copied to clipboard
Android build errors. Should extend AppCompatTextView instead of AppCompatCustomView
I've updated Gradle build tools and now getting build errors from this package. Errors are:
Caused by: org.gradle.api.GradleException: Lint found errors in the project; aborting build. Fix the issues identified by lint, or add the following to your build script to proceed with errors: ... android { lintOptions { abortOnError false } } ... Errors found: /node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/CheckedTextViewImpl.java:7: Error: This custom view should extend android.support.v7.widget.AppCompatCheckedTextView instead [AppCompatCustomView] public class CheckedTextViewImpl extends CheckedTextView { ~~~~~~~~~~~~~~~ /node_modules/@react-native-picker/picker/android/src/main/java/com/reactnativecommunity/picker/TextViewImpl.java:7: Error: This custom view should extend android.support.v7.widget.AppCompatTextView instead [AppCompatCustomView] public class TextViewImpl extends TextView {
Gradle: 6.7 Gradle Enterprise plugin: 3.4.1 Android Gradle plugin: 3.5.4
Looks like we need to either turn off linting errors or fix the deprecated issues.
Steps to replicate
- Create a react native app
- In android/build.gradle add/change:
buildscript { dependencies: { classpath("com.android.tools.build:gradle:3.5.4") } } - build android
cd android && ./gradlew build
See full build scan here: https://scans.gradle.com/s/dpoqnuxgxniwc
hello same issue , any solution here?
hello same issue , any solution here?
Hi, no official solution so far. I've ended up forking the module and disabling linting errors by editing /android/build.gradle and adding in android { lintOptions { abortOnError false } }
Encountered this today as well. There is an Android build trick to disable lintOptions in third party plugins that seems to be working for me. In android/build.gradle add this to the bottom of your allProjects {...} block:
afterEvaluate {
if (getPlugins().hasPlugin('android') || getPlugins().hasPlugin('android-library')) {
configure(android.lintOptions) {
abortOnError false
checkReleaseBuilds false
}
}
}
This is not a fix, but allows the build to proceed without having to fork the module and edit it.
@crrobinson14 I just implemented this also and my build is working. Thanks for sharing the trick so I don't need to use my forked module.
Like you say it's not a fix so will keep this issue open but at least I can build the app while using this package :)
Lint check disable is not a solution, the issue should be addressed.
Instead of disable lint check for all libraries in the project, I prefer to disable it only for react-native-picker
afterEvaluate { project ->
if (project.name == 'react-native-picker_picker') {
project.configure(android.lintOptions) {
abortOnError false
checkReleaseBuilds false
}
}
}