Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/191.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 程序在LibGDX-desktop上运行良好,但在LibGDX-Android上运行不好?_Java_Android_Eclipse_Gradle_Libgdx - Fatal编程技术网

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

Java 程序在LibGDX-desktop上运行良好,但在LibGDX-Android上运行不好?,java,android,eclipse,gradle,libgdx,Java,Android,Eclipse,Gradle,Libgdx,所以我刚刚设置了Eclipse,使用Gradle与LibGDX一起工作。安装后,我注意到Android软件包有问题,软件包旁边有一个红十字。当我进一步打开它时,src旁边有一个红十字,然后是com.myname.game.android,然后是AndroidLauncher.java。当我打开AndroidLauncher.java时,我得到的代码是: package com.faturbansloth.game.android; import android.os.Bundle; impo

所以我刚刚设置了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管理器22.6.2和最新的Eclipse Gradle插件。我有JRE 8和JDK 7。有没有办法解决这个问题?提前谢谢。

我不知道为什么会这样,但对我来说确实如此。我安装了ADT插件,刷新了android部分,红十字会消失了

请参阅“下载ADT插件”部分以安装ADT插件。


之后,转到Eclipse>软件包浏览器>左键单击Project android>选择刷新。

默认情况下没有选择android版本,因此转到:
Project->Properties->Android->Project Build Target
并选择您喜欢的版本

我想您看到了:谢谢,我在搜索时没有注意到这一点。太好了:成功了(现在我注意到日志中的错误:
无法解析目标“Android-19”
,这可能是一个提示)