0

My app crashes during startup.

When I use logcat I get the error (reverse domain name deliberately obscured for security):

 E  FATAL EXCEPTION: main (Ask Gemini)
                                                                                                    Process: co.uk.*****.provisioner, PID: 11384
                                                                                                    java.lang.RuntimeException: Unable to create application co.uk.*****.provisioner.MainApplication: java.lang.IllegalStateException: DevelopmentClientController was initialized.
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7716)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:230)
                                                                                                        at android.os.Looper.loop(Looper.java:319)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8919)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
                                                                                                    Caused by: java.lang.IllegalStateException: DevelopmentClientController was initialized.
                                                                                                        at expo.modules.devlauncher.DevLauncherController$Companion.initialize$expo_dev_launcher_debug(DevLauncherController.kt:404)
                                                                                                        at expo.modules.devlauncher.DevLauncherController$Companion.initialize(DevLauncherController.kt:438)
                                                                                                        at expo.modules.devlauncher.DevLauncherController$Companion.initialize$default(DevLauncherController.kt:437)
                                                                                                        at expo.modules.devlauncher.DevLauncherPackageDelegate$createApplicationLifecycleListeners$1.onCreate(DevLauncherPackageDelegate.kt:36)
                                                                                                        at expo.modules.ApplicationLifecycleDispatcher.onApplicationCreate(ApplicationLifecycleDispatcher.kt:20)
                                                                                                        at co.uk.*****.provisioner.MainApplication.onCreate(MainApplication.kt:50)
                                                                                                        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7711)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478) 
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                        at android.os.Looper.loopOnce(Looper.java:230) 
                                                                                                        at android.os.Looper.loop(Looper.java:319) 
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8919) 
                                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) 
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103) 
2025-04-17 12:34:41.911 11384-11384 DevLauncher             co.uk.*****.provisioner              E  DevLauncher tries to handle uncaught exception. (Ask Gemini)
                                                                                                    java.lang.RuntimeException: Unable to create application co.uk.*****.provisioner.MainApplication: java.lang.IllegalStateException: DevelopmentClientController was initialized.
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7716)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0)
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:230)
                                                                                                        at android.os.Looper.loop(Looper.java:319)
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8919)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578)
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)
                                                                                                    Caused by: java.lang.IllegalStateException: DevelopmentClientController was initialized.
                                                                                                        at expo.modules.devlauncher.DevLauncherController$Companion.initialize$expo_dev_launcher_debug(DevLauncherController.kt:404)
                                                                                                        at expo.modules.devlauncher.DevLauncherController$Companion.initialize(DevLauncherController.kt:438)
                                                                                                        at expo.modules.devlauncher.DevLauncherController$Companion.initialize$default(DevLauncherController.kt:437)
                                                                                                        at expo.modules.devlauncher.DevLauncherPackageDelegate$createApplicationLifecycleListeners$1.onCreate(DevLauncherPackageDelegate.kt:36)
                                                                                                        at expo.modules.ApplicationLifecycleDispatcher.onApplicationCreate(ApplicationLifecycleDispatcher.kt:20)
                                                                                                        at co.uk.*****.provisioner.MainApplication.onCreate(MainApplication.kt:50)
                                                                                                        at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1316)
                                                                                                        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7711)
                                                                                                        at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 
                                                                                                        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2478) 
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:106) 
                                                                                                        at android.os.Looper.loopOnce(Looper.java:230) 
                                                                                                        at android.os.Looper.loop(Looper.java:319) 
                                                                                                        at android.app.ActivityThread.main(ActivityThread.java:8919) 
                                                                                                        at java.lang.reflect.Method.invoke(Native Method) 
                                                                                                        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:578) 
                                                                                                        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1103)

GitHub Copilot says:

The error DevelopmentClientController was initialized means that somewhere during the app's startup, the Dev Launcher setup is happening twice. While the call ApplicationLifecycleDispatcher.onApplicationCreate(this) is standard, something it triggers, or perhaps another part of your native setup, is causing the duplicate initialization.

The crash log points to an issue within the Expo Dev Launcher's initialization process, which is triggered by:

// This line triggers Expo's setup, including the Dev Launcher
ApplicationLifecycleDispatcher.onApplicationCreate(this) 

in your MainApplication.kt's onCreate method:

package co.uk.*****.provisioner

import android.app.Application
import android.content.res.Configuration

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.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)
  }
}

I've searched through all files in my Android directory that may be relevant, but I haven't found anything that could be triggered by the suspect line in the code sample above. I also haven't found any other part of my native Android system that could cause the duplication.

1 Answer 1

2

I had this problem too while upgrading from expo 52 to 53. I traced it down to some duplicate files in node_modules under <module>/android/bin. Not sure how/why they got created.

% find node_modules -name DevLauncherPackage.kt
node_modules/expo-dev-launcher/android/bin/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt
node_modules/expo-dev-launcher/android/src/main/java/expo/modules/devlauncher/DevLauncherPackage.kt

Cleaning out the node_modules, .expo, and android directories didn't help. I was using node 22.14.0. I switched to node 24.1.0, cleaned out node_modules, android, .expo and tried again and the problem went away.

Sign up to request clarification or add additional context in comments.

1 Comment

Thx for your reply, better late than never! I’m sure it will help someone else. I think I resolved it by running expo prebuild -p android —clean. That rebuilds the android directory so it’s build scripts are synced to the current node_modules packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.