【发布时间】:2013-11-19 11:54:08
【问题描述】:
我正在尝试开始一项活动
`package com.kapzlock.mytestproject;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
public class Splash extends Activity{
@Override
protected void onCreate(Bundle SomeVar) {
// TODO Auto-generated method stub
super.onCreate(SomeVar);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run(){
try{
sleep(5000);
}
catch(InterruptedException e){
e.printStackTrace();
}
finally{
Intent openStartingPoint = new Intent("com.kapzlock.mytestproject.MAINACTIVITY");
startActivity(openStartingPoint);
}
}
};
timer.start();
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}
}
`
Manifest xml 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.kapzlock.mytestproject"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name=".Splash"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="com.kapzlock.mytestproject.MAINACTIVITY" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
</application>
</manifest>
它编译没有问题,但是当我运行 Splash.class 时,我得到一个Exception in thread "main" java.lang.NoClassDefFoundError: android/app/Activity 错误。包名是 com.kapzlock.mytestproject,我引用的类是 MainActivity.class。有人知道错误可能出在哪里吗?
【问题讨论】:
-
您是否导入任何其他 jar 文件?
标签: java android noclassdeffounderror