MobiVM / robovm

Ahead of time compiler for JVM bytecode targetting iOS, Mac OSX and Linux
https://mobivm.github.io
940 stars 133 forks source link

Running on a connected device keeps crashing on different errors #721

Open yahel-ck opened 1 year ago

yahel-ck commented 1 year ago

Issue details

Running a LibGDX app on a physical iOS device keeps failing on different errors, each time I run I get a [ERROR] Couldn't start application error with one of the following exceptions:

I tried this with two different projects and sometimes the app does launch successfully, but one of the apps crashes right away (because of an unrelated error probably) and I'm not getting the traceback of the exception. Instead I get a AppLauncher failed with an exception error from RoboVM with one of the following exceptions:

I was able to run these apps with RoboVM on this IPhone in the past and I think the only things that changed since then are the iOS version and the IDEA RoboVM plugin verison. Any help would be appriciated, thanks!

Configuration

Build Tools:

Versions:

Build Targets:


Stacktrace

org.robovm.libimobiledevice.LibIMobileDeviceException: DEBUGSERVER_E_SSL_ERROR
    at org.robovm.libimobiledevice.DebugServerClient.checkResult(DebugServerClient.java:195)
    at org.robovm.libimobiledevice.DebugServerClient.receive(DebugServerClient.java:165)
    at org.robovm.libimobiledevice.util.AppLauncher.receiveGdbPacket(AppLauncher.java:449)
    at org.robovm.libimobiledevice.util.AppLauncher.receiveGdbPacket(AppLauncher.java:431)
    at org.robovm.libimobiledevice.util.AppLauncher.pipeStdOut(AppLauncher.java:811)
    at org.robovm.libimobiledevice.util.AppLauncher.launchInternal(AppLauncher.java:760)
    at org.robovm.libimobiledevice.util.AppLauncher.launch(AppLauncher.java:1079)
    at org.robovm.compiler.target.ios.AppLauncherProcess$1.run(AppLauncherProcess.java:67)

org.robovm.libimobiledevice.LibIMobileDeviceException: DEBUGSERVER_E_UNKNOWN_ERROR
    at org.robovm.libimobiledevice.DebugServerClient.checkResult(DebugServerClient.java:195)
    at org.robovm.libimobiledevice.DebugServerClient.receive(DebugServerClient.java:165)
    at org.robovm.libimobiledevice.util.AppLauncher.receiveGdbAck(AppLauncher.java:474)
    at org.robovm.libimobiledevice.util.AppLauncher.sendReceivePacket(AppLauncher.java:484)
    at org.robovm.libimobiledevice.util.AppLauncher.pipeStdOut(AppLauncher.java:788)
    at org.robovm.libimobiledevice.util.AppLauncher.launchInternal(AppLauncher.java:760)
    at org.robovm.libimobiledevice.util.AppLauncher.launch(AppLauncher.java:1079)
    at org.robovm.compiler.target.ios.AppLauncherProcess$1.run(AppLauncherProcess.java:67)

org.robovm.libimobiledevice.LibIMobileDeviceException: LOCKDOWN_E_INVALID_CONF
    at org.robovm.libimobiledevice.LockdowndClient.checkResult(LockdowndClient.java:133)
    at org.robovm.libimobiledevice.LockdowndClient.<init>(LockdowndClient.java:57)
    at org.robovm.libimobiledevice.util.AppLauncher.uploadInternal(AppLauncher.java:1049)
    at org.robovm.libimobiledevice.util.AppLauncher.install(AppLauncher.java:545)
    at org.robovm.compiler.target.ios.AppLauncherProcess.execAsync(AppLauncherProcess.java:62)
    at org.robovm.compiler.target.AbstractTarget.doLaunch(AbstractTarget.java:805)
    at org.robovm.compiler.target.ios.IOSTarget.doLaunch(IOSTarget.java:791)
    at org.robovm.compiler.target.AbstractTarget.launch(AbstractTarget.java:801)
    at org.robovm.compiler.AppCompiler.launchAsync(AppCompiler.java:1017)
    at org.robovm.idea.running.RoboVmRunProfileState.executeRun(RoboVmRunProfileState.java:73)
    at org.robovm.idea.running.RoboVmRunProfileState.startProcess(RoboVmRunProfileState.java:122)
    at com.intellij.execution.configurations.CommandLineState.execute(CommandLineState.java:61)
    at org.robovm.idea.running.RoboVmRunner.doExecute(RoboVmRunner.java:79)
    at com.intellij.execution.runners.GenericProgramRunner$execute$1.invoke(GenericProgramRunner.kt:20)
    at com.intellij.execution.runners.GenericProgramRunner$execute$1.invoke(GenericProgramRunner.kt:19)
    at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:179)
    at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:177)
    at com.intellij.execution.impl.ExecutionManagerImpl.doStartRunProfile$lambda$2(ExecutionManagerImpl.kt:240)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:456)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:758)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:666)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$7(IdeEventQueue.kt:570)
    at com.intellij.openapi.application.impl.ApplicationImpl.withoutImplicitRead(ApplicationImpl.java:1446)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:570)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:994)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:994)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

org.robovm.libimobiledevice.LibIMobileDeviceException: LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING
    at org.robovm.libimobiledevice.LockdowndClient.checkResult(LockdowndClient.java:133)
    at org.robovm.libimobiledevice.LockdowndClient.<init>(LockdowndClient.java:57)
    at org.robovm.libimobiledevice.util.AppLauncher.uploadInternal(AppLauncher.java:1049)
    at org.robovm.libimobiledevice.util.AppLauncher.install(AppLauncher.java:545)
    at org.robovm.compiler.target.ios.AppLauncherProcess.execAsync(AppLauncherProcess.java:62)
    at org.robovm.compiler.target.AbstractTarget.doLaunch(AbstractTarget.java:805)
    at org.robovm.compiler.target.ios.IOSTarget.doLaunch(IOSTarget.java:791)
    at org.robovm.compiler.target.AbstractTarget.launch(AbstractTarget.java:801)
    at org.robovm.compiler.AppCompiler.launchAsync(AppCompiler.java:1017)
    at org.robovm.idea.running.RoboVmRunProfileState.executeRun(RoboVmRunProfileState.java:73)
    at org.robovm.idea.running.RoboVmRunProfileState.startProcess(RoboVmRunProfileState.java:122)
    at com.intellij.execution.configurations.CommandLineState.execute(CommandLineState.java:61)
    at org.robovm.idea.running.RoboVmRunner.doExecute(RoboVmRunner.java:79)
    at com.intellij.execution.runners.GenericProgramRunner$execute$1.invoke(GenericProgramRunner.kt:20)
    at com.intellij.execution.runners.GenericProgramRunner$execute$1.invoke(GenericProgramRunner.kt:19)
    at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:179)
    at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:177)
    at com.intellij.execution.impl.ExecutionManagerImpl.doStartRunProfile$lambda$2(ExecutionManagerImpl.kt:240)
    at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
    at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:21)
    at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.openapi.application.impl.ApplicationImpl$3.run(ApplicationImpl.java:456)
    at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:79)
    at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:122)
    at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:41)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:788)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
    at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:731)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:758)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:666)
    at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$7(IdeEventQueue.kt:570)
    at com.intellij.openapi.application.impl.ApplicationImpl.withoutImplicitRead(ApplicationImpl.java:1446)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:570)
    at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:68)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:349)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:348)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:787)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:348)
    at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:343)
    at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:994)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:994)
    at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$4(IdeEventQueue.kt:343)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:831)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:385)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
dkimitsa commented 1 year ago

@yahel-ck thanks for reporting. hadn't tried it on 16.4.1 probably it is related, will check probably tomorrow. any chance you can try older iOS version ? (just to check) also, make sure you are running 2.3.19 Idea plugin as previous had a bug related to starting on ios13+ device.

yahel-ck commented 1 year ago

I got the same DEBUGSERVER_E_SSL_ERROR error on an iPad with iOS 16.4.

I also got the same errors on my iPhone before upgrading to iOS 16.4.1 (because I thought it might help) but I'm not sure which iOS version I had before.

dkimitsa commented 1 year ago

it indeed failed for me on 16.4.1 first time after device is freshly booted. Second and following launches are successful. investigating into.

dkimitsa commented 1 year ago

there is an update to logic in https://github.com/MobiVM/robovm/pull/726 mostly it will provide better error messages and retry logic and cover cases related to development image mounting and LOCKDOWN_E_PAIRING_DIALOG_RESPONSE_PENDING mentioned above.

there is always a moment that something still don't work. libimobiledevice -- a library we use is build using reverse engineering Apple software/protocols. So it not perfect itself and could not able to handle some cases like usbmuxd daemon go into broken state.

as last resort that mostly always work: reboot phone and reboot Mac (to reset usbmuxs)

yahel-ck commented 1 year ago

Cool when/how can I try it out?

Also I'm still getting org.robovm.libimobiledevice.LibIMobileDeviceException: DEBUGSERVER_E_SSL_ERROR when the app does launch successfully, so I can't see the traceback if an exception is thrown. I tried restarting my Mac and iPhone and it didn't help. Is there anything else I can try?

dkimitsa commented 1 year ago

@yahel-ck its available in snapshot build. can be obtained from there https://mobivm.github.io/dev/

dkimitsa commented 1 year ago

another related case fixed: https://github.com/MobiVM/robovm/pull/734

in recent libmobiledevice *SSL_ERROR -- its common error when communication fails. E.g. it doesn't have specific meaning. I played with iphone8 + ios16.5 and was not able to reproduce.

if this case is reproducible at your end -- please share steps to follow

dkimitsa commented 1 year ago

also there once was case met when robovm sees no device while Xcode and other tools were working. It was cause by "usbmuxd is not running" error inside libmobiledevice. restart of Intellij Idea fixed it. Was not able to reproduce to investigate.

KristjanP94 commented 1 year ago

@yahel-ck I also got DEBUGSERVER_E_SSL_ERROR (iPhone 13, kept on iOS 15.6.1). In my case, the app crashed right after launch and I couldn't see any useful logs in Android studio. However, in Xcode, I could access the device console and after trying multiple different search keywords, I found the relevant exception logs. Might have been "IOSlauncher". (Launch already installed app from device) The console is found in Xcode -> Window -> Devices and Simulators -> (pick device) -> (Open console)

@dkimitsa My app crashes during IOSApplication.java didFinishLaunching listener.create() so in my Main create function - perhaps throwing exception at that point reproduces the SSL_ERROR. When launching app from android studio, even the Xcode console misses the crash logs. Only when I launch already installed app from device, the relevant crash logs show up.

dkimitsa commented 1 year ago

@KristjanP94 thanks, SSL_ERROR is verbose error, in your case it should be "Disconnected". But also it would good to receive any java stack trace logs that are piped to console. Will check

sdringo9 commented 2 months ago

I updated it to 2.20, because the DEBUGSERVER_E_SSL_ERROR occurred while using 2.19. Then, LOCKDOWN_E_MUX_ERROR occurred. How can I fix this error?

dkimitsa commented 2 months ago

@sdringo9 DEBUGSERVER_E_SSL_ERROR -- means that connection to device is terminated. Most likely this happens as your application is crashed. Check Xcode logs. As for LOCKDOWN_E_MUX_ERROR -- its known issue being investigated. thx