gpt4 book ai didi

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

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:26:26 24 4
gpt4 key购买 nike

所以我刚刚设置 Eclipse 以使用 Gradle 与 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 并选择你喜欢的版本

关于java - 程序在 LibGDX -desktop 上运行良好,但在 LibGDX - Android 上运行不正常?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23094436/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com