Delphi Android App在键盘连接/断开连接时崩溃

时间:2015-01-27 17:38:44

标签: android delphi keyboard firemonkey delphi-xe7

创建Android应用,删除编辑框,运行应用。

  • 连接条形码扫描仪,App Crash。
  • 连接条形码扫描仪并运行应用程序,一切正常。
  • 断开扫描仪和应用程序崩溃。

如果应用程序运行,您无法连接/断开键盘/条形码扫描仪,无论是蓝牙还是有线。

有什么想法吗?

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

运行应用程序中的LogCat,然后连接条形码扫描器

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

1 个答案:

答案 0 :(得分:2)

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

您需要将keyboard添加到Android清单模板AndroidManifest.template.xml中,以避免在连接/断开外部USB键盘时终止应用。

当前档案:

android:configChanges="orientation|keyboardHidden"

更新文件:

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

以下是有关模板文件的一些其他信息:

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