ClassNotFoundException crash reports from Market

by Tauno Talimaa » Mon, 06 Sep 2010 19:29:02 GMT


Sponsored Links
 Hi all,

I'm seeing some strange crash reports in Android Market and I can't 
really tell how this could be caused by our application. The reason is 
always ClassNotFoundException or NoClassDefFoundError.
The exact traces come in various flavors and they have happened for a 
total of ~100 times - here's one (reported 37 times):


java.lang.RuntimeException: Unable to instantiate application 
com.company.product.MyApplication: java.lang.ClassNotFoundException: 
com.company.product.MyApplication in loader 
dalvik.system.PathClassLoader[/data/app-private/com.company.product-1.apk]
at 
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:649)
at 
android.app.ActivityThread.handleBindApplication(ActivityThread.java:4232)

at android.app.ActivityThread.access$3000(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: 
com.company.product.MyApplication in loader 
dalvik.system.PathClassLoader[/data/app-private/com.company.product-1.apk]

at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at android.app.Instrumentation.newApplication(Instrumentation.java:942)
at 
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:644)

... 11 more

We've tested the same .apk on a number of devices and we've never 
encountered issues like this - what could cause such issues in the first 
place - custom ROMs / broken devices / something that we're doing wrong? :/


Tauno

--



ClassNotFoundException crash reports from Market

by { Devdroid } » Mon, 06 Sep 2010 20:02:31 GMT


 


What your app do? Is it calling any other application for example? If so,
ensure you do try/catch around startActivity() - users' device may not
have it at all.

   ^^^^^^^^^^^^^^^^^

you shouldn't name your classes that way unless you really own company.com
domain

--


Sponsored Links


ClassNotFoundException crash reports from Market

by Tauno Talimaa » Mon, 06 Sep 2010 22:01:25 GMT


 > What your app do? Is it calling any other application for example? If so,

No, I don't start any external activities.

--



ClassNotFoundException crash reports from Market

by TreKing » Tue, 07 Sep 2010 11:04:50 GMT


 




I have a single report of "java.lang.VerifyError" for one of the Activities
in my app that's declared in the manifest.
I also have one that failed to find the GeoPoint class that's in the Google
Maps library.

Seems like some crazy sh*t happens on user devices.

Do you have any reasonable user messages?
Does it say what platform and and Android version? (Mine's just "Other", so
useful!)

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

--



ClassNotFoundException crash reports from Market

by Tauno Talimaa » Tue, 07 Sep 2010 15:55:47 GMT


 The user messages are not really helpful sadly :(
"closed"
"fails to install properly on my Droid Motorola" (tested it on a Droid
myself - tried Android 2.1 and 2.2 and it worked just fine)
"wont let me open"
etc..






>



ClassNotFoundException crash reports from Market

by Pent » Tue, 07 Sep 2010 17:36:39 GMT


 > I also have one that failed to find the GeoPoint class that's in the Google

Maybe that's related to one that puzzled me too.

A knowledgable user informed me that some ROMs just use a stub for the
maps package,
there isn't actually a library there.

Hence your app loads OK but crashes when you try to use map classes
apparently.

Pent

--



ClassNotFoundException crash reports from Market

by Tauno Talimaa » Tue, 07 Sep 2010 18:33:31 GMT


 yeah, that sounds reasonable for GeoPoint - but in my case I'm not
using the MapsAPIs at all - Android just can't find my Application
class for some reason :/



>



ClassNotFoundException crash reports from Market

by TreKing » Tue, 07 Sep 2010 23:20:14 GMT


 



Yeah, I hear you, pretty hard to get useful information from users without
being able to ask them questions.





I did have a comment for that that said "FC on Froyo ROM", so that makes
more sense.





Yeah, that's weird. You may just have to wait until someone decides to email
you about it.

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

--



ClassNotFoundException crash reports from Market

by Yahel » Tue, 07 Sep 2010 23:43:09 GMT


 Hi all,

I had both theses errors : ClassNotFound and  VerifyError.

Turns out I was using a class and/or a function that was not available
in the 1.5 framework.

In my manifest I have :

<uses-sdk android:minSdkVersion="3" android:targetSdkVersion="4"></
uses-sdk>

And in my project properties I have checked the 1.6 framework.

With both of these it did not trigger compiler error since the
function existed in the 1.6 framework.
I just went in the properties, checked the 1.5 framework. Errors were
detected by the compiler, I found a way around them, then checked back
1.6 in the properties. It did the trick.

Good luck.

Yahel

--



ClassNotFoundException crash reports from Market

by Tauno Talimaa » Wed, 08 Sep 2010 00:17:35 GMT


 That can't be the problem in my case because people have reported it
on Droid but we've tested it on Droid from the day it came out till
the 2.2 update - and never seen a problem. Also there are a LOT of
Droid users of the app and it apparently happens just for <0.X% of
them :/




>



ClassNotFoundException crash reports from Market

by TreKing » Wed, 08 Sep 2010 00:45:07 GMT


 



The one Activity for which the VerifyError is thrown in my bug report does
not use any new APIs. I did what you suggested anyway and found no errors.
Next idea? =)

-------------------------------------------------------------------------------------------------
TreKing < http://sites.google.com/site/rezmobileapps/treking> ; - Chicago
transit tracking app for Android-powered devices

--



ClassNotFoundException crash reports from Market

by Irene » Sat, 11 Sep 2010 08:50:07 GMT


 I've been getting reports of ClassNotFoundException as well. I'm also
not using any of the Maps APIs and compiling against the 1.5
framework. No one knows what can cause this?






--



ClassNotFoundException crash reports from Market

by DanH » Sat, 11 Sep 2010 09:55:38 GMT


 Keep in mind that you can get those errors if an exception is thrown
in the class's static initializer.  Eg, if you say:

static ClassX x = new ClassX();

and the ClassX() constructor throws an exception, the current class
will fail to initialize and it can report (in some cases) as a
"NotFound" error.  (It can report as any of 5-6 different errors
depending on the phase of the moon.)




--



Re: ClassNotFoundException crash reports from Market

by Emanuel Moecklin » Wed, 24 Nov 2010 01:05:18 GMT


 auno Talimaa <tauntz <at> gmail.com> writes:

android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:649)
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
android.app.ActivityThread$PackageInfo.makeApplication(ActivityThread.java:644)


Hi Tauno

I'm getting the same error reports in my developer console:

java.lang.RuntimeException: Unable to instantiate activity
ComponentInfo{com.company.app/com.company.app.InitializeActivity}:
java.lang.ClassNotFoundException: com.company.app.InitializeActivity in loader
dalvik.system.PathClassLoader[/mnt/asec/com.company.app-1/pkg.apk]
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: com.company.app.InitializeActivity
in loader dalvik.system.PathClassLoader[/mnt/asec/com.company.app-1/pkg.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
at java.lang.ClassLoader.loadClass(ClassLoader.java:573)
at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
at android.app.Instrumentation.newActivity(Instrumentation.java:1021)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
... 11 more

This one has been reported ~20 times. I'm not using any static initializers,
don't use code that is non-compliant with Android 1.5 (app is tested on 1.5
devices) and I already spent quite some time to fix this but without success so
far. If you have a solution by now I'd very much appreciate if you could let me
know.

Emanuel

--



Re: ClassNotFoundException crash reports from Market

by Moss » Thu, 25 Nov 2010 03:01:14 GMT


 ould it be that the class loader is failing to find the right
package? I just saw that you are using 'com.company.app' as your
package name. Googling a bit I found that there are many apps that use
the same schema. Normally I use my domain to identify my packages in a
unique way like 'com.myweb.myapp'.

I just tried to reproduce your error and creating 2 apps that use the
same base package name I just get the error when launching them. I
think that the class loader will pickup the first listed package and
then try to load the class (which is not there :P):
- com.package.app.ActivityA
- com.package.app.ActivityB

If I load com.package.app.ActivityB I'm getting the same error.

Hope this can help you a bit.

Cheers,
Moss

On Nov 23, 5:58pm, Emanuel Moecklin <emanuel.moeck...@1gravity.com>
wrote:

--



Other Threads

1. 2.0.1 Update

Is there a way to center the clock on the new home screen? The 2.0 home
screen had the clock and date in the center, now its off to the left a
little.

--

2. Problem with VideoView when playing a mp4/3gp file

Hi,

I was working on developing a VideoPlayer. I am getting an error while
running the .mp4 file  on VideoView. This error occurs when I click on the
video view when the video is playing or if I start the video directly. The
error dialogue that appears on the screen says application stopped
unexpectedly.

Does anyone knows whats wrong with my code. Is there any other thing that I
need to do like adding permissions or intent filters.

Here is the code that can give more understanding about my application Video
Player..

public class VideoPlayer extends Activity {
    VideoView videoview;
    Context context;
    Bundle bundle;
    Intent sender;
    volatile boolean FLAG_FOR_FAVORITE;
    volatile boolean FLAG_FOR_PLAY_PAUSE = false;
    MediaController mediaController;
    TextView wordtext;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        context = this.getApplicationContext();
        sender = this.getIntent();

        setContentView(R.layout.videoplayer);

        Bundle retrieving_bundle = sender.getExtras();
        String wordname = retrieving_bundle.getString("txtstring");
        String filename = "/sdcard/" + wordname + ".mp4";
        ImageButton playpause = (ImageButton)findViewById(R.id.playpause);

        mediaController = new MediaController(context);
        wordtext = (TextView)findViewById(R.id.vocabularyword);
        wordtext.setText(wordname);

        ///////////////Code for setting video View //////////
        try{
        videoview = (VideoView)findViewById(R.id.wordvideo);
        videoview.setVideoPath(filename);
        videoview.setMediaController(mediaController);
        videoview.requestFocus();
        //videoview.start();                         *This gives an error if
not commented This is what I meant by running directly*
        videoview.setClickable(false);
        videoview.setOnClickListener(new OnClickListener(){
            public void onClick(View v){
                if(FLAG_FOR_PLAY_PAUSE == false){
                    FLAG_FOR_PLAY_PAUSE = true;
                    videoview.start();
                }
                ////to remove from favorites ///////////
                else if(FLAG_FOR_PLAY_PAUSE == true){
                    FLAG_FOR_PLAY_PAUSE = false;
                    videoview.pause();
                }

            }
        });
        }
        catch(Exception e){
            Log.v("video",e.getMessage());
        }

        playpause.setOnClickListener(new OnClickListener(){
            public void onClick(View v)
            {
                ImageButton pauseplay =
(ImageButton)findViewById(R.id.playpause);
                ///// to add to favorites/////////////
                    if(FLAG_FOR_PLAY_PAUSE == false){
                        pauseplay.setImageResource(R.drawable.pause);
                        FLAG_FOR_PLAY_PAUSE = true;
                        videoview.start();
                    }
                    ////to remove from favorites ///////////
                    else if(FLAG_FOR_PLAY_PAUSE == true){
                        pauseplay.setImageResource(R.drawable.play);
                        FLAG_FOR_PLAY_PAUSE = false;
                        videoview.pause();
                    }
               }
        });

      }


The logcat shows the following:

12-10 11:53:12.931: WARN/WindowManager(52):     at
com.android.server.WindowManagerService$Session.onTransact(WindowManagerService.java:6427)
12-10 11:53:12.931: WARN/WindowManager(52):     at
android.os.Binder.execTransact(Binder.java:287)
12-10 11:53:12.931: WARN/WindowManager(52):     at
dalvik.system.NativeStart.run(Native Method)
12-10 11:53:12.931: WARN/WindowManager(52): Attempted to add window with
token that is not a window: null.  Aborting.
12-10 11:53:12.941: DEBUG/AndroidRuntime(3035): Shutting down VM
12-10 11:53:12.941: WARN/dalvikvm(3035): threadid=3: thread exiting with
uncaught exception (group=0x4001b188)
12-10 11:53:12.951: ERROR/AndroidRuntime(3035): Uncaught handler: thread
main exiting due to uncaught exception
12-10 11:53:13.041: DEBUG/dalvikvm(3035): GC freed 2397 objects / 340176
bytes in 89ms
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):
android.view.WindowManager$BadTokenException: Unable to add window -- token
null is not valid; is your activity running?
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewRoot.setView(ViewRoot.java:468)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:177)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.WindowManagerImpl.addView(WindowManagerImpl.java:91)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.widget.MediaController.show(MediaController.java:304)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.widget.MediaController.show(MediaController.java:249)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.widget.VideoView.toggleMediaControlsVisiblity(VideoView.java:538)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.widget.VideoView.onTouchEvent(VideoView.java:489)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.View.dispatchTouchEvent(View.java:3709)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:820)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1659)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1107)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.app.Activity.dispatchTouchEvent(Activity.java:2061)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1643)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.view.ViewRoot.handleMessage(ViewRoot.java:1690)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.os.Handler.dispatchMessage(Handler.java:99)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.os.Looper.loop(Looper.java:123)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
android.app.ActivityThread.main(ActivityThread.java:4310)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
java.lang.reflect.Method.invokeNative(Native Method)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
java.lang.reflect.Method.invoke(Method.java:521)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
12-10 11:53:13.081: ERROR/AndroidRuntime(3035):     at
dalvik.system.NativeStart.main(Native Method)

Thanks in advance,

Yousuf

--

3. SimpleDateFormat and Android 2.0

4. Orange is answering to your questions Live during LeWeb

5. GK:How to Animate the single image in the Gallery

6. Using GLSurfaceView with other views...

7. problem using the android emulator