react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

Problem with Android build - 6.1.4.

Open dsound-zz opened this issue 2 years ago • 5 comments

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

  1. React Native 0.67.5
  2. Gradle 8.0
  3. react-native-pager-view 6.1.4
  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

dsound-zz avatar Mar 08 '23 21:03 dsound-zz

I am also geting same error. does anyone have figured out solution ?

neon010 avatar Mar 11 '23 14:03 neon010

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

neon010 avatar Mar 17 '23 14:03 neon010

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

dsound-zz avatar Mar 17 '23 15:03 dsound-zz

You just need to set kotlinVersion in your project level build.gradle in the ext section

Like this:

WhatsApp Image 2023-11-28 at 11 30 25 PM

arjuntsaji avatar Nov 28 '23 18:11 arjuntsaji

same issue

Mohamed-Raid avatar Dec 13 '23 10:12 Mohamed-Raid