teslamotors / react-native-camera-kit

A high performance, easy to use, rock solid camera library for React Native apps.
MIT License
2.48k stars 588 forks source link

Build fails because of kotlin_version #511

Open raminafandi opened 1 year ago

raminafandi commented 1 year ago

When I am building an android apk, build fails with this exception:

FAILURE: Build failed with an exception.

Version: "react-native": "0.70.6",

dj9aj commented 1 year ago

I believe you need to define kotlin_version within your android/build.gradle. For example -

buildscript {
  ext {
        ...
        kotlin_version = '1.5.10'
 }
yousrasd commented 1 year ago

You need to follow this to complete the setup for Android: https://github.com/teslamotors/react-native-camera-kit/blob/master/docs/kotlin.md.

nzcodarnoc commented 1 year ago

My setup is using React Native 0.71 which comes with Kotlin enabled.

To resolve the error message reported, I added the following in android/build.gradle

kotlinVersion = '1.7.10' // camelCase, this is the existing variable name
kotlin_version = '1.7.10' // react-native-camera-kit looks for this snake_case variable name
aemonge commented 1 month ago

The issue with the marked, solution is that it wouldn't work for expo. Does any have a solution that would be expo compatible too?

shoaibarifArgonTech commented 1 month ago

update your android/build.gradle file like this ext { ... kotlinVersion = "1.9.24" kotlin_version = "1.9.24"// for react-native-camera-kit` ... }

aemonge commented 1 month ago

But shouldn't we leave the android/build.gradle untouched in order for expo to work properly?

Expo should handle builds, so I want to avoid adding custom code in there.

Locally, that works. To build remotely, using expo, is where it stops to work.

adammcarth commented 2 weeks ago

My setup is using React Native 0.71 which comes with Kotlin enabled.

To resolve the error message reported, I added the following in android/build.gradle

kotlinVersion = '1.7.10' // camelCase, this is the existing variable name
kotlin_version = '1.7.10' // react-native-camera-kit looks for this snake_case variable name

This worked for me - React Native 0.73.9 (not using Expo). Or even better, reference with the original variable:

// android/build.gradle
buildscript {
  ext {
    kotlinVersion = "x.x.x"
    kotlin_version = kotlinVersion // For react-native-camera-kit
  }
}