如何解决ListAdapter - 我不知道我的应用程序崩溃了
我需要有关应用崩溃原因的帮助。我可以看到它抱怨数组索引大于 16,但是代码在哪里?我不知道。
我基本上请求蓝牙数据,然后在数据到达后,它会打开一个 Activity 在 Listview 中显示数据。当 Listview 尝试启动时应用程序崩溃。
如果需要,我会提供代码。 谢谢
这是我的 LogCat
2021-04-14 16:57:40.160 26029-26058/com.example.ble D/OpenGLRenderer: ProgramCache.generateProgram: 8899172237312
2021-04-14 16:57:47.225 26029-26058/com.example.ble D/Surface: Surface::disconnect(this=0x750a612200,api=1)
2021-04-14 16:57:47.226 26029-26058/com.example.ble D/GraphicBuffer: unregister,handle(0x7508bc39c0) (w:812 h:610 s:816 f:0x1 u:0x000b00)
2021-04-14 16:57:47.226 26029-26058/com.example.ble D/GraphicBuffer: unregister,handle(0x7508ba0540) (w:812 h:610 s:816 f:0x1 u:0x000b00)
2021-04-14 16:57:47.227 26029-26058/com.example.ble D/GraphicBuffer: unregister,handle(0x7508ba2040) (w:812 h:610 s:816 f:0x1 u:0x000b00)
2021-04-14 16:57:47.227 26029-26058/com.example.ble D/Surface: Surface::disconnect(this=0x750a612200,api=1)
2021-04-14 16:57:47.239 26029-26029/com.example.ble D/WindowClient: Remove from mViews: DecorView@7724e1e[],this = android.view.WindowManagerGlobal@d68a129
2021-04-14 16:57:47.240 26029-26041/com.example.ble I/art: Enter while loop.
2021-04-14 16:57:47.250 26029-26029/com.example.ble V/InputMethodManager: onWindowFocus: null softInputMode=32 first=false flags=#81810100
2021-04-14 16:57:47.399 26029-26058/com.example.ble D/OpenGLRenderer: ~CanvasContext() 0x751f97c000
2021-04-14 16:57:47.411 26029-26058/com.example.ble D/OpenGLRenderer: ~CanvasContext() 0x751f975000
2021-04-14 16:57:47.412 26029-26058/com.example.ble D/OpenGLRenderer: ~CanvasContext() 0x751f978800
2021-04-14 16:57:47.414 26029-26058/com.example.ble D/OpenGLRenderer: ~CanvasContext() 0x751f971800
2021-04-14 16:57:48.212 26029-26104/com.example.ble D/HomeFragment: ReadHolding Task Start
2021-04-14 16:57:48.212 26029-26104/com.example.ble D/Service_BTLE_GATT: Clear Buffers
2021-04-14 16:57:48.213 26029-26104/com.example.ble D/BluetoothGatt: writeCharacteristic() - uuid: 2456e1b9-26e2-8f83-e744-f34f01e9d703
2021-04-14 16:57:48.215 26029-26043/com.example.ble D/BluetoothGatt: onCharacteristicWrite() - Device=CC:F9:57:8E:60:C9 handle=25 Status=0
2021-04-14 16:57:48.310 26029-26042/com.example.ble D/BluetoothGatt: onNotify() - Device=CC:F9:57:8E:60:C9 handle=25
2021-04-14 16:57:48.310 26029-26042/com.example.ble D/Service_BTLE_GATT: QTY Bytes in rx_Data = 20
2021-04-14 16:57:48.312 26029-26043/com.example.ble D/BluetoothGatt: onNotify() - Device=CC:F9:57:8E:60:C9 handle=25
2021-04-14 16:57:48.312 26029-26043/com.example.ble D/Service_BTLE_GATT: QTY Bytes in rx_Data = 11
2021-04-14 16:57:48.313 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 0,0xfa
2021-04-14 16:57:48.314 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 1,0x 3
2021-04-14 16:57:48.315 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 2,0x1a
2021-04-14 16:57:48.316 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 3,0x64
2021-04-14 16:57:48.316 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 4,0x 0
2021-04-14 16:57:48.317 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 5,0x 1
2021-04-14 16:57:48.318 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 6,0x 0
2021-04-14 16:57:48.319 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 7,0x 1
2021-04-14 16:57:48.320 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 8,0x 0
2021-04-14 16:57:48.320 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 9,0x7c
2021-04-14 16:57:48.321 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 10,0x 1
2021-04-14 16:57:48.322 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 11,0x 1
2021-04-14 16:57:48.322 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 12,0x 0
2021-04-14 16:57:48.323 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 13,0x 1
2021-04-14 16:57:48.324 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 14,0x 0
2021-04-14 16:57:48.324 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 15,0x 0
2021-04-14 16:57:48.325 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 16,0x 0
2021-04-14 16:57:48.326 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 17,0x15
2021-04-14 16:57:48.326 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 18,0x 0
2021-04-14 16:57:48.327 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 19,0x1e
2021-04-14 16:57:48.327 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 20,0x 0
2021-04-14 16:57:48.328 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 21,0x 0
2021-04-14 16:57:48.329 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 22,0x 0
2021-04-14 16:57:48.330 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 23,0x 0
2021-04-14 16:57:48.330 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 24,0x 0
2021-04-14 16:57:48.331 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 25,0x28
2021-04-14 16:57:48.331 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 26,0x 0
2021-04-14 16:57:48.332 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 27,0x 1
2021-04-14 16:57:48.333 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 28,0x 0
2021-04-14 16:57:48.334 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 29,0xd6
2021-04-14 16:57:48.335 26029-26043/com.example.ble I/ModbusHandler: Decode Message ByteNum: 30,0x58
2021-04-14 16:57:48.335 26029-26043/com.example.ble D/ModbusHandler: CRC GOOD QTY: 1
2021-04-14 16:57:48.335 26029-26043/com.example.ble D/ModbusHandler: Populate Holding Resister Block nr: 0
2021-04-14 16:57:48.335 26029-26043/com.example.ble D/Service_BTLE_GATT: Clear Buffers
2021-04-14 16:57:48.355 26029-26037/com.example.ble I/art: Starting a blocking GC Instrumentation
2021-04-14 16:57:48.355 26029-26037/com.example.ble I/art: Enter while loop.
2021-04-14 16:57:48.495 26029-26029/com.example.ble D/BluetoothAdapter: stopLeScan()
2021-04-14 16:57:48.498 26029-26029/com.example.ble D/BluetoothAdapter: getLeState() returning 12
2021-04-14 16:57:48.498 26029-26029/com.example.ble D/BluetoothAdapter: scan not started yet
2021-04-14 16:57:48.629 26029-26029/com.example.ble D/Activity_ListViewInp: Start Input ListAdapter on CT VT and Relay 1
2021-04-14 16:57:48.659 26029-26029/com.example.ble V/PhoneWindow: DecorView setVisiblity: visibility = 4,Parent = null,this = DecorView@79093fe[]
2021-04-14 16:57:48.662 26029-26029/com.example.ble D/WindowClient: Add to mViews: DecorView@79093fe[Activity_ListViewInp],this = android.view.WindowManagerGlobal@d68a129
2021-04-14 16:57:48.664 26029-26058/com.example.ble D/OpenGLRenderer: CanvasContext() 0x751f971800
2021-04-14 16:57:48.665 26029-26029/com.example.ble D/ViewRootImpl[Activity_ListViewInp]: hardware acceleration is enabled,this = ViewRoot{a122228 com.example.ble/com.example.ble.Activity_ListViewInp,ident = 6}
2021-04-14 16:57:48.669 26029-26029/com.example.ble V/PhoneWindow: DecorView setVisiblity: visibility = 0,Parent = ViewRoot{a122228 com.example.ble/com.example.ble.Activity_ListViewInp,ident = 6},this = DecorView@79093fe[Activity_ListViewInp]
2021-04-14 16:57:48.684 26029-26058/com.example.ble D/Surface: Surface::disconnect(this=0x7526255c00,api=1)
2021-04-14 16:57:48.685 26029-26058/com.example.ble D/GraphicBuffer: unregister,handle(0x75086fbe00) (w:720 h:1280 s:720 f:0x1 u:0x000b00)
2021-04-14 16:57:48.685 26029-26058/com.example.ble D/GraphicBuffer: unregister,handle(0x7508664100) (w:720 h:1280 s:720 f:0x1 u:0x000b00)
2021-04-14 16:57:48.685 26029-26058/com.example.ble D/GraphicBuffer: unregister,handle(0x7508ba09c0) (w:720 h:1280 s:720 f:0x1 u:0x000b00)
2021-04-14 16:57:48.685 26029-26058/com.example.ble D/Surface: Surface::disconnect(this=0x7526255c00,api=1)
2021-04-14 16:57:48.825 26029-26029/com.example.ble W/art: Before Android 4.1,method int androidx.appcompat.widget.DropDownListView.lookForSelectablePosition(int,boolean) would have incorrectly overridden the package-private method in android.widget.ListView
2021-04-14 16:57:48.952 26029-26029/com.example.ble D/AndroidRuntime: Shutting down VM
2021-04-14 16:57:48.964 26029-26029/com.example.ble E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.ble,PID: 26029
java.lang.ArrayIndexOutOfBoundsException: length=16; index=16
at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:7424)
at android.widget.ListView.measureHeightOfChildren(ListView.java:1361)
at android.widget.ListView.onMeasure(ListView.java:1250)
at android.view.View.measure(View.java:20084)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:825)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:511)
at android.view.View.measure(View.java:20084)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at androidx.appcompat.widget.ContentFrameLayout.onMeasure(ContentFrameLayout.java:146)
at android.view.View.measure(View.java:20084)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
at androidx.appcompat.widget.ActionBarOverlayLayout.onMeasure(ActionBarOverlayLayout.java:490)
at android.view.View.measure(View.java:20084)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at android.view.View.measure(View.java:20084)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1705)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:797)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:657)
at android.view.View.measure(View.java:20084)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:6282)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:214)
at com.android.internal.policy.DecorView.onMeasure(DecorView.java:714)
at android.view.View.measure(View.java:20084)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:2640)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1577)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1846)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1462)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6965)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:907)
at android.view.Choreographer.doCallbacks(Choreographer.java:709)
at android.view.Choreographer.doFrame(Choreographer.java:644)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:893)
at android.os.Handler.handleCallback(Handler.java:836)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:203)
at android.app.ActivityThread.main(ActivityThread.java:6251)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1063)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:924)
2021-04-14 16:57:49.212 26029-26104/com.example.ble D/HomeFragment: ReadHolding Task Start
2021-04-14 16:57:49.212 26029-26104/com.example.ble D/Service_BTLE_GATT: Clear Buffers
2021-04-14 16:57:49.213 26029-26104/com.example.ble D/BluetoothGatt: writeCharacteristic() - uuid: 2456e1b9-26e2-8f83-e744-f34f01e9d703
2021-04-14 16:57:49.215 26029-26043/com.example.ble D/BluetoothGatt: onCharacteristicWrite() - Device=CC:F9:57:8E:60:C9 handle=25 Status=0
2021-04-14 16:57:49.310 26029-26042/com.example.ble D/BluetoothGatt: onNotify() - Device=CC:F9:57:8E:60:C9 handle=25
2021-04-14 16:57:49.311 26029-26042/com.example.ble D/Service_BTLE_GATT: QTY Bytes in rx_Data = 20
2021-04-14 16:57:49.313 26029-26076/com.example.ble D/BluetoothGatt: onNotify() - Device=CC:F9:57:8E:60:C9 handle=25
2021-04-14 16:57:49.314 26029-26076/com.example.ble D/Service_BTLE_GATT: QTY Bytes in rx_Data = 8
2021-04-14 16:57:49.316 26029-26043/com.example.ble D/BluetoothGatt: onNotify() - Device=CC:F9:57:8E:60:C9 handle=25
2021-04-14 16:57:49.317 26029-26043/com.example.ble D/Service_BTLE_GATT: QTY Bytes in rx_Data = 1
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。