Skip to content

Commit 6c82035

Browse files
refactor: prebuild native directories
1 parent 33cbe9e commit 6c82035

File tree

18 files changed

+1199
-867
lines changed

18 files changed

+1199
-867
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kotlin version: 2.0.21
2+
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
3+
1. Kotlin compile daemon is ready
4+

android/app/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ react {
1414
hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc"
1515
codegenDir = new File(["node", "--print", "require.resolve('@react-native/codegen/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile().getAbsoluteFile()
1616

17+
enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean()
1718
// Use Expo CLI to bundle the app, this ensures the Metro config
1819
// works correctly with Expo projects.
1920
cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim())
@@ -78,7 +79,7 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea
7879
* give correct results when using with locales other than en-US. Note that
7980
* this variant is about 6MiB larger per architecture than default.
8081
*/
81-
def jscFlavor = 'org.webkit:android-jsc:+'
82+
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
8283

8384
android {
8485
ndkVersion rootProject.ext.ndkVersion
@@ -156,15 +157,15 @@ dependencies {
156157

157158
if (isGifEnabled) {
158159
// For animated gif support
159-
implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}")
160+
implementation("com.facebook.fresco:animated-gif:${expoLibs.versions.fresco.get()}")
160161
}
161162

162163
if (isWebpEnabled) {
163164
// For webp support
164-
implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}")
165+
implementation("com.facebook.fresco:webpsupport:${expoLibs.versions.fresco.get()}")
165166
if (isWebpAnimatedEnabled) {
166167
// Animated webp support
167-
implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}")
168+
implementation("com.facebook.fresco:animated-webp:${expoLibs.versions.fresco.get()}")
168169
}
169170
}
170171

android/app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<category android:name="android.intent.category.DEFAULT"/>
2626
<category android:name="android.intent.category.BROWSABLE"/>
2727
<data android:scheme="obytesApp"/>
28-
<data android:scheme="com.obytes.development"/>
2928
<data android:scheme="exp+obytesapp"/>
3029
</intent-filter>
3130
</activity>

android/app/src/main/java/com/obytes/development/MainApplication.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MainApplication : Application(), ReactApplication {
2525
override fun getPackages(): List<ReactPackage> {
2626
val packages = PackageList(this).packages
2727
// Packages that cannot be autolinked yet can be added manually here, for example:
28-
// packages.add(new MyReactNativePackage());
28+
// packages.add(MyReactNativePackage())
2929
return packages
3030
}
3131

android/app/src/main/res/values/styles.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,8 @@
11
<resources xmlns:tools="http://schemas.android.com/tools">
22
<style name="AppTheme" parent="Theme.EdgeToEdge">
3-
<item name="android:textColor">@android:color/black</item>
4-
<item name="android:editTextStyle">@style/ResetEditText</item>
53
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
64
<item name="colorPrimary">@color/colorPrimary</item>
75
</style>
8-
<style name="ResetEditText" parent="@android:style/Widget.EditText">
9-
<item name="android:padding">0dp</item>
10-
<item name="android:textColorHint">#c8c8c8</item>
11-
<item name="android:textColor">@android:color/black</item>
12-
</style>
136
<style name="Theme.App.SplashScreen" parent="Theme.SplashScreen">
147
<item name="windowSplashScreenBackground">@color/splashscreen_background</item>
158
<item name="windowSplashScreenAnimatedIcon">@drawable/splashscreen_logo</item>

android/build.gradle

Lines changed: 28 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,37 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext {
5-
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '35.0.0'
6-
minSdkVersion = Integer.parseInt(findProperty('android.minSdkVersion') ?: '24')
7-
compileSdkVersion = Integer.parseInt(findProperty('android.compileSdkVersion') ?: '35')
8-
targetSdkVersion = Integer.parseInt(findProperty('android.targetSdkVersion') ?: '34')
9-
kotlinVersion = findProperty('android.kotlinVersion') ?: '1.9.24'
10-
11-
ndkVersion = "26.1.10909125"
12-
}
13-
repositories {
14-
google()
15-
mavenCentral()
16-
}
17-
dependencies {
18-
classpath('com.android.tools.build:gradle')
19-
classpath('com.facebook.react:react-native-gradle-plugin')
20-
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
21-
}
4+
repositories {
5+
google()
6+
mavenCentral()
7+
}
8+
dependencies {
9+
classpath('com.android.tools.build:gradle')
10+
classpath('com.facebook.react:react-native-gradle-plugin')
11+
classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
12+
}
2213
}
2314

24-
apply plugin: "com.facebook.react.rootproject"
15+
def reactNativeAndroidDir = new File(
16+
providers.exec {
17+
workingDir(rootDir)
18+
commandLine("node", "--print", "require.resolve('react-native/package.json')")
19+
}.standardOutput.asText.get().trim(),
20+
"../android"
21+
)
2522

2623
allprojects {
27-
repositories {
28-
maven {
29-
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
30-
url(new File(['node', '--print', "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), '../android'))
31-
}
32-
maven {
33-
// Android JSC is installed from npm
34-
url(new File(['node', '--print', "require.resolve('jsc-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), '../dist'))
35-
}
36-
37-
google()
38-
mavenCentral()
39-
maven { url 'https://www.jitpack.io' }
24+
repositories {
25+
maven {
26+
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
27+
url(reactNativeAndroidDir)
4028
}
29+
30+
google()
31+
mavenCentral()
32+
maven { url 'https://www.jitpack.io' }
33+
}
4134
}
35+
36+
apply plugin: "expo-root-project"
37+
apply plugin: "com.facebook.react.rootproject"

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.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

android/gradlew

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ done
8686
# shellcheck disable=SC2034
8787
APP_BASE_NAME=${0##*/}
8888
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89-
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90-
' "$PWD" ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
9190

9291
# Use the maximum available, or set MAX_FD != -1 to use that value.
9392
MAX_FD=maximum

android/settings.gradle

Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,39 @@
11
pluginManagement {
2-
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json')"].execute(null, rootDir).text.trim()).getParentFile().toString())
2+
def reactNativeGradlePlugin = new File(
3+
providers.exec {
4+
workingDir(rootDir)
5+
commandLine("node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })")
6+
}.standardOutput.asText.get().trim()
7+
).getParentFile().absolutePath
8+
includeBuild(reactNativeGradlePlugin)
9+
10+
def expoPluginsPath = new File(
11+
providers.exec {
12+
workingDir(rootDir)
13+
commandLine("node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })")
14+
}.standardOutput.asText.get().trim(),
15+
"../android/expo-gradle-plugin"
16+
).absolutePath
17+
includeBuild(expoPluginsPath)
18+
}
19+
20+
plugins {
21+
id("com.facebook.react.settings")
22+
id("expo-autolinking-settings")
323
}
4-
plugins { id("com.facebook.react.settings") }
524

625
extensions.configure(com.facebook.react.ReactSettingsExtension) { ex ->
726
if (System.getenv('EXPO_USE_COMMUNITY_AUTOLINKING') == '1') {
827
ex.autolinkLibrariesFromCommand()
928
} else {
10-
def command = [
11-
'node',
12-
'--no-warnings',
13-
'--eval',
14-
'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))',
15-
'react-native-config',
16-
'--json',
17-
'--platform',
18-
'android'
19-
].toList()
20-
ex.autolinkLibrariesFromCommand(command)
29+
ex.autolinkLibrariesFromCommand(expoAutolinking.rnConfigCommand)
2130
}
2231
}
32+
expoAutolinking.useExpoModules()
2333

2434
rootProject.name = 'ObytesApp'
2535

26-
dependencyResolutionManagement {
27-
versionCatalogs {
28-
reactAndroidLibs {
29-
from(files(new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim(), "../gradle/libs.versions.toml")))
30-
}
31-
}
32-
}
33-
34-
apply from: new File(["node", "--print", "require.resolve('expo/package.json')"].execute(null, rootDir).text.trim(), "../scripts/autolinking.gradle");
35-
useExpoModules()
36+
expoAutolinking.useExpoVersionCatalog()
3637

3738
include ':app'
38-
includeBuild(new File(["node", "--print", "require.resolve('@react-native/gradle-plugin/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim()).getParentFile())
39+
includeBuild(expoAutolinking.reactNativeGradlePlugin)

0 commit comments

Comments
 (0)