libgdx 游戏在某些设备上崩溃

libgdx game crashes on some devices(libgdx 游戏在某些设备上崩溃)
本文介绍了libgdx 游戏在某些设备上崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

应用程序启动后,我的应用程序在设备上崩溃且没有错误消息.这只发生在三星 Note 1 上(至少,不能在所有设备上测试),而不是摩托罗拉 Moto G 或 Galaxy s4mini.我得到的唯一提示是在调试器中.我贴在下面.到底发生了什么以及为什么它只在某些设备上崩溃?

Right after start of app, my app crushes without error message on a device. This only happens on Samsung Note 1(at least, can't test on all devices), but not on Motorola Moto G or Galaxy s4mini. The only hint I get is in the debugger. I pasted it below. What exactly is happening and why it crashes only on some devices?

从正在运行的应用程序"菜单返回应用程序时,它也会崩溃.注 1 已安装 CyanogenMod.也许这与崩溃有关.

it crashes also on return to the app from "running apps" menu. Note 1 has CyanogenMod installed. Maybe this has something to do with the crashing.

Edit2:另一个观察:注 1 只分配了一半的内存作为其他两个设备.这与崩溃有什么关系吗?

Another observation: note 1 allocates only a half of the memory as the other two devices. Has this anything to do with the crash?

01-05 17:00:16.212 13486-13513/com.mygdx.myGame.android D/dalvikvm: Trying to load lib /data/app-lib/com.mygdx.myGame.android-2/libgdx-freetype.so 0x42441a58
    01-05 17:00:16.222 13486-13513/com.mygdx.myGame.android D/dalvikvm: Added shared lib /data/app-lib/com.mygdx.myGame.android-2/libgdx-freetype.so 0x42441a58
    01-05 17:00:16.222 13486-13513/com.mygdx.myGame.android D/dalvikvm: No JNI_OnLoad found in /data/app-lib/com.mygdx.myGame.android-2/libgdx-freetype.so 0x42441a58, skipping init

推荐答案

"JNI_OnLoad" 函数对于安卓应用来说不是必需的.这甚至不是错误.您的问题来自代码的另一部分.即使你没有提供这个功能,你的程序也应该可以正常运行.

The function "JNI_OnLoad" is not essential for an android app. It is not even an error. Your problem is from another part of your code. Even if you have not provided this function, your program should run normally.

对 JNI_OnLoad 有帮助的参考 - 链接1 |链接2 |链接3

References on JNI_OnLoad which can be helpful - Link 1 | Link 2 | Link 3

有一种修复方法不过-

尝试使用ndk-gdb修复它.

Try to use ndk-gdb to fix it.

ndk-gdb 参考 - developer.android.com |Stackoverflow

References for ndk-gdb - developer.android.com | Stackoverflow

与我从事的大多数项目一样,我确实遇到了这个问题.这与 Android 应用程序崩溃无关.

I do have this issue in like most of the projects I have worked on. It is nothing related to Android app getting crashed.

您的应用中还有其他问题正在崩溃.需要考虑的一些提示可以帮助您进行调试-

There is something else in your app that is crashing. Some tips to consider which will help you debug-

  1. 检查 Playstore(如果它在 Playstore)的日志(究竟是什么错误).它们提供有助于调试的堆栈跟踪.

  1. Check Playstore(if its on playstore) for logs(what exactly the error is). They give stack trace which helps to debug.

如果它不在 Playstore 上,唯一的方法是在出现错误的移动设备上进行远程调试.

If its not on Playstore, only way to go forward is to do remote debug on the mobile which is giving the error.

我有过这样的经历,而且大部分时间都是因为 API 的变化.我的意思是,API 会从一个 Android 版本更改为另一个(Kitkat 到 Lollipop - 有很多重大变化!)检查一次.因此,我的大多数应用程序都有很多问题.

I have had such experiences, and its MOST OF THE TIME because of API change. What I mean is, APIs would have changed from one Android version to another(Kitkat to Lollipop - there are lots of breaking changes!) Check this once. Most of my apps had lots of issues because of this.

在涉及到 DB(sqlite 或您在手机上使用的任何东西)交易时,一些手机是严格的.我的意思是,在其中一个应用程序中,当数据库在所有事务结束时没有关闭时,该应用程序在大多数三星 &宏达手机.虽然它在大多数其他手机上运行良好.

Some mobile's are strict when it comes to DB(sqlite or whatever you use on the phone) transactions. I mean, in one of the application, when the DB was not closed at the end of all transactions, the app was getting Force closed in most Samsung & HTC mobile phones. While it worked very well on most other phones.

希望对您有所帮助 :) 编码愉快!

Hope it helps :) Happy coding!

这篇关于libgdx 游戏在某些设备上崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How to target newer versions in .gitlab-ci.yml using auto devops (java 11 instead of 8 and Android 31 instead of 29)(如何在.gitlab-ci.yml中使用自动开发工具(Java 11而不是8,Android 31而不是29)瞄准较新的版本)
Android + coreLibraryDesugaring: which Java 11 APIs can I expect to work?(Android+core LibraryDesugering:我可以期待哪些Java 11API能够工作?)
How to render something in an if statement React Native(如何在If语句中呈现某些内容Reaction Native)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Using Firebase Firestore in offline only mode(在仅脱机模式下使用Firebase FiRestore)
Crash on Google Play Pre-Launch Report: java.lang.NoSuchMethodError(Google Play发布前崩溃报告:java.lang.NoSuchMethodError)