Skip to content

Commit 48baf9c

Browse files
authored
Merge pull request #355 from backtrace-labs/feature/16kb_support
2 parents f4b76ae + 000d0e3 commit 48baf9c

26 files changed

+1153
-1846
lines changed

examples/sdk/reactNative/android/app/build.gradle

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "kotlin-android"
23
apply plugin: "com.facebook.react"
34
apply from: "$rootDir/../node_modules/@backtrace/react-native/android/upload-sourcemaps.gradle"
45

@@ -72,6 +73,9 @@ def enableProguardInReleaseBuilds = false
7273
* this variant is about 6MiB larger per architecture than default.
7374
*/
7475
def jscFlavor = 'org.webkit:android-jsc:+'
76+
def isNewArchitectureEnabled() {
77+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
78+
}
7579

7680
android {
7781
ndkVersion rootProject.ext.ndkVersion
@@ -86,6 +90,15 @@ android {
8690
versionCode 1
8791
versionName "1.0"
8892
}
93+
94+
if (isNewArchitectureEnabled()) {
95+
externalNativeBuild {
96+
cmake {
97+
path "src/main/jni/CMakeLists.txt"
98+
version "3.22.1"
99+
}
100+
}
101+
}
89102
signingConfigs {
90103
debug {
91104
storeFile file('debug.keystore')

examples/sdk/reactNative/android/app/src/main/java/com/reactnative/MainApplication.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint;
1313
import com.facebook.react.defaults.DefaultReactHost;
1414
import com.facebook.react.defaults.DefaultReactNativeHost;
15-
import com.facebook.soloader.SoLoader;
1615

1716
import java.util.List;
1817

@@ -61,7 +60,7 @@ public ReactHost getReactHost() {
6160
@Override
6261
public void onCreate() {
6362
super.onCreate();
64-
SoLoader.init(this, false);
63+
SoLoaderInit.init(this);
6564
if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
6665
// If you opted-in for the New Architecture, we load the native entry point for
6766
// this app.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.reactnative
2+
3+
import android.app.Application
4+
import com.facebook.react.soloader.OpenSourceMergedSoMapping
5+
import com.facebook.soloader.SoLoader
6+
7+
object SoLoaderInit {
8+
@JvmStatic
9+
fun init(app: Application) {
10+
// Initializes SoLoader with the merged-JNI mapping so merged libs can be resolved
11+
SoLoader.init(app, OpenSourceMergedSoMapping)
12+
}
13+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# android/app/src/main/jni/CMakeLists.txt
2+
3+
cmake_minimum_required(VERSION 3.18)
4+
project(appmodules LANGUAGES CXX)
5+
6+
find_package(ReactAndroid REQUIRED)
7+
8+
# Define a variable that points to the folder where Codegen files are created
9+
set(
10+
generated_sources_dir
11+
"${CMAKE_BINARY_DIR}/codegen/jni"
12+
)
13+
14+
# Check if the main C++ file generated by Codegen exists.
15+
# This `if` block is the key to the solution.
16+
if(EXISTS "${generated_sources_dir}/react/renderer/components/appmodules/AppModulesJni.cpp")
17+
18+
# If the file exists, then create the library and link it.
19+
add_library(
20+
appmodules
21+
SHARED
22+
"${generated_sources_dir}/react/renderer/components/appmodules/AppModulesJni.cpp"
23+
)
24+
25+
target_link_libraries(
26+
appmodules
27+
ReactAndroid::react_native_modules
28+
)
29+
30+
endif()

examples/sdk/reactNative/android/build.gradle

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
buildscript {
22
ext {
3-
buildToolsVersion = "34.0.0"
3+
buildToolsVersion = "35.0.0"
44
minSdkVersion = 23
55
compileSdkVersion = 34
66
targetSdkVersion = 34
77
ndkVersion = "26.1.10909125"
8+
buildToolsVersion = "35.0.0"
9+
minSdkVersion = 24
10+
compileSdkVersion = 35
11+
targetSdkVersion = 35
12+
ndkVersion = "28.0.13004108"
813
}
914
repositories {
1015
google()

examples/sdk/reactNative/android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ android.useAndroidX=true
2626
# You can also override it from the CLI using
2727
# ./gradlew <task> -PreactNativeArchitectures=x86_64
2828
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
29-
29+
reactNative.jniLibsMerge.enabled=true
3030
# Use this property to enable support to the new architecture.
3131
# This will allow you to use TurboModules and the Fabric render in
3232
# your application. You should enable this flag either if you want

examples/sdk/reactNative/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-all.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

0 commit comments

Comments
 (0)