picker icon indicating copy to clipboard operation
picker copied to clipboard

Android build errors. Should extend AppCompatTextView instead of AppCompatCustomView

Open PhilipBrew opened this issue 4 years ago • 5 comments

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

  1. Create a react native app
  2. In android/build.gradle add/change: buildscript { dependencies: { classpath("com.android.tools.build:gradle:3.5.4") } }
  3. build android cd android && ./gradlew build

See full build scan here: https://scans.gradle.com/s/dpoqnuxgxniwc

PhilipBrew avatar Jul 12 '21 09:07 PhilipBrew

hello same issue , any solution here?

atouiahmed avatar Aug 08 '21 14:08 atouiahmed

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 } }

PhilipBrew avatar Aug 09 '21 08:08 PhilipBrew

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 avatar Aug 10 '21 14:08 crrobinson14

@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 :)

PhilipBrew avatar Aug 11 '21 10:08 PhilipBrew

Lint check disable is not a solution, the issue should be addressed.

ekrivenja-sequenex avatar Nov 16 '23 10:11 ekrivenja-sequenex

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
        }
    }
}

ekrivenja-sequenex avatar Feb 27 '25 15:02 ekrivenja-sequenex