程序在 LibGDX -desktop 上运行良好,但在 LibGDX - Android 上运行不佳?

2024-03-31

因此,我刚刚使用 Gradle 设置 Eclipse 来与 LibGDX 一起使用。安装后我发现Android软件包有问题,软件包旁边有一个红十字。当我进一步打开它时,src 旁边有一个红叉,然后是 com.myname.game.android,然后是 AndroidLauncher.java。当我打开 AndroidLauncher.java 时,这是我得到的代码:

package com.faturbansloth.game.android;

import android.os.Bundle;

import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.faturbansloth.game.MyGame;

public class AndroidLauncher extends AndroidApplication {
    @Override
    protected void onCreate (Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AndroidApplicationConfiguration config = new     AndroidApplicationConfiguration();
        initialize(new MyGame(), config);
    }
}    

当我查看 AndroidLauncher.java 代码中的错误时,他们说:

-The type android.os.Handler cannot be resolved. It is indirectly referenced from 
required .class files 
-The import android.os.Bundle cannot be resolved
-Multiple markers at this line
- The type android.app.Activity cannot be resolved. It is indirectly referenced from 
 required .class files
- The hierarchy of the type AndroidLauncher is inconsistent
-Bundle cannot be resolved to a type   

我正在使用 SDK Manager 22.6.2 和最新的 Eclipse Gradle 插件。我有 JRE 8 和 JDK 7。有办法解决这个问题吗?提前致谢。


默认情况下没有选择 Android 版本,因此请执行以下操作:Project -> Properties -> Android -> Project Build Target并选择您喜欢的版本

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

程序在 LibGDX -desktop 上运行良好,但在 LibGDX - Android 上运行不佳? 的相关文章

随机推荐