Android build failed : Task :@react-native-community_slider:compileDebugJavaWithJavac FAILED
See original GitHub issueEnvironment Android only
info React Native Environment Info: System: OS: macOS High Sierra 10.13.6 CPU: (4) x64 Intel® Core™ i7-2640M CPU @ 2.80GHz Memory: 568.49 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.11.3 - /usr/local/bin/node Yarn: 1.9.4 - /usr/local/bin/yarn npm: 5.6.0 - /usr/local/bin/npm SDKs: iOS SDK: Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3 Android SDK: API Levels: 23, 25, 26, 27, 28 Build Tools: 23.0.1, 23.0.2, 23.0.3, 25.0.3, 26.0.2, 26.0.3, 27.0.3, 28.0.2, 28.0.3 System Images: android-23 | Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom_64, android-24 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom_64, android-28 | Android TV Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom_64 IDEs: Android Studio: 3.1 AI-173.4907809 Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild npmPackages: react: 16.8.3 => 16.8.3 react-native: 0.59.9 => 0.59.9 npmGlobalPackages: react-native-cli: 2.0.1 react-native-git-upgrade: 0.2.7
Description
Android Build faild if run react-native run-android
.Also change react-native-slider version v1.1.3 ,v1.1.2 and v1.1.1
build error Error
Configure project :react-native-webview WARNING: The following project options are deprecated and have been removed: android.enableAapt2 This property has no effect, AAPT2 is now always used.
:react-native-webview:reactNativeAndroidRoot /Users/apple/Desktop/development/app/64bit/node_modules/react-native/android
Task :@react-native-community_slider:compileDebugJavaWithJavac FAILED /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:11: error: package android.support.v7.widget does not exist import android.support.v7.widget.AppCompatSeekBar; ^ /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:23: error: cannot find symbol public class ReactSlider extends AppCompatSeekBar { ^ symbol: class AppCompatSeekBar /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:60: error: cannot find symbol super.setStateListAnimator(null); ^ symbol: variable super location: class ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:88: error: cannot find symbol if (seekBarProgress == getMax()) { ^ symbol: method getMax() location: class ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:99: error: cannot find symbol setMax(getTotalSteps()); ^ symbol: method setMax(int) location: class ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java:105: error: cannot find symbol setProgress((int) Math.round((mValue - mMinValue) / (mMaxValue - mMinValue) * getTotalSteps())); ^ symbol: method setProgress(int) location: class ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:37: error: type argument ReactSlider is not within bounds of type-variable T public class ReactSliderManager extends SimpleViewManager<ReactSlider> { ^ where T is a type-variable: T extends View declared in class SimpleViewManager /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:66: error: incompatible types: ReactSlider cannot be converted to SeekBar SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE); ^ /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:88: error: incompatible types: SeekBar cannot be converted to ReactSlider ((ReactSlider) seekbar).toRealProgress(progress), ^ /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:98: error: incompatible types: SeekBar cannot be converted to ReactSlider ((ReactSlider) seekbar).toRealProgress(seekbar.getProgress()))); ^ /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:107: error: incompatible types: SeekBar cannot be converted to ReactSlider ((ReactSlider) seekbar).toRealProgress(seekbar.getProgress()))); ^ /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:133: error: cannot find symbol view.setEnabled(enabled); ^ symbol: method setEnabled(boolean) location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:138: error: cannot find symbol view.setOnSeekBarChangeListener(null); ^ symbol: method setOnSeekBarChangeListener(<null>) location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:140: error: cannot find symbol view.setOnSeekBarChangeListener(ON_CHANGE_LISTENER); ^ symbol: method setOnSeekBarChangeListener(OnSeekBarChangeListener) location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:161: error: cannot find symbol view.getThumb().clearColorFilter(); ^ symbol: method getThumb() location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:163: error: cannot find symbol view.getThumb().setColorFilter(color, PorterDuff.Mode.SRC_IN); ^ symbol: method getThumb() location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:169: error: cannot find symbol LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent(); ^ symbol: method getProgressDrawable() location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:180: error: cannot find symbol LayerDrawable drawable = (LayerDrawable) view.getProgressDrawable().getCurrent(); ^ symbol: method getProgressDrawable() location: variable view of type ReactSlider /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java:191: error: cannot find symbol view.setOnSeekBarChangeListener(ON_CHANGE_LISTENER); ^ symbol: method setOnSeekBarChangeListener(OnSeekBarChangeListener) location: variable view of type ReactSlider Note: /Users/apple/Desktop/development/app/64bit/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 19 errors
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ‘:@react-native-community_slider: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.4.1/userguide/command_line_interface.html#sec:command_line_warnings
Reproducible Demo
yarn add @react-native-community/slider
react-native link @react-native-community/slider
react-native run-android
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:19 (1 by maintainers)
@Kiran0791 , I fixed this issue by changing code in node_module.
steps: 1- Open
node_modules/@react-native-community/slider/android/build.gradle
2- change api “androidx.appcompat:appcompat:${rootProject.ext.supportLibVersion}” to
api "androidx.appcompat:appcompat:1.0.2"
3- Open
node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSlider.java
4- change import android.support.v7.widget.AppCompatSeekBar; to
import androidx.appcompat.widget.AppCompatSeekBar;
i was having a similar issue with a different package:
This fixed it for me and I suspect it might help anyone running into this issue as well: