74 lines
4.8 KiB
Plaintext
Raw Normal View History

---
id: troubleshooting
title: Troubleshooting
sidebar_label: Troubleshooting
---
2021-03-04 17:02:14 +01:00
import useBaseUrl from '@docusaurus/useBaseUrl';
<div>
<img align="right" width="283" src={useBaseUrl("img/11_back.png")} />
</div>
2021-02-19 17:10:32 +01:00
Before opening an issue, make sure you try the following:
2021-02-19 17:12:57 +01:00
## iOS
2021-02-19 17:10:32 +01:00
1. Try cleaning and rebuilding **everything**:
```sh
2021-07-08 12:05:29 +02:00
rm -rf package-lock.json && rm -rf yarn.lock && rm -rf node_modules
rm -rf ios/Podfile.lock && rm -rf ios/Pods
2021-02-19 17:10:32 +01:00
npm i # or "yarn"
cd ios && pod repo update && pod update && pod install
```
2. Check your minimum iOS version. VisionCamera requires a minimum iOS version of **11.0**.
1. Open your `Podfile`
2. Make sure `platform :ios` is set to `11.0` or higher
3. Make sure `iOS Deployment Target` is set to `11.0` or higher (`IPHONEOS_DEPLOYMENT_TARGET` in `project.pbxproj`)
3. Check your Swift version. VisionCamera requires a minimum Swift version of **5.2**.
1. Open `project.pbxproj` in a Text Editor
2. If the `LIBRARY_SEARCH_PATH` value is set, make sure there is no explicit reference to Swift-5.0. If there is, remove it. See [this StackOverflow answer](https://stackoverflow.com/a/66281846/1123156).
3. If the `SWIFT_VERSION` value is set, make sure it is set to `5.2` or higher.
2021-02-19 17:10:32 +01:00
4. Make sure you have created a Swift bridging header in your project.
1. Open your project (`.xcworkspace`) in Xcode
2. Press **File** > **New** > **File** (<kbd>⌘</kbd>+<kbd>N</kbd>)
3. Select **Swift File** and press **Next**
4. Choose whatever name you want, e.g. `File.swift` and press **Create**
2021-02-24 22:30:00 +01:00
5. Press **Create Bridging Header** when promted.
2021-03-29 17:23:24 +02:00
5. If you're having runtime issues, check the logs in Xcode to find out more. In Xcode, go to **View** > **Debug Area** > **Activate Console** (<kbd>⇧</kbd>+<kbd>⌘</kbd>+<kbd>C</kbd>).
fix: Move Audio Input initialization shortly before `startRecording` (#159) * rename * Update AVAudioSession+updateCategory.swift * fix bootstrap script * Update CameraView+AVAudioSession.swift * move audio input adding lower * Activate AudioSession only when starting recording * format * Deactivate Audio Session * remove audio input before deactivating audio session * Update CameraView+AVAudioSession.swift * log time * Update CameraView+AVAudioSession.swift * measure time with `measureElapsedTime` * Update project.pbxproj * only log in debug builds * bootstrap with bridge (RNN new API) * Mark two funcs as `@inlinable` * format * Update ReactLogger.swift * Make audioWriter optional (allow videos without sound) * only log frame drop reason in DEBUG * Make audio writing entirely optional * format * Use function name as label for measureElapsedTime * Update MeasureElapsedTime.swift * Update MeasureElapsedTime.swift * Mark AudioWriter as finished * set `automaticallyConfiguresApplicationAudioSession` once * Add JS console logging * log to JS console for a few logs * Update AVAudioSession+updateCategory.swift * format * Update JSConsoleHelper.mm * catch log errors * Update ReactLogger.swift * fix docs * Update RecordingSession.swift * Immediatelly add audio input * Update CameraView+AVCaptureSession.swift * Update CameraView+AVCaptureSession.swift * Update ReactLogger.swift * immediatelly set audio session * extract * format * Update TROUBLESHOOTING.mdx * hmm * Update AVAudioSession+updateCategory.swift * Create secondary `AVCaptureSession` for audio * Configure once, start stop on demand * format * fix audio notification interruptions * docs
2021-06-03 14:16:02 +02:00
* For errors without messages, there's often an error code attached. Look up the error code on [osstatus.com](https://www.osstatus.com) to get more information about a specific error.
6. If your Frame Processor is not running, make sure you check the native Xcode logs to find out why. Also make sure you are not using a remote JS debugger such as Google Chrome, since those don't work with JSI.
2021-02-19 17:12:57 +01:00
## Android
2021-03-07 12:02:28 +01:00
1. Try cleaning and rebuilding **everything**:
```sh
./android/gradlew clean
rm -rf package-lock.json && rm -rf yarn.lock && rm -rf node_modules
npm i # or "yarn"
```
2. Since the Android implementation uses the not-yet fully stable **CameraX** API, make sure you've browsed the [CameraX issue tracker](https://issuetracker.google.com/issues?q=componentid:618491%20status:open) to find out if your issue is a limitation by the **CameraX** library even I cannot get around.
2021-07-08 12:05:29 +02:00
3. Make sure you have installed the [Android NDK](https://developer.android.com/ndk).
2022-02-17 11:10:14 +01:00
4. Make sure your minimum SDK version is **21 or higher**, and target SDK version is **31 or higher**. See [the example's `build.gradle`](https://github.com/mrousavy/react-native-vision-camera/blob/main/example/android/build.gradle#L5-L10) for reference.
2021-03-05 18:04:33 +01:00
1. Open your `build.gradle`
2. Set `buildToolsVersion` to `30.0.0` or higher
3. Set `compileSdkVersion` to `31` or higher
4. Set `targetSdkVersion` to `31` or higher
2021-03-07 11:23:41 +01:00
5. Set `minSdkVersion` to `21` or higher
2021-07-08 12:03:00 +02:00
6. Set `ndkVersion` to `"20.1.5948944"` or higher
7. Update the Gradle Build-Tools version to `4.1.2` or higher:
2021-03-07 11:23:41 +01:00
```
classpath("com.android.tools.build:gradle:4.1.2")
```
2021-07-08 12:05:29 +02:00
4. Make sure your Gradle Wrapper version is `6.5` or higher. In `gradle-wrapper.properties`, set:
2021-03-07 11:23:41 +01:00
```
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
```
2021-03-29 17:23:24 +02:00
5. If you're having runtime issues, check the logs in Android Studio/Logcat to find out more. In Android Studio, go to **View** > **Tool Windows** > **Logcat** (<kbd>⌘</kbd>+<kbd>6</kbd>) or run `adb logcat` in Terminal.
6. If a camera device is not being returned by [`Camera.getAvailableCameraDevices()`](/docs/api/classes/Camera#getavailablecameradevices), make sure it is a Camera2 compatible device. See [this section in the Android docs](https://developer.android.com/reference/android/hardware/camera2/CameraDevice#reprocessing) for more information.
7. If your Frame Processor is not running, make sure you check the native Android Studio/Logcat logs to find out why. Also make sure you are not using a remote JS debugger such as Google Chrome, since those don't work with JSI.
## Issues
If nothing has helped so far, try browsing the [GitHub issues](https://github.com/mrousavy/react-native-vision-camera/issues?q=is%3Aissue). If your issue doesn't exist, [create a new one](https://github.com/mrousavy/react-native-vision-camera/issues/new/choose). Make sure to fill out the template and include as many details as possible. Also try to reproduce the issue in the [example app](https://github.com/mrousavy/react-native-vision-camera/blob/main/example).