Skip to content

Commit

Permalink
fix: temporarily workaround to build in react native 74
Browse files Browse the repository at this point in the history
fix: update react-native version
  • Loading branch information
danieloprado committed May 9, 2024
1 parent 2415e1f commit 457fd3c
Show file tree
Hide file tree
Showing 18 changed files with 2,592 additions and 1,073 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/BUILD_ERROR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ body:
render: json
placeholder: >
"dependencies": {
"react-native": "^0.73.4",
"react-native-reanimated": "^3.9.0",
"react-native": "^0.74.1",
"react-native-reanimated": "^3.10.0",
"react-native-vision-camera": "^4.0.0",
"react-native-worklets-core": "^1.0.0",
...
Expand Down
16 changes: 8 additions & 8 deletions docs/docs/guides/TROUBLESHOOTING.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,20 @@ If you're experiencing build issues or runtime issues in VisionCamera, make sure
yarn # or `npm i`
```
4. Make sure you have installed the [Android NDK](https://developer.android.com/ndk).
5. Make sure your minimum SDK version is **21 or higher**, and target SDK version is **33 or higher**. See [the example's `build.gradle`](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/android/build.gradle#L5-L9) for reference.
5. Make sure your minimum SDK version is **23 or higher**, and target SDK version is **34 or higher**. See [the example's `build.gradle`](https://github.com/mrousavy/react-native-vision-camera/blob/main/package/example/android/build.gradle#L5-L9) for reference.
1. Open your `build.gradle`
2. Set `buildToolsVersion` to `33.0.0` or higher
3. Set `compileSdkVersion` to `33` or higher
4. Set `targetSdkVersion` to `33` or higher
5. Set `minSdkVersion` to `21` or higher
6. Set `ndkVersion` to `"23.1.7779620"` or higher
2. Set `buildToolsVersion` to `34.0.0` or higher
3. Set `compileSdkVersion` to `34` or higher
4. Set `targetSdkVersion` to `34` or higher
5. Set `minSdkVersion` to `23` or higher
6. Set `ndkVersion` to `"26.1.10909125"` or higher
7. Update the Gradle Build-Tools version to `7.3.1` or higher:
```groovy
classpath("com.android.tools.build:gradle:7.3.1")
```
6. Make sure your Gradle Wrapper version is `7.5.1` or higher. In `gradle-wrapper.properties`, set:
6. Make sure your Gradle Wrapper version is `8.6` or higher. In `gradle-wrapper.properties`, set:
```sh
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
```
7. Try building without Frame Processors. Set `VisionCamera_enableFrameProcessors = false` in your `gradle.properties`, and try rebuilding.

Expand Down
2 changes: 1 addition & 1 deletion package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ android {
}

defaultConfig {
minSdkVersion safeExtGet("minSdkVersion", 21)
minSdkVersion safeExtGet("minSdkVersion", 23)
compileSdkVersion safeExtGet("compileSdkVersion", 34)
targetSdkVersion safeExtGet("targetSdkVersion", 34)
versionCode 1
Expand Down
2 changes: 1 addition & 1 deletion package/android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ org.gradle.configureondemand=true
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Fri Feb 19 20:46:14 CET 2021
VisionCamera_kotlinVersion=1.7.20
VisionCamera_kotlinVersion=1.9.22
android.enableJetifier=true
android.useAndroidX=true
2 changes: 1 addition & 1 deletion package/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ import com.facebook.jni.HybridData
import com.facebook.proguard.annotations.DoNotStrip
import com.facebook.react.bridge.ReactApplicationContext
import com.facebook.react.bridge.UiThreadUtil
import com.facebook.react.common.annotations.FrameworkAPI
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl
import com.facebook.react.uimanager.UIManagerHelper
import com.mrousavy.camera.core.ViewNotFoundError
import com.mrousavy.camera.react.CameraView
import java.lang.ref.WeakReference

@OptIn(FrameworkAPI::class)
@Suppress("KotlinJniMissingFunction") // we use fbjni.
class VisionCameraProxy(private val reactContext: ReactApplicationContext) {
companion object {
Expand Down
2 changes: 1 addition & 1 deletion package/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
minSdkVersion = 26
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "23.1.7779620"
ndkVersion = "26.1.10909125"
}
repositories {
google()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 2 additions & 0 deletions package/example/ios/.xcode.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export NODE_BINARY=/opt/homebrew/bin/node

14 changes: 3 additions & 11 deletions package/example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@ require Pod::Executable.execute_command('node', ['-p',
)', __dir__]).strip


platform :ios, 14.5
platform :ios, 14.5
prepare_react_native_project!

flipper_config = FlipperConfiguration.disabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
Expand All @@ -28,11 +26,6 @@ target 'VisionCameraExample' do
# Hermes is now enabled by default. Disable by setting this flag to false.
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
:flipper_configuration => flipper_config,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
Expand All @@ -45,10 +38,9 @@ target 'VisionCameraExample' do
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
__apply_Xcode_12_5_M1_post_install_workaround(installer)

# Sets or removes the VISION_CAMERA_ENABLE_FRAME_PROCESSORS flag to enable or disable
# our Swift Example plugin.
set_frame_processor_swift_flag_in_example_project(installer)
Expand Down

0 comments on commit 457fd3c

Please sign in to comment.