问题
i had no project in eclipse, and i just followed the steps in this toturial: https://www.youtube.com/watch?v=S9fs1PVTyUc&src_vid=6i78aqugqds&feature=iv&annotation_id=annotation_4141831685
and it opened for me a few projects named: project, project-android, project-core, project-desktop, project-ios.
and the project-android had an error. here is the code:
package com.ak01.projext.android;*
import android.os.Bundle;**
import com.badlogic.gdx.backends.android.AndroidApplication;
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
import com.ak01.projext.Projec;
public class AndroidLauncher extends AndroidApplication {***
@Override
protected void onCreate (Bundle savedInstanceState) {****
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new
AndroidApplicationConfiguration();
initialize(new Project(), config);
}
}
but it has a few errors although i didn't touch it yet(the number of *'s matches to the line)
*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
回答1:
It looks like you have not installed the Android developer tools. To test this, right click your project and press build path. On the side there should be an 'Android' tab, if there isn't you need the android plugin for eclipse.
回答2:
You can try to use the advanced option to check eclipse as @Tuss said in a comment. Also note that you need the version 19 of Android SDK (it isn't valid the last version at the time of writing this, API 23).
When creating the Libgdx project:
- In Libgdx Project Generator open Advanced options.
- Check Eclipse.
- Generate your project.
In Eclipse:
- Open Android SDK Manager: Window -> Android SDK Manager.
- Mark if it isn't installed the SDK Plataform for Android 4.4.2 (API 19) and install it.
- Finally import the projects with File -> Import -> General -> Existing Projects into Workspace.
来源:https://stackoverflow.com/questions/28283193/bugs-in-eclipse-after-installing-libgdx