fix: AndroidManifest添加launchMode=singleTask+MainApplication适配expo prebuild

This commit is contained in:
LukeMackin
2026-07-20 13:47:52 +08:00
parent 8bffc389c8
commit ffd5d4d8e5
4 changed files with 1127 additions and 263 deletions

View File

@@ -5,6 +5,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" /> <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<application <application
android:name=".MainApplication"
android:label="Yuzu GCA v0.1.0" android:label="Yuzu GCA v0.1.0"
android:allowBackup="false" android:allowBackup="false"
android:supportsRtl="true" android:supportsRtl="true"
@@ -13,6 +14,7 @@
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:label="Yuzu GCA v0.1.0" android:label="Yuzu GCA v0.1.0"
android:launchMode="singleTask"
android:exported="true"> android:exported="true">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@@ -1,57 +1,5 @@
package dev.yuzu.gca package dev.yuzu.gca
import android.app.Application import android.app.Application
import android.content.res.Configuration
import com.facebook.react.PackageList class MainApplication : Application()
import com.facebook.react.ReactApplication
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
import com.facebook.react.ReactHost
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
import com.facebook.react.defaults.DefaultReactNativeHost
import com.facebook.react.soloader.OpenSourceMergedSoMapping
import com.facebook.soloader.SoLoader
import expo.modules.ApplicationLifecycleDispatcher
import expo.modules.ReactNativeHostWrapper
class MainApplication : Application(), ReactApplication {
override val reactNativeHost: ReactNativeHost = ReactNativeHostWrapper(
this,
object : DefaultReactNativeHost(this) {
override fun getPackages(): List<ReactPackage> {
val packages = PackageList(this).packages
// Packages that cannot be autolinked yet can be added manually here, for example:
// packages.add(new MyReactNativePackage());
return packages
}
override fun getJSMainModuleName(): String = ".expo/.virtual-metro-entry"
override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
}
)
override val reactHost: ReactHost
get() = ReactNativeHostWrapper.createReactHost(applicationContext, reactNativeHost)
override fun onCreate() {
super.onCreate()
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()
}
ApplicationLifecycleDispatcher.onApplicationCreate(this)
}
override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig)
ApplicationLifecycleDispatcher.onConfigurationChanged(this, newConfig)
}
}

View File

@@ -13,7 +13,7 @@
}, },
"dependencies": { "dependencies": {
"@yuzu-gca/shared": "workspace:*", "@yuzu-gca/shared": "workspace:*",
"expo": "~53.0.0", "expo": "~52.0.49",
"expo-constants": "~18.0.0", "expo-constants": "~18.0.0",
"expo-file-system": "~18.0.0", "expo-file-system": "~18.0.0",
"expo-status-bar": "~2.0.0", "expo-status-bar": "~2.0.0",

1332
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff