android - 没有发现类定义错误 (android)

标签 android

我正在开发一个应用程序,我可以启动我的 Launcher Activity ,它有两个按钮。单击这些按钮中的任何一个时,应打开一个新 Activity 。但是,随后会发生运行时错误。


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class Intro extends Activity {

    Button searchBut, fbButton;

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AppSettings.loadLogin(getApplicationContext());
        setContentView(R.layout.intro);
        if (AppSettings.logged) {
            Intent a = new Intent(Intro.this, AllChallengesPager.class);
            a.putExtra("logging", "0");
            startActivity(a);
        }
        searchBut = (Button) findViewById(R.id.button2);
        searchBut.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent a = new Intent(Intro.this, DetailedChallenge.class);
                a.putExtra("logging", "0");
                startActivity(a);
            }
        });
        fbButton = (Button) findViewById(R.id.fbBut);
        fbButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent a = new Intent(Intro.this, AllChallengesPager.class);
                a.putExtra("logging", "1");
                startActivity(a);
            }
        });
        AppSettings.loadLogin(getApplicationContext());
    }
}

06-07 11:26:07.776: E/AndroidRuntime(13305): FATAL EXCEPTION: main
06-07 11:26:07.776: E/AndroidRuntime(13305): java.lang.NoClassDefFoundError: com.loopj.android.http.RequestParams
06-07 11:26:07.776: E/AndroidRuntime(13305):    at com.example.challengeZygio.DetailedChallenge.onCreate(DetailedChallenge.java:216)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.Activity.performCreate(Activity.java:5047)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1094)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2056)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2117)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.ActivityThread.access$700(ActivityThread.java:134)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1218)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.os.Looper.loop(Looper.java:137)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at android.app.ActivityThread.main(ActivityThread.java:4867)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at java.lang.reflect.Method.invokeNative(Native Method)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at java.lang.reflect.Method.invoke(Method.java:511)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
06-07 11:26:07.776: E/AndroidRuntime(13305):    at dalvik.system.NativeStart.main(Native Method)

- 我所有的 jar 库都放在 libs 文件夹中 - 我已经多次清理项目并重新启动 Eclipse - 我正在使用具有所有最新更新的 Eclipse Juno

最佳答案

右键单击您的项目 -> Properties -> Java Build Path -> Order & Export

到达此处后,您使用的库“选择”这些库并将它们移至列表顶部。也就是说,假设您使用了“xyz.jar”文件,那么接下来就是您的序列。

[x] xyz.jar
[x] Android x.x
[x] 安卓依赖 ....

清理后保存更改并重建项目。

关于android - 没有发现类定义错误 (android),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16980159/

相关文章:

android - 限制矩形区域,Google Maps V2

android - Cache 当前正在被另一个 Gradle 实例使用

java - 在 Android 中为涂抹/Swing 效果制作矩阵(见图片)

android - 如何使用 Google 身份验证在 Microsoft MobileServiceClient 上切换用户

android - 在我的案例中,根据平台版本加载布局文件

android - 使用 selectionArgs 在查询中不起作用

c# - Xamarin - 推送通知 - 触发服务器更新数据

java - 简单的进出动画与android

java - 从 Android 中的用户触摸事件中播种 SecureRandom

android - 如何在 Android 和 IOS 中创建基本的 Google Glass 应用程序