我在开发周期中看到过几次以下错误,现在我刚刚收到错误报告。我不知道是什么原因造成的。在阅读了本网站上有关此问题的类似问题后,我仔细检查了我的 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 库,它允许我在片段中嵌入 MapView(以及与 ActionBarSherlock 库)。这个异常似乎是一个依赖问题,我不确定它是否与我使用上述库的方式有关。
这是清单文件:
<?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>