android – 无法实例化java.lang.ClassNotFoundException活动

前端之家收集整理的这篇文章主要介绍了android – 无法实例化java.lang.ClassNotFoundException活动前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我在开发周期中已经看过几次以下错误,现在我刚刚收到错误报告.我不知道是什么造成了这个.在本网站上阅读有关此问题的类似问题后,我再次检查了我的 AndroidManifest,一切看起来都不错.关于什么可能导致这种异常的任何想法?
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.jerrellmardis.ridecta/com.jerrellmardis.ridecta.ui.StopTimesActivity}: java.lang.ClassNotFoundException: com.jerrellmardis.ridecta.ui.StopTimesActivity
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
at android.app.ActivityThread.access$600(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.jerrellmardis.ridecta.ui.StopTimesActivity
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
... 11 more

另外需要注意的是,我使用的是在https://github.com/petedoyle/android-support-v4-googlemaps找到的android-support-v4-googlemaps lib,它允许我在Fragment中嵌入一个MapView(以及ActionBarSherlock lib).这个异常似乎是一个依赖问题,我不确定它是否与我如何使用上面提到的lib有关.

这是清单文件

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.jerrellmardis.ridecta"
    android:installLocation="internalOnly"
    android:versionCode="11"
    android:versionName="1.0.2">
    <uses-sdk
        android:minSdkVersion="10"
        android:targetSdkVersion="16"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.VIBRATE"/>
    <uses-permission android:name="android.permission.WAKE_LOCK"/>
    <uses-permission android:name="com.android.vending.BILLING"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
    <application
        android:name=".RideCtaApplication"
        android:allowBackup="true"
        android:backupAgent=".backup.RideCtaBackupAgentHelper"
        android:hardwareAccelerated="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:logo="@drawable/logo">
        <uses-library android:name="com.google.android.maps"/>
        <activity
            android:name=".ui.HomeActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta.logoOnly">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <activity
            android:name=".ui.BusDirectionsActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta"/>
        <activity
            android:name=".ui.StopsActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta"/>
        <activity
            android:name=".ui.StopTimesActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta.Split"
            android:uiOptions="splitActionBarWhenNarrow"/>
        <activity
            android:name=".ui.TrainDirectionsActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta"/>
        <activity
            android:name=".ui.LiveMapActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta.Transparent"/>
        <activity
            android:name=".ui.ServiceAlertsActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.RideCta"/>
        <activity
            android:name=".ui.SearchActivity"
            android:exported="true"
            android:launchMode="singleTop"
            android:theme="@style/Theme.RideCta">
            <intent-filter>
                <action android:name="android.intent.action.SEARCH"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <Meta-data
                android:name="android.app.searchable"
                android:resource="@xml/searchable"/>
        </activity>
        <activity
            android:name=".ui.PreferenceActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.Preference"/>
        <activity
            android:name=".ui.LegacyPreferenceActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.Preference"/>
        <activity
            android:name="com.google.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
        <receiver android:name=".receiver.ReminderAlarmReceiver"/>
        <receiver android:name=".receiver.ReminderBootReceiver">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"/>
            </intent-filter>
        </receiver>
        <receiver android:name="net.robotmedia.billing.BillingReceiver">
            <intent-filter>
                <action android:name="com.android.vending.billing.IN_APP_NOTIFY"/>
                <action android:name="com.android.vending.billing.RESPONSE_CODE"/>
                <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED"/>
            </intent-filter>
        </receiver>
        <service android:name=".service.ReminderService"/>
        <service android:name="net.robotmedia.billing.BillingService"/>
        <Meta-data
            android:name="android.app.default_searchable"
            android:value=".ui.SearchActivity"/>
        <Meta-data
            android:name="com.google.android.backup.api_key"
            android:value="<REMOVED>"/>
        <provider
            android:name=".provider.SearchProvider"
            android:authorities="com.jerrellmardis.ridecta.provider.SearchProvider"/>
    </application>
</manifest>

解决方法

右键单击项目文件夹=>属性=> Java Build Path =>订单和出口=>如果未选中,请选中“Android私人库”框.干净.它的工作原理!

猜你在找的Android相关文章