callstack / react-native-pager-view

React Native wrapper for the Android ViewPager and iOS UIPageViewController.
MIT License
2.74k stars 419 forks source link

Problem with Android build - 6.1.4. #697

Open dsound-zz opened 1 year ago

dsound-zz commented 1 year ago

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

neon010 commented 1 year ago

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

neon010 commented 1 year ago

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

dsound-zz commented 1 year ago

I actually fixed this by deleted the android cache folder and restarted. Not sure why this was causing an issue.

C:\Users\.android\cache

arjuntsaji commented 11 months ago

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

Mohamed-Raid commented 11 months ago

same issue