Problem running heavy application
I developed an "heavy" application (700 Mb !). With an "apk installer" application, i can install it on the Nexus One SD card (Froyo "installLocation" option). My application is heavy because of the videos it contains (located in /raw directory). The problem I have, is that it crashes when launched, with this error :
08-18 11:22:16.179: ERROR/AndroidRuntime(1250): FATAL
> > EXCEPTION: main 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250):
> > java.lang.RuntimeException: Unable to
> > instantiate activity
> > ComponentInfo{com.test.media/com.test.media.Welcome}:
> > java.lang.ClassNotFoundException:
> > com.test.media.Welcome in loader
> > dalvik.system.PathClassLoader[/mnt/asec/com.test.media-1/pkg.apk]
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2585)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.ActivityThread.access$2300(ActivityThread.java:125)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.os.Handler.dispatchMessage(Handler.java:99)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.os.Looper.loop(Looper.java:123)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.ActivityThread.main(ActivityThread.java:4627)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > java.lang.reflect.Method.invokeNative(Native
> > Method) 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > java.lang.reflect.Method.invoke(Method.java:521)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > dalvik.system.NativeStart.main(Native
> > Method) 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): Caused by:
> > java.lang.ClassNotFoundException:
> > com.test.media.Welcome in loader
> > dalvik.system.PathClassLoader[/mnt/asec/com.test.media-1/pkg.apk]
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > dalvik.system.PathClassLoader.findClass(PathClassLoader.java:243)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(开发者_Python百科1250): at
> > java.lang.ClassLoader.loadClass(ClassLoader.java:573)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > java.lang.ClassLoader.loadClass(ClassLoader.java:532)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.Instrumentation.newActivity(Instrumentation.java:1021)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): at
> > android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2577)
> > 08-18 11:22:16.179:
> > ERROR/AndroidRuntime(1250): ... 11
> > more
I dont't understand the reason of this error, because when i try the same thing with a lighter application (250 Mb) it runs perfectly. Has anyone of you ever had this kind of problem ? Do you know if there is a size limit for applications to work ?
Thank you for your help !
The error is:
java.lang.ClassNotFoundException: com.test.media.Welcome
If you remove some videos it does work? Also from the SD card?
If you want to check whether the class exists you could unpack the apk and check wether the file is actually there.
I guess you hit the limit... maybe you should think about other possibilities to ship the videos.
Maybe a limit...you could for example streaming the videos live, using a better codec, resolution not as high as the phone/pad where you with, ect. But actually I havn't read anything about a limit in size.
So otherwise, I read ClassNotFoundException. What happens, if you remove all further methods and calls of your main onCreate() method and just let parse your layout? If that works, the error is somewhere else. If it still throws something, try to reduce the layout as small as possible. And if it wont work then...then there is a limit and you found it ;)
why not keep the app lightweight and then download your videos once the app is launched the first time. Like the old Doom for Android did before Id had it taken away.
精彩评论