基本上我一直在使用libgdx开发游戏,最近我开始尝试添加Google Play游戏服务,所以我尝试了它,似乎我已经完全搞砸了我的.xml文件,我试过看了诸如如何解决此Java类未找到异常等问题?和NoClassDefFoundError - Eclipse和Android,但无济于事.
这是我收到的运行时错误.
02-19 19:25:17.772: E/AndroidRuntime(25746): FATAL EXCEPTION: main
02-19 19:25:17.772: E/AndroidRuntime(25746): Process: com.coppercow.minerman, PID: 25746
02-19 19:25:17.772: E/AndroidRuntime(25746): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.coppercow.minerman/com.coppercow.minerman.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.coppercow.minerman.MainActivity" on path: DexPathList[[zip file "/data/app/com.coppercow.minerman-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.coppercow.minerman-2, /vendor/lib, /system/lib]]
Run Code Online (Sandbox Code Playgroud)
类名是MainActivity.Java,它位于src文件中.我知道这是因为以下两件事之一:我的.class文件或.xml文件.所以这里也是我的.xml文件,以防万一我做错了,实际上并没有在任何.class文件中.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.coppercow.minerman"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="19" />
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name" >
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> …Run Code Online (Sandbox Code Playgroud) 好吧所以我真的很困惑我之前已经旋转了精灵并且没有任何问题,例如当船在海洋中移动时旋转船,但由于某种原因,这次我有一个非常大的问题.所以我在资源文件中创建一个纹理,但不是静态纹理.我使用以下内容加载纹理:
class Assets{
Texture img;
public Assets(){
img = new Texture(Gdx.files.internal("images/PNG.png")
Run Code Online (Sandbox Code Playgroud)
然后我通过调用以下方法调用主类中的资产:
Assets assets = new Assets()
Run Code Online (Sandbox Code Playgroud)
然后我有一个专门为这个主角设计的动画师,因为他的动画与其他角色有很大不同.
class Animations{
Guy MYGUY;
Texture firstTexture;
ArrayList<Texture> running;
Sprite CurrentSprite;
public Animations(Texture standingStill, Guy myGuy){
MYGUY = myGuy;
firstTexture = standingStill;
running = new ArrayList<Texture>();
running.add(firstTexture);
CurrentSprite = new Sprite(firstTexture);
public void update (int direction, int state){
CurrentSprite.setPosition(MYGUY.X, MYGUY.Y)
// I have a switch here, but it does nothing yet because I haven't added in different actions for the character.
//However I …Run Code Online (Sandbox Code Playgroud)