【问题标题】:How to fix NoClassFoundError in android如何修复 Android 中的 NoClassdefFoundError
【发布时间】:2012-05-08 11:25:08
【问题描述】:

我在不同的项目中有两个课程。

我正在导入具有我需要的类的项目。 现在,我没有错误。

该项目知道那个类,我什至从那个类中创建了一个对象,但是当我尝试运行它时,它会被 "NoClassFoundError" 粉碎。

我该如何解决这个问题?

import com.dmg.pixelservice.core.*;
import android.app.Activity; 
import android.os.Bundle;
public class show extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Pixel pixel = new Pixel();
    pixel.doIt(this,"fd7ccf36-3f85-11e1-8671-40409e0f44a1",true);
    setContentView(R.layout.main);
}
}

当我调试时,我可以看到当我尝试执行 Pixel pixel = new Pixel(); 时它崩溃了

请帮忙。

【问题讨论】:

标签: android noclassdeffounderror


【解决方案1】:

在您的应用程序中创建新的 libs 文件夹。名称必须相同。并将您的 jar 文件放在此文件夹中。并且 去 java构建路径->配置构建路径->添加jars

【讨论】:

    【解决方案2】:

    看起来包含 Pixel 类的 jar 文件没有打包到 APK 中。

    要做到这一点,您似乎需要将 jar 复制到您的 Android 项目的 libs 文件夹中。

    看到这个问题:
    Approach for fixing NoClassDefFoundError?

    Android 开发者指南:
    http://developer.android.com/guide/developing/projects

    【讨论】:

      【解决方案3】:

      如果你发送你的 Pixel 类的 src 代码,很容易发现错误。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-08-04
        • 1970-01-01
        • 2021-08-17
        • 1970-01-01
        相关资源
        最近更新 更多