首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安卓光标= mydatabase.rawQuery中断应用信号11

安卓光标= mydatabase.rawQuery中断应用信号11
EN

Stack Overflow用户
提问于 2020-05-24 04:29:48
回答 1查看 66关注 0票数 0

我知道以前也有人问过类似的问题,但这让我心烦意乱。我已经研究过这个错误,当您引用数组中超出其界限的某个部分时,它似乎大部分会弹出,但是只有在API低于23的虚拟设备上运行应用程序时,这个错误才会发生。它在上面失败的机器是API 22上的Galaxy,但是它在带有API 22的Nexus 4上也发生了故障。我还用API 23在一个虚拟的Nexus 4上测试了它,它可以工作,上面的每个API都能工作。我希望我的最小SDK更低,但在我解决这个问题之前,这是不可能的。下面是一些代码,以帮助你们天才看到什么让我发疯。

(游标resultSet是全局设置的,但这并没有什么区别) resultSet = mydatabase.rawQuery("SELECT * FROM words WHERE" + allowRepeats + " frequency >= 0 ORDER BY RANDOM() LIMIT 1",null); -THIS是不管我做什么都会中断的行。

此代码呈现给"SELECT * FROM words WHERE solved < 1 AND frequency >= 0 ORDER BY RANDOM() LIMIT 1",此代码适用于22以上的每个API,但在22上运行时,我得到错误"A/libc:致命信号11 (SIGSEGV),代码1,tid 27273 (ics.choicewords)中的错误addr0x2c“。

关于我尝试过的内容的一些注释:我已经确保了数据库的存在,就像我说的,它可以在其他API上工作。

我尝试过将游标设置为空,并返回空字符串作为结果,而不是任何数据,这很好,但当然不是一个选项。

rawQuery在一个循环4次的循环中运行,但是取出它,只运行一次单行,仍然会出现相同的错误。

错误日志:

代码语言:javascript
复制
I/art: Rejecting re-init on previously-failed class java.lang.Class<Tz>
    Rejecting re-init on previously-failed class java.lang.Class<Tz>
W/cr_media: Requires BLUETOOTH permission
E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
D/: HostConnection::get() New Host Connection established 0xae9b0880, tid 5080
E/chromium: [ERROR:gl_surface_egl.cc(411)] eglChooseConfig failed with error EGL_SUCCESS
D/EGL_emulation: eglCreateContext: 0xae9bf7c0: maj 2 min 0 rcv 2
I/Ads: This request is sent from a test device.
D/EGL_emulation: eglMakeCurrent: 0xae9bf7c0: ver 2 0 (tinfo 0xae839eb0)
E/chromium: [ERROR:gl_surface_egl.cc(411)] eglChooseConfig failed with error EGL_SUCCESS
I/DynamiteModule: Considering local module com.google.android.gms.ads.dynamite:0 and remote module com.google.android.gms.ads.dynamite:21001
    Selected remote version of com.google.android.gms.ads.dynamite, version >= 21001
V/DynamiteModule: Dynamite loader version >= 2, using loadModule2NoCrashUtils
I/art: Background partial concurrent mark sweep GC freed 2186(176KB) AllocSpace objects, 1(12KB) LOS objects, 33% free, 7MB/11MB, paused 9.052ms total 67.508ms
W/Ads: Invoke Firebase method getInstance error.
    The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date
I/VideoCapabilities: Unsupported profile 4 for video/mp4v-es
W/cr_MediaCodecUtil: HW encoder for video/avc is not available on this device.
D/EGL_emulation: eglCreateContext: 0xaea6c640: maj 2 min 0 rcv 2
D/EGL_emulation: eglMakeCurrent: 0xaea6c640: ver 2 0 (tinfo 0xae839eb0)
A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x2c in tid 4979 (ics.choicewords)```
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-02-22 23:22:46

我很久以前就修复了这个错误,所以我不完全确定如何修复,但是回顾一下我的旧代码,似乎是在没有匹配查询的结果时创建了错误。之后,我通过检查resultSet计数来解释这一点,如果它是< 1,我用一组任意值替换了resultSet,我的应用程序会理解这些值意味着没有结果。这解决了问题!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61981658

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档