2

I have searched this topic fairly well and have been unable to find a good solution. Here is my manifest and the error code from Google developer console. I get about 3-4 "reported" crashes per week out of 400-500 downloads. I'm fairly new to Android development and hope that one of you guys can point out my error! Maybe it's the fact that my "main class" and my package name are the same but it seems odd that it's a random crash. Thanks in advance!!

<?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.matt.android.adds.freeHistory"
      android:installLocation="preferExternal"
      android:versionName="4.11" android:versionCode="15">
    <uses-sdk android:minSdkVersion="3" />
    <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> 
    <supports-screens
        android:smallScreens="true"
        android:normalScreens="true"
        android:largeScreens="true"
        android:anyDensity="false" />


    <application android:icon="@drawable/flag" android:label="@string/app_name">
        <activity android:name=".freeHistory"
                  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=".dateClass"></activity>
        <activity android:name=".presClass"></activity>
        <activity android:name=".presInfo"></activity>
        <activity android:name=".flagClass"></activity>
        <activity android:name=".flagInfo"></activity>
        <activity android:name=".starSpangledBanner"></activity>
        <activity android:name=".pledge"></activity>
        <activity android:name=".impDocs"></activity>
        <activity android:name=".viewDoc"></activity>
        <activity android:name=".articlesOTC"></activity>
        <activity android:name=".viewArticleOTC"></activity>
        <activity android:name=".constitution"></activity>
        <activity android:name=".preamble"></activity>
        <activity android:name=".consArtOne"></activity>
        <activity android:name=".displayConsArticle"></activity>
        <activity android:name=".billOfRightsView"></activity>
        <activity android:name=".billOfRights"></activity>
        <activity android:name=".randomFact"></activity>
        <activity android:name=".amendView"></activity>
        <activity android:name=".amendClass"></activity>
        <activity android:name=".stateInfo"></activity>
        <activity android:name=".theStates"></activity>
        <activity android:name="com.mobfox.sdk.InAppWebView"/>
        <activity android:name="com.google.ads.AdActivity"
              android:configChanges="keyboardHidden|orientation"/>

    </application>
</manifest>

java.lang.RuntimeException: Unable to instantiate activity     ComponentInfo{com.matt.android.adds.freeHistory/com.matt.android.adds.freeHistory.freeHisto    ry}: java.lang.ClassNotFoundException: com.matt.android.adds.freeHistory.freeHistory     in loader     dalvik.system.PathClassLoader[/mnt/asec/com.matt.android.adds.freeHistory-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1738)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1837)
at android.app.ActivityThread.access$1500(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4196)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException:     com.matt.android.adds.freeHistory.freeHistory in loader dalvik.system.PathClassLoader[/mnt    /asec/com.matt.android.adds.freeHistory-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1730)
... 11 more
6
  • is your freeHistory class in the package of com.matt.android.adds.freeHistory? Dec 19, 2011 at 5:27
  • @ sampathpremarathna Yes, the freeHistory class is in that package
    – James
    Dec 19, 2011 at 5:28
  • Is there a possibility that only those users who are upgrading from your previous version are getting crashes ? Dec 19, 2011 at 5:43
  • Do whitespaces in package names are allowed, as i can see on the error code you getting this package !! com.matt.android.adds.freeHistory.freeHisto ry, do have a look at your source code might be that's the issue!!
    – nIcE cOw
    Dec 19, 2011 at 5:48
  • @ Saurabh Verma -- It is possible that they are on upgrade but no user has specified when the error is occurring.
    – James
    Dec 20, 2011 at 2:40

3 Answers 3

0

One possibility is that the classes initialization has failed to load previously. If the first attempt you make to initialize a class fails with an unhandled exception, the JVM won't attempt to initialize it again. Instead, the JVM will throw a ClassNotFoundException for the class that didn't initialize.

Look through the logcat for an earlier entry reporting an uncaught exception during class / static initialization.

2
  • Where would I try to catch the exception? I never really call the class(intent) in java since it's the first page that is loaded when the app starts.
    – James
    Dec 20, 2011 at 2:45
  • I don't know. It depends where it is being thrown, and I've no way of knowing that. (Besides, I'm not an android developer ...)
    – Stephen C
    Dec 20, 2011 at 5:17
0

just clean you project or restart the eclipse i had the same problem but cleaning the project made the errors go away

1
  • The app runs fine on my phone and all emulators that I have tried. I've also cleaned the app several times. Thanks for your response!!
    – James
    Dec 20, 2011 at 2:42
0

Try to define the name of each activity's name by its path: Let's suppose your activities are in a package named "com.exemple.activities" In your manifest, update like this :

<activity android:name="com.example.activities.activityname" ></activity>

Example:

<activity android:name="com.example.activities.dateClass"></activity>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.