Eclipse 中的 NoClassDefFoundError [英] NoClassDefFoundError in Eclipse

查看:33
本文介绍了Eclipse 中的 NoClassDefFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以基本上我一直在使用 libgdx 制作游戏,最近我开始尝试添加 Google Play 游戏服务,所以我尝试了它,似乎我已经完全搞砸了我的 .xml 文件我试过查看诸如 如何解决此 Java Class not found 异常?NoClassDefFoundError - Eclipse 和 Android,但无济于事.

So essentially I've been making a game using libgdx and just recently I started to try and add Google Play Game Services and So I tried my hand at it and it seems as though I have completely messed up my .xml file I've tried looking at questions such as How do I resolve this Java Class not found exception? and NoClassDefFoundError - Eclipse and Android, but to no avail.

这是我收到的运行时错误.

Here is the runtime error I am recieving.

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]]

类名称是 MainActivity.Java,它在 src 文件中.我知道这是因为以下两个原因之一:我的 .class 文件或 .xml 文件.所以这里也是我的 .xml 文件,以防万一我做错了,而不是在任何 .class 文件中.

The class Name is MainActivity.Java and it is in the src file. I understand that this is done because of one of two things: My .class file, or the .xml file. So here is also my .xml file just in case what I have done wrong is there and not in fact in any .class file.

<?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" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

然而,我已经把这个 xml 文件弄乱了很多,所以我不相信它在这里,我的整个问题必须在某个 .class 文件中的某个地方,但我甚至不明白如何从 Eclipse 中访问那些在 StackOverflow 上提出的其他问题.

However I've messed around with this xml file quite a lot and so I do not believe it is in here and that My whole problem has to be in some .class file somewhere, but I don't even understand how to access those from eclipse from going off of other questions asked here on StackOverflow.

推荐答案

试试这个:

转到 Project/Properties/Java Build Path/Order and Export -- 确保在 Android 依赖项和支持库前面有一个检查,如果你使用它.标记所有复选框并单击应用并清理项目.

Go to Project/Properties/Java Build Path/Order and Export -- Make sure there's a check in front of Android Dependencies and the support library, if you use it.Mark all checkboxes and Click on Apply and clean the project.

希望这会有所帮助.

这篇关于Eclipse 中的 NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆