程序运行良好LibGDX -desktop而不是LibGDX - Android? [英] Programs run fine with LibGDX -desktop but not LibGDX - Android?
问题描述
所以我刚刚设置了Eclipse,使用Gradle来处理LibGDX。安装完成后,我注意到Android软件包出现问题,软件包旁边有一个红十字交叉口。当我进一步打开它时,在src旁边有一个红色的十字架,然后是com.myname.game.android,然后在AndroidLauncher.java中。当我打开AndroidLauncher.java时,这是我得到的代码:
So I have just set up Eclipse to work with LibGDX using Gradle. After I installed I noticed there was a problem with the Android package, there was a red cross next to the package. When I opened it further there was a red cross next to src then com.myname.game.android and then in AndroidLauncher.java. When I opened the AndroidLauncher.java, this was the code I got:
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的代码中的错误他们在说:
When I looked at the errors in he code of AndroidLauncher.java they were saying:
-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.有没有解决这个问题?谢谢提前。
I am using SDK Manager 22.6.2 with the newest Gradle plugin for Eclipse. I have JRE 8 and JDK 7. Is there anyway to fix this problem? Thanks in advance.
推荐答案
默认情况下没有选择Android版本,所以去:
项目 - >属性 - > Android - >项目构建目标
并选择您的首选版本
There was no Android Version selected by default, so go:
Project -> Properties -> Android -> Project Build Target
and select your preferred version
这篇关于程序运行良好LibGDX -desktop而不是LibGDX - Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!