react-native-picker / picker

Picker is a cross-platform UI component for selecting an item from a list of options.
MIT License
1.49k stars 280 forks source link

Android build errors. Should extend AppCompatTextView instead of AppCompatCustomView #295

Open PhilipBrew opened 3 years ago

PhilipBrew commented 3 years ago

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

atouiahmed commented 3 years ago

hello same issue , any solution here?

PhilipBrew commented 3 years ago

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

crrobinson14 commented 3 years ago

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.

PhilipBrew commented 3 years ago

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

ekrivenja-sequenex commented 10 months ago

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