react-native-camera-kit
react-native-camera-kit copied to clipboard
Error when running react-native run-anroid
Describe the bug when i was add this i got an error when running android
Add Kotlin Support for Android
- Open and edit android/build.gradle
Add the kotlin_version
to buildscript.ext
buildscript {
ext {
...
kotlin_version = '1.5.10'
}
Add google()
to the buildscript.repositories
and allprojects.repositories
buildscript {
repositories {
...
google()
}
}
allprojects {
repositories {
...
google()
}
}
Add the Kotlin classpath to buildscript.dependencies
dependencies {
...
classpath("com.android.tools.build:gradle:7.0.2") // or recent
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
}
- Open and edit android/app/build.gradle
Add Kotlin imports
apply plugin: "kotlin-android"
apply plugin: "kotlin-android-extensions"
To Reproduce Steps to reproduce the behavior:
- Add prop
someProp="someValue"
- call
cameraRef.current.capture()
- See error in console
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If the issue is a visual glitch or UI issue please provide screen shots.
Desktop (please complete the following information):
- OS: [Windows 10]
- Browser [e.g. chrome]
- Version [e.g. 22]
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
Additional context Add any other context about the problem here.
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
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.3.3/userguide/command_line_interface.html#sec:command_line_warnings
23 actionable tasks: 17 executed, 6 up-to-date
Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This
can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
C:\Users\user01\Documents\Absensi-Apps\Scan\android\app\src\debug\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:react-native-camera-kit] C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\react-native-camera-kit\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 23,
or use tools:overrideLibrary="com.rncamerakit" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:processDebugMainManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:react-native-camera-kit] C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\react-native-camera-kit\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 23, or use tools:overrideLibrary="com.rncamerakit" to force usage (may lead to runtime failures)
- 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
BUILD FAILED in 32s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Warning: This version only understands SDK XML versions up to 2 but an SDK XML file of version 3 was encountered. This
can happen if you use versions of Android Studio and the command-line tools that were released at different times.
Warning: unexpected element (uri:"", local:"base-extension"). Expected elements are <{}codename>,<{}layoutlib>,<{}api-level>
C:\Users\user01\Documents\Absensi-Apps\Scan\android\app\src\debug\AndroidManifest.xml Error:
uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:react-native-camera-kit] C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\react-native-camera-kit\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 23,
or use tools:overrideLibrary="com.rncamerakit" to force usage (may lead to runtime failures)
FAILURE: Build failed with an exception.
- What went wrong: Execution failed for task ':app:processDebugMainManifest'.
Manifest merger failed : uses-sdk:minSdkVersion 21 cannot be smaller than version 23 declared in library [:react-native-camera-kit] C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\react-native-camera-kit\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 23, or use tools:overrideLibrary="com.rncamerakit" to force usage (may lead to runtime failures)
- 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
BUILD FAILED in 32s
at makeError (C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\execa\index.js:174:9)
at C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\user01\Documents\Absensi-Apps\Scan\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details. error Command failed with exit code 1.
Please change the min sdk version in the build.gradle file in project level to 23 and kindly change the kotlin version to the latest or "1.6.0".