react-native-camera-kit
react-native-camera-kit copied to clipboard
compileSdkVersion is not specified
Describe the bug Task failed with an exception.
- What went wrong: A problem occurred configuring project ':react-native-camera-kit'.
com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
Additional context I created a brand new project and it was running fine in both emulator and real device but then I installed react-native-camera-kit and I started getting this error
It's been a while since you asked and I hope you found the solution in the meantime. For everyone else, this might help:
- Open <your_react_native_root_folder>/android/build.gradle
- Find
buildscript
- Find
ext
within "buildscript" - Add
compileSdkVersion = 33
neartargetSdkVersion = 33
- Save your file and rebuild
Just for other people who may run into the issue as I have: Even if you have the compileSdkVersion
in your buildscript.ext
config, you may still get this (in this case misleading) error if you have not properly set up Kotlin yet.
@DysphoricUnicorn can you describe what you mean about not properly set up Kotlin?
I figured it out. I finally noticed this in the build error:
> Plugin with id 'kotlin-android' not found.
add these lines to set up kotlin (i used this guide):
// android/build.gradle
buildscript {
ext {
// other stuff
kotlin_version = "1.6.21" // add this
// other stuff
}
// other stuff
dependencies {
// other stuff
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
and then:
// android/app/build.gradle
apply plugin: "com.android.application"
apply plugin: "kotlin-android" // add this to the top
For react-native
version 0.71.2
I also needed to change minSdkVersion
:
// android/build.gradle
buildscript {
ext {
// ...
// required to be at least 23 by react-native-camera-kit
minSdkVersion = 23
}
}
Both compileSdkVersion
(31) and minSdkVersion
(23) are defined already. Closing for now unless someone can reproduce on a more recent v14 beta build.