diff --git a/example/android/.gitignore b/example/android/.gitignore index 877b87e9..8a6be077 100644 --- a/example/android/.gitignore +++ b/example/android/.gitignore @@ -10,6 +10,7 @@ build/ local.properties *.iml *.hprof +.cxx/ # Bundle artifacts *.jsbundle diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index ed84922f..05934bd6 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -14,18 +14,19 @@ react { hermesCommand = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).getParentFile().getAbsolutePath() + "/sdks/hermesc/%OS-BIN%/hermesc" 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() + enableBundleCompression = (findProperty('android.enableBundleCompression') ?: false).toBoolean() // Use Expo CLI to bundle the app, this ensures the Metro config // works correctly with Expo projects. cliFile = new File(["node", "--print", "require.resolve('@expo/cli', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim()) bundleCommand = "export:embed" /* Folders */ - // The root of your project, i.e. where "package.json" lives. Default is '..' - // root = file("../") - // The folder where the react-native NPM package is. Default is ../node_modules/react-native - // reactNativeDir = file("../node_modules/react-native") - // The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen - // codegenDir = file("../node_modules/@react-native/codegen") + // The root of your project, i.e. where "package.json" lives. Default is '../..' + // root = file("../../") + // The folder where the react-native NPM package is. Default is ../../node_modules/react-native + // reactNativeDir = file("../../node_modules/react-native") + // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen + // codegenDir = file("../../node_modules/@react-native/codegen") /* Variants */ // The list of variants to that are debuggable. For those we're going to @@ -57,6 +58,9 @@ react { // // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" // hermesFlags = ["-O", "-output-source-map"] + + /* Autolinking */ + autolinkLibrariesWithApp() } /** @@ -75,7 +79,7 @@ def enableProguardInReleaseBuilds = (findProperty('android.enableProguardInRelea * give correct results when using with locales other than en-US. Note that * this variant is about 6MiB larger per architecture than default. */ -def jscFlavor = 'org.webkit:android-jsc:+' +def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+' android { ndkVersion rootProject.ext.ndkVersion @@ -90,8 +94,6 @@ android { targetSdkVersion rootProject.ext.targetSdkVersion versionCode 1 versionName "1.0.0" - - buildConfigField("boolean", "REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS", (findProperty("reactNative.unstable_useRuntimeSchedulerAlways") ?: true).toString()) } signingConfigs { debug { @@ -112,6 +114,7 @@ android { shrinkResources (findProperty('android.enableShrinkResourcesInReleaseBuilds')?.toBoolean() ?: false) minifyEnabled enableProguardInReleaseBuilds proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" + crunchPngs (findProperty('android.enablePngCrunchInReleaseBuilds')?.toBoolean() ?: true) } } packagingOptions { @@ -119,6 +122,9 @@ android { useLegacyPackaging (findProperty('expo.useLegacyPackaging')?.toBoolean() ?: false) } } + androidResources { + ignoreAssetsPattern '!.svn:!.git:!.ds_store:!*.scc:!CVS:!thumbs.db:!picasa.ini:!*~' + } } // Apply static values from `gradle.properties` to the `android.packagingOptions` @@ -151,26 +157,21 @@ dependencies { if (isGifEnabled) { // For animated gif support - implementation("com.facebook.fresco:animated-gif:${reactAndroidLibs.versions.fresco.get()}") + implementation("com.facebook.fresco:animated-gif:${expoLibs.versions.fresco.get()}") } if (isWebpEnabled) { // For webp support - implementation("com.facebook.fresco:webpsupport:${reactAndroidLibs.versions.fresco.get()}") + implementation("com.facebook.fresco:webpsupport:${expoLibs.versions.fresco.get()}") if (isWebpAnimatedEnabled) { // Animated webp support - implementation("com.facebook.fresco:animated-webp:${reactAndroidLibs.versions.fresco.get()}") + implementation("com.facebook.fresco:animated-webp:${expoLibs.versions.fresco.get()}") } } - implementation("com.facebook.react:flipper-integration") - if (hermesEnabled.toBoolean()) { implementation("com.facebook.react:hermes-android") } else { implementation jscFlavor } } - -apply from: new File(["node", "--print", "require.resolve('@react-native-community/cli-platform-android/package.json', { paths: [require.resolve('react-native/package.json')] })"].execute(null, rootDir).text.trim(), "../native_modules.gradle"); -applyNativeModulesAppBuildGradle(project) diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index 707e8b54..53c1ac56 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -11,9 +11,8 @@ - + - @@ -21,13 +20,6 @@ - - - - - - - \ No newline at end of file diff --git a/example/android/app/src/main/java/com/rnctvexample/MainActivity.kt b/example/android/app/src/main/java/com/rnctvexample/MainActivity.kt index d206e317..ee7585d6 100644 --- a/example/android/app/src/main/java/com/rnctvexample/MainActivity.kt +++ b/example/android/app/src/main/java/com/rnctvexample/MainActivity.kt @@ -1,4 +1,5 @@ package com.rnctvexample +import expo.modules.splashscreen.SplashScreenManager import android.os.Build import android.os.Bundle @@ -15,7 +16,10 @@ class MainActivity : ReactActivity() { // Set the theme to AppTheme BEFORE onCreate to support // coloring the background, status bar, and navigation bar. // This is required for expo-splash-screen. - setTheme(R.style.AppTheme); + // setTheme(R.style.AppTheme); + // @generated begin expo-splashscreen - expo prebuild (DO NOT MODIFY) sync-f3ff59a738c56c9a6119210cb55f0b613eb8b6af + SplashScreenManager.registerOnActivity(this) + // @generated end expo-splashscreen super.onCreate(null) } diff --git a/example/android/app/src/main/java/com/rnctvexample/MainApplication.kt b/example/android/app/src/main/java/com/rnctvexample/MainApplication.kt index 28e18ecf..fa117129 100644 --- a/example/android/app/src/main/java/com/rnctvexample/MainApplication.kt +++ b/example/android/app/src/main/java/com/rnctvexample/MainApplication.kt @@ -2,18 +2,15 @@ package com.rnctvexample import android.app.Application import android.content.res.Configuration -import androidx.annotation.NonNull import com.facebook.react.PackageList import com.facebook.react.ReactApplication import com.facebook.react.ReactNativeHost import com.facebook.react.ReactPackage import com.facebook.react.ReactHost -import com.facebook.react.config.ReactFeatureFlags import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load -import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost import com.facebook.react.defaults.DefaultReactNativeHost -import com.facebook.react.flipper.ReactNativeFlipper +import com.facebook.react.soloader.OpenSourceMergedSoMapping import com.facebook.soloader.SoLoader import expo.modules.ApplicationLifecycleDispatcher @@ -25,9 +22,10 @@ class MainApplication : Application(), ReactApplication { this, object : DefaultReactNativeHost(this) { override fun getPackages(): List { + val packages = PackageList(this).packages // Packages that cannot be autolinked yet can be added manually here, for example: - // packages.add(new MyReactNativePackage()); - return PackageList(this).packages + // packages.add(MyReactNativePackage()) + return packages } override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry" @@ -40,21 +38,15 @@ class MainApplication : Application(), ReactApplication { ) override val reactHost: ReactHost - get() = getDefaultReactHost(this.applicationContext, reactNativeHost) + get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost) override fun onCreate() { super.onCreate() - SoLoader.init(this, false) - if (!BuildConfig.REACT_NATIVE_UNSTABLE_USE_RUNTIME_SCHEDULER_ALWAYS) { - ReactFeatureFlags.unstable_useRuntimeSchedulerAlways = false - } + SoLoader.init(this, OpenSourceMergedSoMapping) if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { // If you opted-in for the New Architecture, we load the native entry point for this app. load() } - if (BuildConfig.DEBUG) { - ReactNativeFlipper.initializeFlipper(this, reactNativeHost.reactInstanceManager) - } ApplicationLifecycleDispatcher.onApplicationCreate(this) } diff --git a/example/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png b/example/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png new file mode 100644 index 00000000..31df827b Binary files /dev/null and b/example/android/app/src/main/res/drawable-hdpi/splashscreen_logo.png differ diff --git a/example/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png b/example/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png new file mode 100644 index 00000000..ef243aab Binary files /dev/null and b/example/android/app/src/main/res/drawable-mdpi/splashscreen_logo.png differ diff --git a/example/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png b/example/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png new file mode 100644 index 00000000..e9d54745 Binary files /dev/null and b/example/android/app/src/main/res/drawable-xhdpi/splashscreen_logo.png differ diff --git a/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png b/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png new file mode 100644 index 00000000..d61da15d Binary files /dev/null and b/example/android/app/src/main/res/drawable-xxhdpi/splashscreen_logo.png differ diff --git a/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png b/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png new file mode 100644 index 00000000..4aeed11d Binary files /dev/null and b/example/android/app/src/main/res/drawable-xxxhdpi/splashscreen_logo.png differ diff --git a/example/android/app/src/main/res/drawable/splashscreen.xml b/example/android/app/src/main/res/drawable/ic_launcher_background.xml similarity index 59% rename from example/android/app/src/main/res/drawable/splashscreen.xml rename to example/android/app/src/main/res/drawable/ic_launcher_background.xml index 12f2f769..883b2a08 100644 --- a/example/android/app/src/main/res/drawable/splashscreen.xml +++ b/example/android/app/src/main/res/drawable/ic_launcher_background.xml @@ -1,4 +1,6 @@ - + + + \ No newline at end of file diff --git a/example/android/app/src/main/res/drawable/rn_edit_text_material.xml b/example/android/app/src/main/res/drawable/rn_edit_text_material.xml index 73b37e4d..5c25e728 100644 --- a/example/android/app/src/main/res/drawable/rn_edit_text_material.xml +++ b/example/android/app/src/main/res/drawable/rn_edit_text_material.xml @@ -17,7 +17,8 @@ android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material" android:insetRight="@dimen/abc_edit_text_inset_horizontal_material" android:insetTop="@dimen/abc_edit_text_inset_top_material" - android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"> + android:insetBottom="@dimen/abc_edit_text_inset_bottom_material" + >