Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporarily workaround to build in React Native v74 #2859

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
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.2",
"react-native-reanimated": "^3.10.0",
"react-native-vision-camera": "^4.0.0",
"react-native-worklets-core": "^1.0.0",
...
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,24 @@ jobs:
build:
name: Build Android Example App
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./package
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Setup JDK 17
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -72,6 +84,17 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Free Disk Space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: false
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true

- name: Setup JDK 17
uses: actions/setup-java@v4
with:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ jobs:
uses: actions/cache@v4
with:
path: package/example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
key: ${{ runner.os }}-pods-${{ hashFiles('package/example/ios/Podfile.lock') }}
- name: Install Pods
run: bundle exec pod install
- name: Install xcpretty
Expand Down Expand Up @@ -114,9 +112,7 @@ jobs:
uses: actions/cache@v4
with:
path: package/example/ios/Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
key: ${{ runner.os }}-pods-${{ hashFiles('package/example/ios/Podfile.lock') }}
- name: Install Pods
run: bundle exec pod install
- name: Install xcpretty
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
8 changes: 7 additions & 1 deletion package/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,12 @@ android {
ndkVersion rootProject.ext.ndkVersion
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += "-opt-in=com.facebook.react.common.annotations.FrameworkAPI"
}
}

buildFeatures {
prefab true
prefabPublishing true
Expand All @@ -121,7 +127,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
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

2 changes: 1 addition & 1 deletion package/example/ios/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby '>= 2.6.10'

gem 'cocoapods', '>= 1.11.3'
gem 'cocoapods', '>= 1.15.0'
gem 'cocoapods-check', '>= 1.1.0'
52 changes: 29 additions & 23 deletions package/example/ios/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,43 +1,46 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.7.2)
activesupport (6.1.7.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.11.3)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-check (1.1.0)
cocoapods (~> 1.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
Expand All @@ -47,7 +50,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
Expand All @@ -56,49 +59,52 @@ GEM
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.0)
concurrent-ruby (1.3.1)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
json (2.6.3)
minitest (5.17.0)
json (2.7.2)
minitest (5.23.1)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
nkf (0.2.0)
public_suffix (4.0.7)
rexml (3.2.5)
rexml (3.2.8)
strscan (>= 3.0.9)
ruby-macho (2.5.1)
typhoeus (1.4.0)
strscan (3.1.0)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.7)
zeitwerk (2.6.15)

PLATFORMS
ruby
x86_64-darwin-19

DEPENDENCIES
cocoapods (>= 1.11.3)
cocoapods (>= 1.15.0)
cocoapods-check (>= 1.1.0)

RUBY VERSION
ruby 2.6.10p210

BUNDLED WITH
2.3.22
2.4.22
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