简体   繁体   English

Qt Android NDK-应用程序崩溃

[英]Qt android ndk - app crashes

I've been recently trying to make some very simple app in Qt , and yesterday it used to work correctly on both Desktop and Android (using android ndk, I know it's not good to make android apps in c++, but I just want to try). 我最近一直在尝试在Qt制作一些非常简单的应用,而昨天它曾经在台式机和Android上都能正常工作 (使用android ndk,我知道用c ++制作android应用并不好,但我只想尝试)。

Today, out of nowhere, application output says sth like this: 如今,应用程序输出无处不在,像这样: 错误图片

The only thing I've found was cleaning app's cache and data, restarting phone, rebuilding, n one of these things worked 我发现的唯一一件事是清理应用程序的缓存和数据,重新启动手机,重建, 其中一项工作正常

A Qt app has an array of used .so library names, somewhere in the resources. Qt应用程序在资源中的某个位置具有使用过的.so库名称的数组。 On start-up, it loads all these .so libraries (via loadLibrary() ). 在启动时,它将加载所有这些.so库(通过loadLibrary() )。 The order in which the libraries are loaded is important: functions cannot reference functions defined in libraries that have not yet been loaded. 库的加载顺序很重要:函数不能引用尚未加载的库中定义的函数。 So implementing a circular dependency is tricky. 因此,实现循环依赖关系非常棘手。

From the logs I see that some function in libszachy_android_1.so (is it the right name? it's a bit strange) invokes srand() that has not yet been loaded; 从日志中,我看到libszachy_android_1.so中的某些函数(名称正确吗?有点奇怪)调用了尚未加载的srand() maybe, it is mentioned later in the load list, but loadLibrary() has no idea about the planned future. 也许,稍后会在负载列表中提到它,但是loadLibrary()对计划的未来一无所知。 Therefore, you get this. 因此,您得到了。

If your code worked yesterday, you likely have made some changes. 如果您的代码昨天有效,则可能已进行了一些更改。 If you use version control, you likely can compare the today's and yesterday's versions and see the difference. 如果使用版本控制,则可能可以比较今天和昨天的版本,并查看两者之间的差异。 Maybe, you have inserted a forward reference (in the load list sense). 也许,您已经插入了一个前向参考(从加载列表的角度来看)。 OTOH, sometimes both Eclipse and make cannot detect that the source has changed and make incorrect builds (I did observe this, but cannot reproduce). OTOH,有时Eclipse和make都无法检测到源代码已更改,并且生成的版本不正确(我确实注意到了这一点,但无法复制)。 Did you try to uninstall the app from the phone? 您是否尝试从手机上卸载该应用程序? Did you try to remove all existing .so files in the build directories ( rm *.so )? 您是否尝试删除了构建目录( rm *.so )中所有现有的.so文件?

Maybe, one of your .so modules is broken: sometimes an object is generated despite of errors and it may get used in subsequent builds (at least this is how I can explain the build glitches). 也许,您的.so模块之一被破坏了:有时尽管有错误仍会生成一个对象,并且该对象可能会在后续的构建中使用(至少这是我可以解释该构建故障的方式)。

Maybe, you have no memory left on the device, and the .so could not be unpacked correctly. 也许,设备上没有剩余的内存,并且.so无法正确解压。

I suggest examining the application directory with adb shell on a rooted device. 我建议在有根设备上使用adb shell检查应用程序目录。

PS you posted a screenshot that is barely readable. 附注:您张贴的屏幕截图几乎不可读。 Please replace it with the relevant portion of the adb logcat output (I hope you know how to use it; if not, the first thing to do is to learn adb logcat and adb shell ). 请用adb logcat输出的相关部分替换它(希望您知道如何使用它;否则,第一件事是学习adb logcatadb shell )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM