Problem with Android build - 6.1.4.
React Native Android on Windows 11
When trying to run react-native android, I get a build error referring to an issue with Kotlin compileSdkVersion. The error looks like this:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* Where:
Build file 'C:\Users\dsims\projects\ocr-mobile2\node_modules\react-native-pager-view\android\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating project ':react-native-pager-view'.
> Could not initialize class org.jetbrains.kotlin.gradle.plugin.sources.DefaultKotlinSourceSetKt
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
A problem occurred configuring project ':react-native-pager-view'.
> compileSdkVersion is not specified. Please add it to build.gradle
* 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 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 17s
Reproducible Demo
- React Native 0.67.5
- Gradle 8.0
- react-native-pager-view 6.1.4
- current Kotlin in Android Studio: 221-1.8.0-release-for-android-studio-AS5591.52
runnpx react-native androidor in android folder, run ./gradlew clean or ./gradlew build
I am also geting same error. does anyone have figured out solution ?
I solved this issue by switching the version of react-native-pager-view to 6.0.1. This build crashing is only happening in lattest version
I actually fixed this by deleted the android cache folder and restarted. Not sure why this was causing an issue.
C:\Users<user>.android\cache
You just need to set kotlinVersion in your project level build.gradle in the ext section
Like this:
same issue