Skip to content

Commit 84faf5b

Browse files
authored
Update for CamKit 1.43.0 and iOS 26
Update for compatibility with iOS 26 and bump Camera Kit SDK version to 1.43.0
1 parent 51e46c0 commit 84faf5b

24 files changed

Lines changed: 5577 additions & 2784 deletions

File tree

android/build.gradle

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ buildscript {
33
def kotlin_version = rootProject.ext.has("kotlinVersion") ? rootProject.ext.get("kotlinVersion") : project.properties["CameraKitReactNative_kotlinVersion"]
44

55
ext {
6-
cameraKitVersion = "1.39.0"
6+
cameraKitVersion = "1.43.0"
77
exoPlayerVersion = "2.16.1"
88
}
99

@@ -13,7 +13,7 @@ buildscript {
1313
}
1414

1515
dependencies {
16-
classpath "com.android.tools.build:gradle:8.0.1"
16+
classpath "com.android.tools.build:gradle:8.7.3"
1717
// noinspection DifferentKotlinGradleVersion
1818
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1919
}
@@ -61,8 +61,12 @@ android {
6161
}
6262

6363
compileOptions {
64-
sourceCompatibility JavaVersion.VERSION_1_8
65-
targetCompatibility JavaVersion.VERSION_1_8
64+
sourceCompatibility JavaVersion.VERSION_17
65+
targetCompatibility JavaVersion.VERSION_17
66+
}
67+
68+
kotlinOptions {
69+
jvmTarget = '17'
6670
}
6771
}
6872

android/gradle.properties

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ CameraKitReactNative_minSdkVersion=21
33
CameraKitReactNative_targetSdkVersion=34
44
CameraKitReactNative_compileSdkVersion=34
55
CameraKitReactNative_ndkversion=21.4.7075529
6+
newArchEnabled=true
7+
8+
# Use this property to enable or disable the Hermes JS engine.
9+
# If set to false, you will be using JSC instead.
10+
hermesEnabled=true

android/src/main/java/com/snap/camerakit/reactnative/CameraKitContextModule.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ class CameraKitContextModule(reactContext: ReactApplicationContext) : ReactConte
154154
imageProcessorSource(imageProcessorSource)
155155
safeRenderAreaProcessorSource(safeRenderAreaProcessor)
156156
// Disable default Camera Kit lenses UI.
157-
configureLenses {
158-
configureLoadingOverlay { enabled = false }
159-
configureCarousel { enabled = false }
160-
configureHints { enabled = false }
157+
configureLenses { builder ->
158+
builder.configureLoadingOverlay { it.enabled = false }
159+
builder.configureCarousel { it.enabled = false }
160+
builder.configureHints { it.enabled = false }
161161
}
162162
handleErrorsWith { item ->
163163
eventEmitter.sendError(item)

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset'],
2+
presets: ['module:@react-native/babel-preset'],
33
};

example/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Also, make sure you have completed the [React Native - Environment Setup](https:
1010

1111
1. Open `App.tsx` in and enter value for `apiToken` with the one you get from Camera Kit Developer portal.
1212
2. Open `Lenses.tsx` and enter value for `groupId` from which you want to fetch lenses. [Optional] Enter value for `launchDataLensId` for the Lens which has launch data associated with it or remove all the relevant code that uses this param.
13-
3. [_Optional_] This example is using version 1.39.0 of Camera Kit Mobile SDK for Android and latest version on iOS. If you want to use the [latest version](https://docs.snap.com/camera-kit/integrate-sdk/mobile/changelog-mobile#latest-version) of Camera Kit Mobile SDK on Android then modify `cameraKitVersion` variable in [build.gradle](../android/build.gradle) file. Please refer to [Lens Studio Compatibility](https://docs.snap.com/camera-kit/ar-content/lens-studio-compatibility) guide for selecting the appropriate version that work with your Lenses.
13+
3. [_Optional_] This example is using version 1.43.0 of Camera Kit Mobile SDK for Android and latest version on iOS. If you want to use the [latest version](https://docs.snap.com/camera-kit/integrate-sdk/mobile/changelog-mobile#latest-version) of Camera Kit Mobile SDK on Android then modify `cameraKitVersion` variable in [build.gradle](../android/build.gradle) file. Please refer to [Lens Studio Compatibility](https://docs.snap.com/camera-kit/ar-content/lens-studio-compatibility) guide for selecting the appropriate version that work with your Lenses.
1414

1515
## Step 2: Start the Metro Server
1616

example/android/app/build.gradle

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

45
/**
@@ -48,6 +49,7 @@ react {
4849
//
4950
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5051
// hermesFlags = ["-O", "-output-source-map"]
52+
autolinkLibrariesWithApp()
5153
}
5254

5355
/**
@@ -70,8 +72,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
7072

7173
android {
7274
ndkVersion rootProject.ext.ndkVersion
73-
74-
compileSdkVersion rootProject.ext.compileSdkVersion
75+
buildToolsVersion rootProject.ext.buildToolsVersion
76+
compileSdk rootProject.ext.compileSdkVersion
7577

7678
namespace "com.snap.camerakit.reactnative.example"
7779
defaultConfig {
@@ -112,28 +114,15 @@ dependencies {
112114
// The version of react-native is set by the React Native Gradle Plugin
113115
implementation("com.facebook.react:react-android")
114116

115-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
116-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
117-
exclude group:'com.squareup.okhttp3', module:'okhttp'
118-
}
117+
// Manually added native module dependencies (autolinking not working properly)
118+
implementation project(':snap_camera-kit-react-native')
119+
implementation project(':react-native-video')
119120

120-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
121121
if (hermesEnabled.toBoolean()) {
122122
implementation("com.facebook.react:hermes-android")
123123
} else {
124124
implementation jscFlavor
125125
}
126126
}
127127

128-
configurations.all {
129-
// This block will apply to all configurations
130-
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
131-
// Check if the module name contains 'kotlin-stdlib'
132-
if (details.requested.name.equals("kotlin-stdlib")) {
133-
// Use 1.7.22 version across all deps
134-
details.useVersion("1.7.22")
135-
}
136-
}
137-
}
138128

139-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

example/android/app/src/debug/java/com/snap/camerakit/reactnative/example/ReactNativeFlipper.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

example/android/app/src/main/java/com/snap/camerakit/reactnative/example/MainApplication.java

Lines changed: 0 additions & 63 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
package com.snap.camerakit.reactnative.example;
2+
3+
import android.app.Application
4+
import com.facebook.react.PackageList
5+
import com.facebook.react.ReactApplication
6+
import com.facebook.react.ReactHost
7+
import com.facebook.react.ReactNativeHost
8+
import com.facebook.react.ReactPackage
9+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10+
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11+
import com.facebook.react.defaults.DefaultReactNativeHost
12+
import com.facebook.react.soloader.OpenSourceMergedSoMapping
13+
import com.facebook.soloader.SoLoader
14+
15+
class MainApplication : Application(), ReactApplication {
16+
17+
override val reactNativeHost: ReactNativeHost =
18+
object : DefaultReactNativeHost(this) {
19+
override fun getPackages(): List<ReactPackage> =
20+
PackageList(this).packages.apply {
21+
// Packages that cannot be autolinked yet can be added manually here, for example:
22+
// add(MyReactNativePackage())
23+
}
24+
25+
override fun getJSMainModuleName(): String = "index"
26+
27+
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28+
29+
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30+
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31+
}
32+
33+
override val reactHost: ReactHost
34+
get() = getDefaultReactHost(applicationContext, reactNativeHost)
35+
36+
override fun onCreate() {
37+
super.onCreate()
38+
SoLoader.init(this, OpenSourceMergedSoMapping)
39+
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40+
// If you opted-in for the New Architecture, we load the native entry point for this app.
41+
load()
42+
}
43+
}
44+
}

example/android/build.gradle

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
buildscript {
44
ext {
5-
buildToolsVersion = "34.0.0"
6-
minSdkVersion = 21
7-
compileSdkVersion = 34
5+
buildToolsVersion = "35.0.0"
6+
minSdkVersion = 24
7+
compileSdkVersion = 35
88
targetSdkVersion = 34
9-
10-
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
11-
ndkVersion = "23.1.7779620"
9+
ndkVersion = "27.1.12297006"
10+
kotlinVersion = "2.0.21"
1211
}
1312
repositories {
1413
google()
@@ -17,5 +16,9 @@ buildscript {
1716
dependencies {
1817
classpath("com.android.tools.build:gradle")
1918
classpath("com.facebook.react:react-native-gradle-plugin")
19+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
2020
}
2121
}
22+
23+
24+
apply plugin: "com.facebook.react.rootproject"

0 commit comments

Comments
 (0)