ClassNotFoundException Android,但类存在

时间:2014-05-20 10:31:59

标签: android rss classnotfoundexception

我正在开发一个从RSS源读取数据的应用程序。我没有开发应用程序,我正在尝试修复一个导致它停止工作的错误。当我尝试使用模拟器在我的计算机上运行它时,我的logcat显示以下内容:

有人能解释一下这个问题吗?它似乎在告诉我它无法找到一个名为NewsRssActivity的类,但我可以清楚地看到它在项目资源管理器窗口中列出。

05-20 10:26:51.378: E/AndroidRuntime(1027): FATAL EXCEPTION: main
05-20 10:26:51.378: E/AndroidRuntime(1027): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.newsrss.Feed/com.newsrss.Feed.NewsRssActivity}: java.lang.ClassNotFoundException: com.newsrss.Feed.NewsRssActivity
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1880)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.ActivityThread.access$600(ActivityThread.java:123)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.os.Handler.dispatchMessage(Handler.java:99)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.os.Looper.loop(Looper.java:137)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.ActivityThread.main(ActivityThread.java:4424)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at java.lang.reflect.Method.invokeNative(Native Method)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at java.lang.reflect.Method.invoke(Method.java:511)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at dalvik.system.NativeStart.main(Native Method)
05-20 10:26:51.378: E/AndroidRuntime(1027): Caused by: java.lang.ClassNotFoundException: com.newsrss.Feed.NewsRssActivity
05-20 10:26:51.378: E/AndroidRuntime(1027):     at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
05-20 10:26:51.378: E/AndroidRuntime(1027):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1871)
05-20 10:26:51.378: E/AndroidRuntime(1027):     ... 11 more

清单

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.newsrss.Feed" android:versionCode="2" android:versionName="1.1">
    <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="15"
        android:maxSdkVersion="17" />
    <uses-feature android:glEsVersion="0x00020000"
        android:required="true" />
    <permission android:name="com.newsrss.Feed.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />
    <uses-permission android:name="com.newsrss.Feed.permission.MAPS_RECEIVE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission
        android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <application android:label="@string/app_name" android:icon="@drawable/app_icon"
        android:theme="@style/Theme.Sherlock.Light.NoActionBar">
        <activity android:name="NewsRssActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.newsrss.Feed.DetailsArticle" />
        <activity android:name="com.newsrss.Feed.DetailsPodcast" />
        <activity android:name="com.newsrss.Feed.DetailsJobs" />
        <activity android:name="com.newsrss.Feed" />
        <activity android:name="com.newsrss.Feed.Legal" />
        <activity android:name="com.newsrss.Feed.SearchActivity"
            android:windowSoftInputMode="adjustPan" />
        <activity android:name="com.newsrss.Feed.DetailsSearch" />
        <activity android:label="@string/app_name" android:name="com.facebook.LoginActivity" />
        <activity android:name="com.newsrss.Feed.MapActivity" />
        <meta-data android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/app_id" />
        <meta-data android:name="com.google.android.maps.v2.API_KEY"
            android:value="AIzaSyCHdfGghvsiLqmv6e_jUCnPfBW3FjZ7YYI" />
    </application>
</manifest>

NewsRssActivity.java

package com.newsrss.Feed;

import android.app.Dialog;
import android.app.LoaderManager;
import android.app.ProgressDialog;
import android.content.*;
import android.content.pm.ActivityInfo;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.text.Html;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.*;
import com.facebook.Session;
import com.fortysevendeg.swipelistview.BaseSwipeListViewListener;
import com.fortysevendeg.swipelistview.SwipeListView;
import com.google.analytics.tracking.android.EasyTracker;
import com.slidingmenu.lib.SlidingMenu;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


public class NewsRssActivity extends shaerToSocial {

1 个答案:

答案 0 :(得分:0)

检查您的活动是否在Manifest中定义:

<activity
      android:name="com.newsrss.Feed.NewsRssActivity">
</activity>