Delphi Android 应用程序在键盘上崩溃 connect/disconnect

Delphi Android App crash on keyboard connect/disconnect

创建一个 Android 应用程序,拖放一个编辑框,运行 应用程序。

如果应用程序 运行nig 你不能 connect/disconnect keyboard/barcode 扫描器,无论它是蓝牙还是有线。

有什么想法吗?

类似于App crashes when closing Keyboard on Android Delphi Xe7 但这不是同一个问题。

LogCat 来自 运行 App,然后连接条码扫描器

01-28 15:23:26.724 I/ActivityManager(668): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity} from pid 2642
01-28 15:23:26.779 I/ActivityManager(668): Start proc com.embarcadero.HeaderFooterApplication for activity com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity: pid=17902 uid=10178 gids={50178, 3002, 3001, 1006, 3003, 5012, 1028, 1015}
01-28 15:23:28.424 I/ActivityManager(668): Displayed com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity: +1s655ms
01-28 15:23:28.884 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] setSynchronousMode: SurfaceTexture has been abandoned!
01-28 15:23:28.884 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] queueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:28.884 W/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] cancelBuffer: BufferQueue has been abandoned!
01-28 15:23:28.889 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:28.889 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:28.889 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:28.889 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:36.054 I/WindowState(668): WIN DEATH: Window{41d09040 u0 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity}
01-28 15:23:36.054 I/ActivityManager(668): Process com.embarcadero.HeaderFooterApplication (pid 17902) has died.
01-28 15:23:36.054 W/ActivityManager(668): Force removing ActivityRecord{41612fe0 u0 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity}: app died, no saved state
01-28 15:23:49.274 I/ActivityManager(668): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity} from pid 2642
01-28 15:23:49.434 I/ActivityManager(668): Start proc com.embarcadero.HeaderFooterApplication for activity com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity: pid=18029 uid=10178 gids={50178, 3002, 3001, 1006, 3003, 5012, 1028, 1015}
01-28 15:23:51.094 I/ActivityManager(668): Displayed com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity: +1s668ms
01-28 15:23:51.589 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] setSynchronousMode: SurfaceTexture has been abandoned!
01-28 15:23:51.589 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] queueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:51.589 W/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] cancelBuffer: BufferQueue has been abandoned!
01-28 15:23:51.589 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:51.594 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:51.594 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:51.599 E/BufferQueue(142): [com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity] dequeueBuffer: SurfaceTexture has been abandoned!
01-28 15:23:59.329 W/InputDispatcher(668): channel '419b5198 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
01-28 15:23:59.329 E/InputDispatcher(668): channel '419b5198 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
01-28 15:23:59.329 W/InputDispatcher(668): Attempted to unregister already unregistered input channel '419b5198 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity (server)'
01-28 15:23:59.329 I/WindowState(668): WIN DEATH: Window{419b5198 u0 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity}
01-28 15:23:59.334 I/ActivityManager(668): Process com.embarcadero.HeaderFooterApplication (pid 18029) has died.
01-28 15:23:59.334 W/ActivityManager(668): Force removing ActivityRecord{419ef278 u0 com.embarcadero.HeaderFooterApplication/com.embarcadero.firemonkey.FMXNativeActivity}: app died, no saved state

来自 Embarcadero Community site 的解决方案(根据 Ernie Thomason 的建议更新了其他项目)

您需要将 keyboard 添加到 Android 清单模板 AndroidManifest.template.xml 以避免 connecting/disconnecting 外接 USB 键盘时应​​用终止。

当前文件:

android:configChanges="orientation|keyboardHidden"

更新文件:

android:configChanges="orientati‌​on|keyboard|keyboardHidden|navigation|screenLayout|screenSize"

以下是有关模板文件的一些附加信息:

当您构建项目时,RAD Studio 使用AndroidManifest.template.xml 作为模板在输出目录中生成AndroidManifest.xml。您将需要编辑与项目位于同一文件夹中的模板文件。