yutasuzuki / react-native-record-screen

react-native-record-screen
MIT License
149 stars 40 forks source link

Hardcoded kotlin version makes is impossible to build for android on expo and latest react native. #106

Open skjortan23 opened 1 year ago

skjortan23 commented 1 year ago

When trying to build for android using EAS build from expo this error happens.

This is most likely to a hardcoded version of kotlin...

FAILURE: Build failed with an exception.

* What went wrong:
The Android Gradle plugin supports only Kotlin Gradle plugin version 1.5.20 and higher.
The following dependencies do not satisfy the required version:
project ':react-native-record-screen' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.50

Any ideas on how to work around this build error would be appreciated.

Thanks for a great tool and package.

dprajapati1179 commented 1 year ago

Facing the same issue

Hamzadaboussi commented 1 year ago

To resolve the issue in the /node_modules/react-native-record-screen/android/build.gradle file, you can try the following:

Look for the line that says:

----> classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

Replace that line with the following, where you specify your desired Kotlin Gradle version (for me 1.5.20):

----> classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20"

Save the file.

"Please note that modifying files in the node_modules directory is generally not recommended, as these files are typically managed by package managers. It's important to understand the implications of making such changes and ensure that they are necessary for your specific situation"

dprajapati1179 commented 1 year ago

Hey, I already tried the same before adding comment but it is not working gives following errors.

Task :app:processDebugMainManifest FAILED /Users/dineshprajapati/Desktop/Projects/gitlab/pods-rn71-app/android/app/src/main/AndroidManifest.xml:8:5-84 Warning: Element uses-permission#android.permission.HIGH_SAMPLING_RATE_SENSORS at AndroidManifest.xml:8:5-84 duplicated with element declared at AndroidManifest.xml:7:5-84 /Users/dineshprajapati/Desktop/Projects/gitlab/pods-rn71-app/android/app/src/debug/AndroidManifest.xml Error: uses-sdk:minSdkVersion 21 cannot be smaller than version 26 declared in library [:react-native-record-screen] /Users/dineshprajapati/Desktop/Projects/gitlab/pods-rn71-app/node_modules/react-native-record-screen/android/build/intermediates/merged_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 21 Suggestion: use a compatible library with a minSdk of at most 21, or increase this project's minSdk version to at least 26, or use tools:overrideLibrary="com.reactnativerecordscreen" to force usage (may lead to runtime failures)

See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.

yutasuzuki commented 1 year ago

Updated Kotlin version to 1.7.0 in v0.6.0. Please confirm it.