0

while I was working on an Android screensaver application, I am encountering the ClassNotFoundException and my application stopped unexpectedly.

The logcat had the following error log -

    08-24 07:53:36.973: E/AndroidRuntime(14984): Caused     by:java.lang.ClassNotFoundException:  Didn't find class "com.example.actualscsaver.MainDayDream" on path: DexPathList[[zip file "/data/app/com.example.actualscsaver-2.apk"],nativeLibraryDirectories=[/data/app-lib/com.example.actualscsaver-2, /system/lib]]
08-24 07:53:36.973: E/AndroidRuntime(14984):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)

And, here is my manifest file -

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.actualscsaver"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <service
android:name=".MainDayDream"
android:exported="true"
android:label="Image Slide DayDream">
<intent-filter>
    <action android:name="android.service.dreams.DreamService" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</service>
<activity
        android:name="com.example.actualscsaver.MainDayDream"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MainDayDream" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.actualscsaver.photoDbAdapter"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.photoDbAdapter" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.example.actualscsaver.photoDbHelper"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.photoDbHelper" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.actualscsaver.Utilities"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.Utilities" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
</application>
</manifest>

I have searched other forums, read articles online, but I was unable to get a solution for this problem. According to my searches, I found some solutions like restarting the eclipse and emulator, updating SDK, Checking for required libraries, etc. But, nothing worked for me. Can any one please tell me, where I did mistake? Is there any other reasons for this exception?

Thanks in advance.

4

3 回答 3

0

See, you have given the same name (MainDayDream) for a service and also an activity. So, the problem occurs.

Try giving different names for those..

于 2013-08-24T12:17:16.717 回答
0

try this:

<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />

Replace this in the node of First Activity that is loaded when the application starts

hope it helps

于 2013-08-24T12:37:40.393 回答
0

Hi have solved the problem. I made a mistake in Manifest file, I have mistyped the class name in Lower case. I rectified it, now thw application is running.

于 2013-08-27T10:13:19.113 回答