Libgdx Android的 - GL螺纹(NullPointerException异常)及缺少类文件 [英] Libgdx Android - GL Thread (NullPointerException) & Missing Class File

查看:275
本文介绍了Libgdx Android的 - GL螺纹(NullPointerException异常)及缺少类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是LibGdx框架来创建一个游戏,我使用Eclipse 4.4(月神)。虽然我调试我的应用程序这种方法是打破。

  @覆盖
        公共无效的run(){
            的setName(GLThread+的getId());
            如果(LOG_THREADS){
                Log.i(GLThread,开始TID =+的getId());
            }            尝试{
                guardedRun();
            }赶上(InterruptedException的E){
                //下跌直通和正常退出
            } {最后
                sGLThreadManager.threadExiting(本);
            }
        }

GLSurfaceView Android的类中,与堆栈跟踪:

 发[GLThread 232](暂停(例外的NullPointerException))
    GLSurfaceView $ GLThread.run()行:1243

我知道一个NullPointerException异常是什么,我知道什么地方是传递一个空值,但我想知道的是我怎么能找到在哪里呢?

使用这些类型的问题,我只能假设你需要更多的code,但我不知道我应该寻找,我会从Java类要求张贴code,如果任何人有,我应该找一个想法。

请注意:我不使用GLSurfaceView在我的code直接任意位置,我假定这是一个从Libgdx库。除非它是我丢失的东西?

更新:发现问题的详细

  GLSurfaceView $ GLThread.class [在android.opengl [在C:\\用户\\我\\应用程序数据\\本地\\ Android的\\ Android的SDK \\ \\平台Android的8 \\的android.jar ]] 不存在


解决方案

解决方案:

这是 AtlasRegion 正在从渲染类调用,而不在资产类因此空异常

<一个href=\"http://stackoverflow.com/questions/218384/what-is-a-null-pointer-exception-and-how-do-i-fix-it\">What是一个空指针异常,以及如何解决它?

更改该到被宣布为现场解决了这个问题,我在code面。

有关解决后端问题:

  GLSurfaceView $ GLThread.class [在android.opengl [在C:\\用户\\我\\应用程序数据\\本地\\ Android的\\ Android的SDK \\ \\平台Android的8 \\的android.jar ]] 不存在

我下载的源$ C ​​$ CS由谷歌,并指定源$ C ​​$ c中的SDK文件夹内, C:\\用户\\我\\应用程序数据\\本地\\ Android的\\ Android的SDK \\源\\ ,如果您还没有一个源文件夹创建一个,把资源在那里,它应该重新加载正在处理的类。 (在这种情况下, GLSurfaceView.class 的API 2.2)

另一种方式在Eclipse 4.4(月神)或任何其它Eclipse我相信,再上项目文件夹,右键单击> 性状&gt; Java构建路径并分配的android.jar 在源文件中的依赖库。

i'm using the LibGdx framework to create a game and I'm using Eclipse 4.4 (Luna). Whilst i'm debugging my application this method is breaking.

@Override
        public void run() {
            setName("GLThread " + getId());
            if (LOG_THREADS) {
                Log.i("GLThread", "starting tid=" + getId());
            }

            try {
                guardedRun();
            } catch (InterruptedException e) {
                // fall thru and exit normally
            } finally {
                sGLThreadManager.threadExiting(this);
            }
        }

inside the GLSurfaceView Android class, with the stack trace:

Thread [GLThread 232] (Suspended (exception NullPointerException))  
    GLSurfaceView$GLThread.run() line: 1243 

I know what a NullPointerException is, I know somewhere is passing a null value, but what I would like to know is how can I find out where?

With these types of questions, I can only assume you'll need more code but I don't know where I should be looking, I'll post code from the Java classes on request if anyone has an idea of where I should be looking.

Note: I'm not using GLSurfaceView directly anywhere in my code, I'm assuming it's a library from Libgdx. Unless it's something i'm missing?

UPDATE: Found the issue in detail.

GLSurfaceView$GLThread.class [in android.opengl [in C:\Users\me\AppData\Local\Android\android-sdk\platforms\android-8\android.jar]] does not exist

解决方案

Solution:

An AtlasRegion was being called from the renderer class without being assigned a value in the assets class hence the null Exception

What is a Null Pointer Exception, and how do I fix it?

changing that to a field that is declared solved this problem for me on the code side.

For the solution to the backend issue:

GLSurfaceView$GLThread.class [in android.opengl [in C:\Users\me\AppData\Local\Android\android-sdk\platforms\android-8\android.jar]] does not exist

I downloaded source codes from Google, and assigned the source code inside the SDK folder, C:\Users\me\AppData\Local\Android\android-sdk\sources\, if you don't already have a source folder create one, put the sources in there and it should reload the class that was being handled. (in this case GLSurfaceView.class for API 2.2)

Another way In Eclipse 4.4 (Luna) or any other eclipse I do believe, go onto your project folder right click > properties > java build path and assign the source file for android.jar in your dependent libraries.

这篇关于Libgdx Android的 - GL螺纹(NullPointerException异常)及缺少类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆