Multiplatform Android crashes on launch of coroutine

I am working on my first multiplatform app. All my code is in the App.kt (kotlin commonMain) file. The desktop app runs and works perfectly. But the Android app (API 34) launches and immediately crashes. I have identified that it crashes when I attempt to launch a coroutine (i.e. by commenting out the scope.launch block, the app does not crash). I have tried more things that I can iterate here, but nothing seems to change the symptom. What am I doing wrong that would prevent the same code from running successfully on Android?

@Composable
fun App() {
    MaterialTheme {
        var statusMessage by remember { mutableStateOf("") }
        var expiration by remember { mutableStateOf("0") }
        val client = HttpClient(CIO)
        val scope = CoroutineScope(Dispatchers.IO)

        scope.launch {
            while(true) {
                val onResponse = client.get("http://192.168.1.79:5000/state")
                statusMessage = onResponse.bodyAsText()
                println(statusMessage)
                delay(5000)
            }
        }
        ...

build.gradle.kts:

  • The commonMain.dependencies contains: implementation(“org.jetbrains.kotlinx:kotlinx-coroutines-core:1.8.1”)
  • And the Android dependencies contains: implementation(“org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.1”)

Thanks in advance!

Do you have a stack trace or an error message?

The generic Android app crash notification appears sometimes, not always. Usually, the app just appears for a split second and then disappears. I attempted to debug the app through Android Studio and the emulator, but that didn’t give me anything (or maybe I just don’t know how to configure/use it properly). I did manage to run the app from Android Studio to my phone w/ Matlog installed, and here are the logs based on the keyword of my app’s name:

05-11 13:31:41.535 D/AppSnippet(24519): getBitmapFromDrawable: downscaling, origW 252 origH 252 scaleRatio 0.9920634920634921 label us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:41.635 I/Finsky  (24326): [2] akxw.c(68): VerifyApps: Install-time verification requested for package us.neptunedev.ultrasonicemitterapp.test, id = 44
05-11 13:31:41.649 I/Finsky  (24326): [250] VerifyAppsInstallTask.ajV(52): VerifyApps: Anti-malware verification task started for package=us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.107 I/Finsky  (24326): [225] alde.g(53): VerifyApps: Verification package=us.neptunedev.ultrasonicemitterapp.test, id=44, response=0, upload_requested=false
05-11 13:31:42.207 V/BackupManagerService(1503): [UserID:0] restoreAtInstall pkg=us.neptunedev.ultrasonicemitterapp.test token=2d restoreSet=301850004ee6f984
05-11 13:31:42.447 I/Backup  (9108): [RestoreRequestProcessor] Skipping app with no doc id or kv pairs: us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.491 D/CarrierSvcBindHelper(2676): onPackageAdded: us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.492 I/SdkSandboxManager(1503): No SDKs used. Skipping SDK data reconcilation for CallingInfo{mUid=10593, mPackageName='us.neptunedev.ultrasonicemitterapp.test, mAppProcessToken='null'}
05-11 13:31:42.522 I/SafetyLabelChangedBroadcastReceiver(23651): received broadcast packageName: us.neptunedev.ultrasonicemitterapp.test, current user: UserHandle{0}, packageChangeEvent: NEW_INSTALL, intent user: UserHandle{0}
05-11 13:31:42.548 D/ImsResolver(2676): maybeAddedImsService, packageName: us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.559 D/CarrierSvcBindHelper(2676): onPackageModified: us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.580 D/ImsResolver(2676): maybeAddedImsService, packageName: us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.703 D/PackageUpdatedTask(17535): mAllAppsList.addPackage us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:42.813 D/PackageUpdatedTask(17535): mAllAppsList.updatePackage us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:43.003 D/IconPackManager(17535): Received intent action android.intent.action.PACKAGE_ADDED for us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:43.018 I/Finsky  (24326): [2] kwv.f(7): AIM: AppInfoCacheUpdater -> invalidating apps: [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:31:43.023 I/Finsky  (24326): [235] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:31:43.052 I/ProximityAuth(8750): [RecentAppsMediator] Package added: (user=UserHandle{0}) us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:43.055 I/Finsky  (24326): [2] kwv.f(7): AIM: AppInfoCacheUpdater -> invalidating apps: [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:31:43.067 I/Finsky  (24326): [241] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:31:43.068 I/Finsky  (24326): [244] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:31:43.077 D/IconPackManager(17535): Received intent action android.intent.action.PACKAGE_CHANGED for us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:43.085 I/Finsky  (24326): [2] VerifyInstallTask.ajU(76): VerifyApps: Install-time verification complete: id=44, package_name=us.neptunedev.ultrasonicemitterapp.test
05-11 13:31:43.955 I/InstallSuccess(24519): Finished installing us.neptunedev.ultrasonicemitterapp.test
05-11 13:32:47.234 I/AppLocaleUtil(23900): Can display preference - [us.neptunedev.ultrasonicemitterapp.test] : isDisallowedPackage : false / isSignedWithPlatformKey : false / hasLauncherEntry : false / canDisplay : false / 1.1
05-11 13:32:47.263 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.HOME due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.MAIN', mCategories='[android.intent.category.HOME]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='null', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.268 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.DIALER due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.DIAL', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='null', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.274 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.SMS due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.provider.Telephony.SMS_DELIVER', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='android.permission.BROADCAST_SMS', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.277 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.HOME due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.MAIN', mCategories='[android.intent.category.HOME]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='null', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.283 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.DIALER due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.DIAL', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='null', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.284 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.SMS due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.provider.Telephony.SMS_DELIVER', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='android.permission.BROADCAST_SMS', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.582 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.HOME due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.MAIN', mCategories='[android.intent.category.HOME]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='null', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.584 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.DIALER due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.intent.action.DIAL', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='null', mQueryFlags=0, mMetaData=[]}
05-11 13:32:47.585 I/Role    (23651): us.neptunedev.ultrasonicemitterapp.test not qualified for android.app.role.SMS due to missing RequiredComponent{mIntentFilterData=IntentFilterData{mAction='android.provider.Telephony.SMS_DELIVER', mCategories='[]', mDataScheme='null', mDataType='null'}, mMinTargetSdkVersion=1, mFlags='0', mPermission='android.permission.BROADCAST_SMS', mQueryFlags=0, mMetaData=[]}
05-11 13:33:06.593 I/AppLocaleUtil(23900): Can display preference - [us.neptunedev.ultrasonicemitterapp.test] : isDisallowedPackage : false / isSignedWithPlatformKey : false / hasLauncherEntry : false / canDisplay : false / 1.1
05-11 13:33:09.644 I/UninstallerActivity(24519): Uninstalling extras=Bundle[{com.android.packageinstaller.extra.IS_CLONE_APP=false, com.android.packageinstaller.extra.APP_LABEL=us.neptunedev.ultrasonicemitterapp.test, com.android.packageinstaller.applicationInfo=ApplicationInfo{5cc140b us.neptunedev.ultrasonicemitterapp.test}, android.intent.extra.UNINSTALL_ALL_USERS=false, com.android.packageinstaller.extra.UNINSTALL_ID=-2147483634}]
05-11 13:33:09.645 I/ActivityManager(1503): Force stopping us.neptunedev.ultrasonicemitterapp.test appid=10593 user=0: deletePackageX
05-11 13:33:09.659 W/PackageManager(1503): java.lang.IllegalArgumentException: Unable to get package us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.299 I/ActivityManager(1503): Force stopping us.neptunedev.ultrasonicemitterapp.test appid=10593 user=0: pkg removed
05-11 13:33:10.311 I/ActivityManager(1503): Force stopping us.neptunedev.ultrasonicemitterapp.test appid=10593 user=0: pkg removed
05-11 13:33:10.317 V/StorageManagerService(1503): Package us.neptunedev.ultrasonicemitterapp.test does not have legacy storage
05-11 13:33:10.332 I/UninstallFinish(24519): Uninstall finished extras=Bundle[{android.content.pm.extra.STATUS=0, com.android.packageinstaller.extra.IS_CLONE_APP=false, android.content.pm.extra.PACKAGE_NAME=us.neptunedev.ultrasonicemitterapp.test, com.android.packageinstaller.extra.APP_LABEL=us.neptunedev.ultrasonicemitterapp.test, com.android.packageinstaller.applicationInfo=Supplier{VAL_PARCELABLE@636+2944}, android.intent.extra.UNINSTALL_ALL_USERS=false, android.content.pm.extra.LEGACY_STATUS=1, com.android.packageinstaller.extra.UNINSTALL_ID=-2147483634, android.content.pm.extra.STATUS_MESSAGE=DELETE_SUCCEEDED}]
05-11 13:33:10.336 I/RollbackManager(1503): broadcast=ACTION_PACKAGE_FULLY_REMOVED pkg=us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.338 W/WifiService(1503): Couldn't get PackageInfo for package:us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.338 D/WifiService(1503): Remove settings for package:us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.338 D/WifiConfigManager(1503): Remove all networks for app ApplicationInfo{abc618c us.neptunedev.ultrasonicemitterapp.test}
05-11 13:33:10.340 W/MediaProvider(3721): WorkProfileOwnerApps cache miss for package us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.355 D/CarrierSvcBindHelper(2676): onPackageRemoved: us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.372 I/PasspointManager(1503): No app ops listener found for us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.373 W/WifiService(1503): Couldn't get PackageInfo for package:us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.373 D/WifiService(1503): Remove settings for package:us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.373 D/WifiConfigManager(1503): Remove all networks for app ApplicationInfo{5ab7f9e us.neptunedev.ultrasonicemitterapp.test}
05-11 13:33:10.380 W/LightPackageInfoLiveData(23651): Package "us.neptunedev.ultrasonicemitterapp.test" not found for user UserHandle{0}
05-11 13:33:10.393 I/Finsky  (24326): [2] ymk.x(82): Package no longer installed: us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.396 I/Finsky  (24326): [2] ymk.x(82): Package no longer installed: us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.409 W/AppStorageSize(23900): Failed to query stats: android.content.pm.PackageManager$NameNotFoundException: us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.418 I/PasspointManager(1503): No app ops listener found for us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.427 I/Finsky  (24326): [2] kwv.f(7): AIM: AppInfoCacheUpdater -> invalidating apps: [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:33:10.431 I/Finsky  (24326): [244] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp.test]
05-11 13:33:10.431 I/Finsky  (24326): [2] suc.aho(63): IQ: onPackageRemoved us.neptunedev.ultrasonicemitterapp.test, replacing=false, uninstallingFromPlay=false
05-11 13:33:10.435 I/ProximityAuth(8750): [RecentAppsMediator] Package removed: (user=UserHandle{0}) us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.446 I/Finsky  (24326): [2] ymk.x(82): Package no longer installed: us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.451 I/Finsky  (24326): [320] kcb.a(178): Asset module storage cleared for package us.neptunedev.ultrasonicemitterapp.test.
05-11 13:33:10.452 W/Finsky  (24326): [2] aejr.b(126): STU: Failed to get storage stats for package 'us.neptunedev.ultrasonicemitterapp.test' (1601: Error getting stats: android.content.pm.PackageManager.NameNotFoundException)
05-11 13:33:10.544 W/SQLiteLog(9108): (28) double-quoted string literal: "us.neptunedev.ultrasonicemitterapp.test"
05-11 13:33:10.549 I/Icing   (9108): doRemovePackageData us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.698 D/Launcher.Model(17535): package removed received us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.699 D/PackageUpdatedTask(17535): Removing app icon: us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.721 D/PackageUpdatedTask(17535): mAllAppsList.removePackage us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.725 D/ModelWriter(17535): removing items from db . Reason: [removed because the corresponding package or component is removed. mOp=3 removedPackages=[us.neptunedev.ultrasonicemitterapp.test] removedComponents=[]]
05-11 13:33:10.749 D/PersistedStoragePackageUninstalledReceiver(23651): Received android.intent.action.PACKAGE_FULLY_REMOVED for us.neptunedev.ultrasonicemitterapp.test for u0
05-11 13:33:10.820 D/IconPackManager(17535): Received intent action android.intent.action.PACKAGE_FULLY_REMOVED for us.neptunedev.ultrasonicemitterapp.test
05-11 13:33:10.866 I/Telecom (1503): CarModeTracker: Package us.neptunedev.ultrasonicemitterapp.test is not tracked.: SSH.oR@avI
05-11 13:33:10.885 D/MediaProvider(3721): Deleted 0 Android/media items belonging to us.neptunedev.ultrasonicemitterapp.test on /data/user/0/com.android.providers.media.module/databases/external.db
05-11 13:33:10.892 D/MediaGrants(3721): Removed 0 media_grants for 0 user for [us.neptunedev.ultrasonicemitterapp.test]. Reason: Package orphaned
05-11 13:33:10.895 I/ConditionProviders(1503): Disallowing condition provider us.neptunedev.ultrasonicemitterapp.test (userSet: true)
05-11 13:33:23.782 E/studio.deploy(25626): ERROR: Could not get package user id: run-as: unknown package: us.neptunedev.ultrasonicemitterapp
05-11 13:33:23.816 E/studio.deploy(25626): ERROR: Could not find apks for this package: us.neptunedev.ultrasonicemitterapp
05-11 13:33:23.849 E/studio.deploy(25626): ERROR: Could not get package user id: run-as: unknown package: us.neptunedev.ultrasonicemitterapp
05-11 13:33:23.881 E/studio.deploy(25626): ERROR: Could not find apks for this package: us.neptunedev.ultrasonicemitterapp
05-11 13:33:24.251 I/Finsky  (24326): [2] akxw.c(68): VerifyApps: Install-time verification requested for package us.neptunedev.ultrasonicemitterapp, id = 45
05-11 13:33:24.272 I/Finsky  (24326): [322] VerifyAppsInstallTask.ajV(52): VerifyApps: Anti-malware verification task started for package=us.neptunedev.ultrasonicemitterapp
05-11 13:33:24.779 I/Finsky  (24326): [326] alde.g(53): VerifyApps: Verification package=us.neptunedev.ultrasonicemitterapp, id=45, response=0, upload_requested=false
05-11 13:33:24.955 V/BackupManagerService(1503): [UserID:0] restoreAtInstall pkg=us.neptunedev.ultrasonicemitterapp token=2e restoreSet=301850004ee6f984
05-11 13:33:25.432 I/Backup  (9108): [RestoreRequestProcessor] Skipping app with no doc id or kv pairs: us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.485 I/SdkSandboxManager(1503): No SDKs used. Skipping SDK data reconcilation for CallingInfo{mUid=10594, mPackageName='us.neptunedev.ultrasonicemitterapp, mAppProcessToken='null'}
05-11 13:33:25.488 D/CarrierSvcBindHelper(2676): onPackageAdded: us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.508 I/SafetyLabelChangedBroadcastReceiver(23651): received broadcast packageName: us.neptunedev.ultrasonicemitterapp, current user: UserHandle{0}, packageChangeEvent: NEW_INSTALL, intent user: UserHandle{0}
05-11 13:33:25.558 D/PackageUpdatedTask(17535): mAllAppsList.addPackage us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.571 D/ImsResolver(2676): maybeAddedImsService, packageName: us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.589 D/CarrierSvcBindHelper(2676): onPackageModified: us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.593 I/ActivityManager(1503): Force stopping us.neptunedev.ultrasonicemitterapp appid=10594 user=0: from pid 25657
05-11 13:33:25.653 D/ImsResolver(2676): maybeAddedImsService, packageName: us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.661 D/CarrierSvcBindHelper(2676): onHandleForceStop: [us.neptunedev.ultrasonicemitterapp]
05-11 13:33:25.712 D/PackageUpdatedTask(17535): mAllAppsList.updatePackage us.neptunedev.ultrasonicemitterapp
05-11 13:33:25.985 D/IconPackManager(17535): Received intent action android.intent.action.PACKAGE_ADDED for us.neptunedev.ultrasonicemitterapp
05-11 13:33:26.010 I/Finsky  (24326): [235] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp]
05-11 13:33:26.014 D/IconPackManager(17535): Received intent action android.intent.action.PACKAGE_CHANGED for us.neptunedev.ultrasonicemitterapp
05-11 13:33:26.015 I/Finsky  (24326): [2] kwv.f(7): AIM: AppInfoCacheUpdater -> invalidating apps: [us.neptunedev.ultrasonicemitterapp]
05-11 13:33:26.020 I/Finsky  (24326): [245] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp]
05-11 13:33:26.067 I/Finsky  (24326): [2] kwv.f(7): AIM: AppInfoCacheUpdater -> invalidating apps: [us.neptunedev.ultrasonicemitterapp]
05-11 13:33:26.070 I/Finsky  (24326): [245] kys.a(47): AIM: AppInfoManager-Perf > OnDeviceAppInfo > cacheHitCount=0, cacheMissCount=1. Missed  in cache (limit 10) : [us.neptunedev.ultrasonicemitterapp]
05-11 13:33:26.074 I/ProximityAuth(8750): [RecentAppsMediator] Package added: (user=UserHandle{0}) us.neptunedev.ultrasonicemitterapp
05-11 13:33:26.212 I/ActivityTaskManager(1503): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=us.neptunedev.ultrasonicemitterapp/.MainActivity} with LAUNCH_MULTIPLE from uid 2000 (BAL_ALLOW_PERMISSION) result code=0
05-11 13:33:26.217 V/WindowManagerShell(2380): Transition requested (#1492): android.os.BinderProxy@370f0fc TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=2349 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=us.neptunedev.ultrasonicemitterapp/.MainActivity } baseActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} topActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} origActivity=null realActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} numActivities=1 lastActiveTime=574154999 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@f6b9385} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{59e85da us.neptunedev.ultrasonicemitterapp.MainActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 isUserFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = null, displayChange = null, flags = 0, debugId = 1492 }
05-11 13:33:26.234 D/CoreBackPreview(1503): Window{31be05c u0 Splash Screen us.neptunedev.ultrasonicemitterapp}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@70ce0f8, mPriority=0, mIsAnimationCallback=false}
05-11 13:33:26.241 I/ActivityManager(1503): Start proc 25776:us.neptunedev.ultrasonicemitterapp/u0a594 for next-top-activity {us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity}
05-11 13:33:26.253 I/Finsky  (24326): [2] VerifyInstallTask.ajU(76): VerifyApps: Install-time verification complete: id=45, package_name=us.neptunedev.ultrasonicemitterapp
05-11 13:33:26.277 V/WindowManager(1503): Sent Transition (#1492) createdAt=05-11 13:33:26.198 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=2349 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=us.neptunedev.ultrasonicemitterapp/.MainActivity } baseActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} topActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} origActivity=null realActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} numActivities=1 lastActiveTime=574154999 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{RemoteToken{ee8e25 Task{3e8ae5e #2349 type=standard A=10594:us.neptunedev.ultrasonicemitterapp}}} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{a7ffbfa us.neptunedev.ultrasonicemitterapp.MainActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 isUserFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = null, displayChange = null, flags = 0, debugId = 1492 }
05-11 13:33:26.277 V/WindowManager(1503):         {WCT{RemoteToken{ee8e25 Task{3e8ae5e #2349 type=standard A=10594:us.neptunedev.ultrasonicemitterapp}}} m=OPEN f=NONE leash=Surface(name=Task=2349)/@0xfcbcf85 sb=Rect(0, 0 - 1440, 3120) eb=Rect(0, 0 - 1440, 3120) d=0},
05-11 13:33:26.386 W/ziparchive(25776): Unable to open '/data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.dm': No such file or directory
05-11 13:33:26.386 W/ziparchive(25776): Unable to open '/data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.dm': No such file or directory
05-11 13:33:26.608 D/nativeloader(25776): Configuring clns-4 for other apk /data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/lib/arm64, permitted_path=/data:/mnt/expand:/data/user/0/us.neptunedev.ultrasonicemitterapp
05-11 13:33:26.967 E/AndroidRuntime(25776): Process: us.neptunedev.ultrasonicemitterapp, PID: 25776
05-11 13:33:26.971 W/ActivityTaskManager(1503):   Force finishing activity us.neptunedev.ultrasonicemitterapp/.MainActivity
05-11 13:33:27.003 I/ActivityManager(1503): Process us.neptunedev.ultrasonicemitterapp (pid 25776) has died: fg  TOP 
05-11 13:33:27.004 I/WindowManager(1503): WIN DEATH: Window{dbbffb9 u0 us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity}
05-11 13:33:27.004 W/InputManager-JNI(1503): Input channel object 'dbbffb9 us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity (client)' was disposed without first being removed with the input manager!
05-11 13:33:27.032 V/WindowManager(1503):         {WCT{RemoteToken{ee8e25 Task{3e8ae5e #2349 type=standard A=10594:us.neptunedev.ultrasonicemitterapp}}} m=CLOSE f=NONE leash=Surface(name=Task=2349)/@0xfcbcf85 sb=Rect(0, 0 - 1440, 3120) eb=Rect(0, 0 - 1440, 3120) d=0}
05-11 13:33:27.048 D/VRI[ultrasonicemitterapp](2380): Not drawing due to not visible
05-11 13:33:27.049 W/InputManager-JNI(1503): Input channel object '31be05c Splash Screen us.neptunedev.ultrasonicemitterapp (client)' was disposed without first being removed with the input manager!
05-11 13:33:27.473 W/ActivityTaskManager(1503): Activity top resumed state loss timeout for ActivityRecord{a396e81 u0 us.neptunedev.ultrasonicemitterapp/.MainActivity t2349 f} isExiting}
05-11 13:33:49.145 W/gle.android.gms(9108): ApkAssets: Deleting an ApkAssets object '<empty> and /data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.apk' with 1 weak references
05-11 13:34:04.532 E/studio.deploy(25960): ERROR: Could not remove dir '/data/data/us.neptunedev.ultrasonicemitterapp/code_cache/.ll/': No such file or directory
05-11 13:34:04.632 I/ActivityManager(1503): Force stopping us.neptunedev.ultrasonicemitterapp appid=10594 user=0: from pid 25965
05-11 13:34:04.649 D/CarrierSvcBindHelper(2676): onHandleForceStop: [us.neptunedev.ultrasonicemitterapp]
05-11 13:34:04.983 I/ActivityTaskManager(1503): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=us.neptunedev.ultrasonicemitterapp/.MainActivity} with LAUNCH_MULTIPLE from uid 2000 (BAL_ALLOW_PERMISSION) result code=0
05-11 13:34:04.984 V/WindowManagerShell(2380): Transition requested (#1496): android.os.BinderProxy@4935828 TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=2351 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=us.neptunedev.ultrasonicemitterapp/.MainActivity } baseActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} topActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} origActivity=null realActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} numActivities=1 lastActiveTime=574193771 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{android.window.IWindowContainerToken$Stub$Proxy@e88e941} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{a34ee6 us.neptunedev.ultrasonicemitterapp.MainActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 isUserFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = null, displayChange = null, flags = 0, debugId = 1496 }
05-11 13:34:04.996 D/CoreBackPreview(1503): Window{ad358f3 u0 Splash Screen us.neptunedev.ultrasonicemitterapp}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@7d3c029, mPriority=0, mIsAnimationCallback=false}
05-11 13:34:05.004 I/ActivityManager(1503): Start proc 25977:us.neptunedev.ultrasonicemitterapp/u0a594 for next-top-activity {us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity}
05-11 13:34:05.026 V/WindowManager(1503): Sent Transition (#1496) createdAt=05-11 13:34:04.974 via request=TransitionRequestInfo { type = OPEN, triggerTask = TaskInfo{userId=0 taskId=2351 displayId=0 isRunning=true baseIntent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=us.neptunedev.ultrasonicemitterapp/.MainActivity } baseActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} topActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} origActivity=null realActivity=ComponentInfo{us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity} numActivities=1 lastActiveTime=574193771 supportsMultiWindow=true resizeMode=1 isResizeable=true minWidth=-1 minHeight=-1 defaultMinSize=220 token=WCT{RemoteToken{39ef36b Task{7242e57 #2351 type=standard A=10594:us.neptunedev.ultrasonicemitterapp}}} topActivityType=1 pictureInPictureParams=null shouldDockBigOverlays=false launchIntoPipHostTaskId=-1 lastParentTaskIdBeforePip=-1 displayCutoutSafeInsets=null topActivityInfo=ActivityInfo{89a6ec8 us.neptunedev.ultrasonicemitterapp.MainActivity} launchCookies=[] positionInParent=Point(0, 0) parentTaskId=-1 isFocused=false isVisible=false isVisibleRequested=false isSleeping=false locusId=null displayAreaFeatureId=1 isTopActivityTransparent=false appCompatTaskInfo=AppCompatTaskInfo { topActivityInSizeCompat=false topActivityEligibleForLetterboxEducation= false isLetterboxDoubleTapEnabled= false topActivityEligibleForUserAspectRatioButton= false topActivityBoundsLetterboxed= false isFromLetterboxDoubleTap= false topActivityLetterboxVerticalPosition= -1 topActivityLetterboxHorizontalPosition= -1 topActivityLetterboxWidth=-1 topActivityLetterboxHeight=-1 isUserFullscreenOverrideEnabled=false cameraCompatControlState=hidden}}, pipTask = null, remoteTransition = null, displayChange = null, flags = 0, debugId = 1496 }
05-11 13:34:05.027 V/WindowManager(1503):         {WCT{RemoteToken{39ef36b Task{7242e57 #2351 type=standard A=10594:us.neptunedev.ultrasonicemitterapp}}} m=OPEN f=NONE leash=Surface(name=Task=2351)/@0x740914f sb=Rect(0, 0 - 1440, 3120) eb=Rect(0, 0 - 1440, 3120) d=0},
05-11 13:34:05.073 W/re-initialized>(25977): type=1400 audit(0.0:64352): avc:  granted  { execute } for  path="/data/data/us.neptunedev.ultrasonicemitterapp/code_cache/startup_agents/0b0c1899-agent.so" dev="dm-43" ino=99886 scontext=u:r:untrusted_app:s0:c82,c258,c512,c768 tcontext=u:object_r:app_data_file:s0:c82,c258,c512,c768 tclass=file app=us.neptunedev.ultrasonicemitterapp
05-11 13:34:05.096 W/sonicemitterapp(25977): DexFile /data/data/us.neptunedev.ultrasonicemitterapp/code_cache/.studio/instruments-ac9f170b.jar is in boot class path but is not in a known location
05-11 13:34:05.239 W/ziparchive(25977): Unable to open '/data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.dm': No such file or directory
05-11 13:34:05.239 W/ziparchive(25977): Unable to open '/data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.dm': No such file or directory
05-11 13:34:05.426 D/nativeloader(25977): Configuring clns-4 for other apk /data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/base.apk. target_sdk_version=34, uses_libraries=, library_path=/data/app/~~J4NRCrVU4IfQ0Ryj9_WGaA==/us.neptunedev.ultrasonicemitterapp-IAhpwquq48fO36PwQ3YLkA==/lib/arm64, permitted_path=/data:/mnt/expand:/data/user/0/us.neptunedev.ultrasonicemitterapp
05-11 13:34:05.821 E/AndroidRuntime(25977): Process: us.neptunedev.ultrasonicemitterapp, PID: 25977
05-11 13:34:05.824 W/ActivityTaskManager(1503):   Force finishing activity us.neptunedev.ultrasonicemitterapp/.MainActivity
05-11 13:34:05.826 I/ActivityManager(1503): Showing crash dialog for package us.neptunedev.ultrasonicemitterapp u0
05-11 13:34:05.870 D/CoreBackPreview(1503): Window{a77f034 u0 Application Error: us.neptunedev.ultrasonicemitterapp}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.WindowOnBackInvokedDispatcher$OnBackInvokedCallbackWrapper@737dff7, mPriority=0, mIsAnimationCallback=false}
05-11 13:34:05.997 D/CoreBackPreview(1503): Window{dfea6c2 u0 us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity}: Setting back callback OnBackInvokedCallbackInfo{mCallback=android.window.IOnBackInvokedCallback$Stub$Proxy@b213f3d, mPriority=0, mIsAnimationCallback=false}
05-11 13:34:06.211 V/WindowManager(1503):         {WCT{RemoteToken{39ef36b Task{7242e57 #2351 type=standard A=10594:us.neptunedev.ultrasonicemitterapp}}} m=CLOSE f=NONE leash=Surface(name=Task=2351)/@0x740914f sb=Rect(0, 0 - 1440, 3120) eb=Rect(0, 0 - 1440, 3120) d=0}
05-11 13:34:06.584 D/VRI[ultrasonicemitterapp](2380): Not drawing due to not visible
05-11 13:34:06.585 W/InputManager-JNI(1503): Input channel object 'ad358f3 Splash Screen us.neptunedev.ultrasonicemitterapp (client)' was disposed without first being removed with the input manager!
05-11 13:34:06.587 D/CoreBackPreview(1503): Window{ad358f3 u0 Splash Screen us.neptunedev.ultrasonicemitterapp EXITING}: Setting back callback null
05-11 13:34:06.794 D/CoreBackPreview(1503): Window{dfea6c2 u0 us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity}: Setting back callback null
05-11 13:34:06.802 W/InputManager-JNI(1503): Input channel object 'dfea6c2 us.neptunedev.ultrasonicemitterapp/us.neptunedev.ultrasonicemitterapp.MainActivity (client)' was disposed without first being removed with the input manager!
05-11 13:34:10.143 I/ActivityManager(1503): Killing 25977:us.neptunedev.ultrasonicemitterapp/u0a594 (adj 900): crash
05-11 13:34:10.145 D/CoreBackPreview(1503): Window{a77f034 u0 Application Error: us.neptunedev.ultrasonicemitterapp}: Setting back callback null
05-11 13:34:10.154 W/InputManager-JNI(1503): Input channel object 'a77f034 Application Error: us.neptunedev.ultrasonicemitterapp (client)' was disposed without first being removed with the input manager!
05-11 13:34:10.206 V/ActivityManager(1503): Got obituary of 25977:us.neptunedev.ultrasonicemitterapp

I didn’t really, other than a lot of Matlog data. However, your question motivated me to see if I could wrap the most likely culprit in try/catch and dump the exception message to the screen. This gave me a weird “operation not permitted” message. I “googled” this and quickly felt like an idiot. I was missing the following from the manifest:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
2 Likes