App camera crash - android

I use the next tutorial, in developer.android.com :
http://developer.android.com/training/camera/photobasics.html
with API 2.1
When I click in take a small picture, no problem
When I click in take a small picture and after I click in take a big picture, no problem
But, when I click directly in big picture, I take a picture and my app crash ...
In LogCat :
05-10 09:26:30.773: D/CameraSample(3407): failed to create directory
05-10 09:26:33.713: W/IInputConnectionWrapper(3407): showStatusIcon on inactive InputConnection
05-10 09:26:45.883: I/Parcours(3407): handleBigCameraPhoto
05-10 09:26:46.133: D/dalvikvm(3407): GC_EXTERNAL_ALLOC freed 124K, 52% free 2628K/5379K, external 1685K/2133K, paused 207ms
05-10 09:26:46.143: E/dalvikvm-heap(3407): 31961088-byte external allocation too large for this process.
05-10 09:26:46.163: E/GraphicsJNI(3407): VM won't let us allocate 31961088 bytes
05-10 09:26:46.213: D/dalvikvm(3407): GC_FOR_MALLOC freed 2K, 52% free 2625K/5379K, external 1685K/2133K, paused 55ms
05-10 09:26:46.213: D/skia(3407): --- decoder->decode returned false
05-10 09:26:46.213: D/AndroidRuntime(3407): Shutting down VM
05-10 09:26:46.223: W/dalvikvm(3407): threadid=1: thread exiting with uncaught exception (group=0x4001d560)
05-10 09:26:46.223: E/AndroidRuntime(3407): FATAL EXCEPTION: main
05-10 09:26:46.223: E/AndroidRuntime(3407): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:470)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.graphics.BitmapFactory.decodeFile(BitmapFactory.java:284)
05-10 09:26:46.223: E/AndroidRuntime(3407): at rdaquin.apps.takephoto.TakePhotoActivity.setPic(TakePhotoActivity.java:124)
05-10 09:26:46.223: E/AndroidRuntime(3407): at rdaquin.apps.takephoto.TakePhotoActivity.handleBigCameraPhoto(TakePhotoActivity.java:195)
05-10 09:26:46.223: E/AndroidRuntime(3407): at rdaquin.apps.takephoto.TakePhotoActivity.onActivityResult(TakePhotoActivity.java:281)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.app.Activity.dispatchActivityResult(Activity.java:3908)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.app.ActivityThread.deliverResults(ActivityThread.java:2549)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.app.ActivityThread.handleSendResult(ActivityThread.java:2595)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.app.ActivityThread.access$2000(ActivityThread.java:121)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:973)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.os.Looper.loop(Looper.java:123)
05-10 09:26:46.223: E/AndroidRuntime(3407): at android.app.ActivityThread.main(ActivityThread.java:3701)
05-10 09:26:46.223: E/AndroidRuntime(3407): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 09:26:46.223: E/AndroidRuntime(3407): at java.lang.reflect.Method.invoke(Method.java:507)
05-10 09:26:46.223: E/AndroidRuntime(3407): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
05-10 09:26:46.223: E/AndroidRuntime(3407): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
05-10 09:26:46.223: E/AndroidRuntime(3407): at dalvik.system.NativeStart.main(Native Method)
If have you need a code, ask me.
I do not understand why my application crashes, I feel that this is a memory problem but I do not know what to do.
So that when I do "take a small image" and "take a big picture" it works. But if I reload the application and that I "take a big picture" does not work

I think it's pretty obvious from the stack trace, which says you ran out of memory because you tried to allocate 32MB on the heap. You can't do that. Not surprising since this happens when you take a big picture. You can't put it in memory. Write it to storage.

Related

nullpointerexception after rotating emulator in android

I have the above problem when i rotate the emulator while using the image editing app. It just crashes with a nullpointerexception. Here is the portion of code that is relevant for the problem.
HueseekBar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
public void onProgressChanged(SeekBar arg0, int progress,
boolean fromUser) {
try {
if (picclass.hasBitmap()) {
float hue = (float) (progress - 256);
float setHue = (float) hue * 360 / 256;
picclass.setHue(setHue);
if (!noUpdate) {
picclass.ApplyFilter();
Img.setImageBitmap(picclass.getDisplayedBitmap());
mUndoRedo.SetStateForUndoRedo();
}
}
} catch (OutOfMemoryError ome) {
AlertDialog ad = adb.create();
ad.setMessage("Leider reicht der Speicherplatz nicht aus!");
ad.show();
}
}
According to the logcat the problem is mUndoRedo.SetStateForUndoRedo();. The code compiles allright. I don't understand how this exception is triggered here. Any ideas?
EDIT: LOGCAT
07-25 18:26:07.328: D/dalvikvm(5989): GC_CONCURRENT freed 159K, 3% free 9134K/9351K, paused 4ms+3ms
07-25 18:26:07.348: D/TextLayoutCache(5989): Using debug level: 0 - Debug Enabled: 0
07-25 18:26:07.428: D/libEGL(5989): loaded /system/lib/egl/libGLES_android.so
07-25 18:26:07.428: D/libEGL(5989): loaded /system/lib/egl/libEGL_adreno200.so
07-25 18:26:07.438: D/libEGL(5989): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
07-25 18:26:07.438: D/libEGL(5989): loaded /system/lib/egl/libGLESv2_adreno200.so
07-25 18:26:07.478: D/OpenGLRenderer(5989): Enabling debug mode 0
07-25 18:26:10.668: D/OpenGLRenderer(5989): Flushing caches (mode 0)
07-25 18:26:10.688: D/OpenGLRenderer(5989): Flushing caches (mode 0)
07-25 18:26:12.128: D/OpenGLRenderer(5989): Flushing caches (mode 1)
07-25 18:26:15.518: I/System.out(5989): Image Path : /mnt/sdcard/tiny_sd/rocknest_858x188.jpg
07-25 18:26:15.548: D/dalvikvm(5989): GC_FOR_ALLOC freed 102K, 2% free 9314K/9479K, paused 23ms
07-25 18:26:15.548: I/dalvikvm-heap(5989): Grow heap (frag case) to 9.747MB for 645232-byte allocation
07-25 18:26:15.598: D/dalvikvm(5989): GC_CONCURRENT freed 103K, 3% free 9841K/10119K, paused 5ms+2ms
07-25 18:26:15.598: W/CursorWrapperInner(5989): Cursor finalized without prior close()
07-25 18:26:17.538: D/OpenGLRenderer(5989): Flushing caches (mode 0)
07-25 18:26:17.808: D/dalvikvm(5989): GC_FOR_ALLOC freed 86K, 3% free 9902K/10119K, paused 37ms
07-25 18:26:17.808: I/dalvikvm-heap(5989): Grow heap (frag case) to 10.321MB for 645232-byte allocation
07-25 18:26:17.878: D/dalvikvm(5989): GC_CONCURRENT freed 4K, 3% free 10528K/10759K, paused 2ms+2ms
07-25 18:26:17.908: D/dalvikvm(5989): GC_FOR_ALLOC freed <1K, 3% free 10528K/10759K, paused 32ms
07-25 18:26:17.908: I/dalvikvm-heap(5989): Grow heap (frag case) to 10.931MB for 645232-byte allocation
07-25 18:26:17.978: D/dalvikvm(5989): GC_CONCURRENT freed 0K, 3% free 11158K/11399K, paused 5ms+2ms
07-25 18:26:20.098: D/AndroidRuntime(5989): Shutting down VM
07-25 18:26:20.098: W/dalvikvm(5989): threadid=1: thread exiting with uncaught exception (group=0x2b542210)
07-25 18:26:20.108: E/AndroidRuntime(5989): FATAL EXCEPTION: main
07-25 18:26:20.108: E/AndroidRuntime(5989): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.propra_fotoapp/com.example.propra_fotoapp.MainActivity}: java.lang.NullPointerException
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3371)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread.access$700(ActivityThread.java:127)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1162)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.os.Handler.dispatchMessage(Handler.java:99)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.os.Looper.loop(Looper.java:137)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread.main(ActivityThread.java:4441)
07-25 18:26:20.108: E/AndroidRuntime(5989): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 18:26:20.108: E/AndroidRuntime(5989): at java.lang.reflect.Method.invoke(Method.java:511)
07-25 18:26:20.108: E/AndroidRuntime(5989): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
07-25 18:26:20.108: E/AndroidRuntime(5989): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
07-25 18:26:20.108: E/AndroidRuntime(5989): at dalvik.system.NativeStart.main(Native Method)
07-25 18:26:20.108: E/AndroidRuntime(5989): Caused by: java.lang.NullPointerException
07-25 18:26:20.108: E/AndroidRuntime(5989): at com.example.propra_fotoapp.MainActivity$13.onProgressChanged(MainActivity.java:269)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.widget.SeekBar.onProgressRefresh(SeekBar.java:89)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.widget.ProgressBar.doRefreshProgress(ProgressBar.java:609)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.widget.ProgressBar.refreshProgress(ProgressBar.java:621)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.widget.ProgressBar.setProgress(ProgressBar.java:670)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.widget.ProgressBar.setProgress(ProgressBar.java:651)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.widget.ProgressBar.onRestoreInstanceState(ProgressBar.java:1096)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.view.View.dispatchRestoreInstanceState(View.java:10043)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2425)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2425)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.view.View.restoreHierarchyState(View.java:10021)
07-25 18:26:20.108: E/AndroidRuntime(5989): at com.android.internal.policy.impl.PhoneWindow.restoreHierarchyState(PhoneWindow.java:1619)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.Activity.onRestoreInstanceState(Activity.java:906)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.Activity.performRestoreInstanceState(Activity.java:878)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.Instrumentation.callActivityOnRestoreInstanceState(Instrumentation.java:1100)
07-25 18:26:20.108: E/AndroidRuntime(5989): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1945)
07-25 18:26:20.108: E/AndroidRuntime(5989): ... 12 more
07-25 18:26:20.158: D/dalvikvm(5989): GC_CONCURRENT freed 1333K, 13% free 10551K/12039K, paused 2ms+2ms
07-25 18:31:20.198: I/Process(5989): Sending signal. PID: 5989 SIG: 9
You need to save the bundle before the activity is destroyed and then set the values of the bundle when the activity is recreated
Android operating system is unique. When you rotate the screen, you are creating a new activity automatically, so that's why you get a null reference. My advice is to set your screen to potrait or landscape.

Android Application Crashes in Emulator

My Android application crashes in the emulator with, with the following being output to the logs:
09-26 14:04:02.123: D/dalvikvm(716): GC_FOR_ALLOC freed 66K, 6% free 2675K/2844K, paused 29ms, total 30ms
09-26 14:04:02.123: I/dalvikvm-heap(716): Grow heap (frag case) to 3.455MB for 782224-byte allocation
09-26 14:04:02.173: D/dalvikvm(716): GC_FOR_ALLOC freed 2K, 5% free 3437K/3608K, paused 42ms, total 42ms
09-26 14:04:02.303: D/dalvikvm(716): GC_FOR_ALLOC freed <1K, 5% free 3436K/3608K, paused 38ms, total 39ms
09-26 14:04:02.314: I/dalvikvm-heap(716): Grow heap (frag case) to 4.778MB for 1389712-byte allocation
09-26 14:04:02.363: D/dalvikvm(716): GC_FOR_ALLOC freed <1K, 4% free 4793K/4968K, paused 52ms, total 52ms
09-26 14:04:02.423: D/AndroidRuntime(716): Shutting down VM
09-26 14:04:02.423: W/dalvikvm(716): threadid=1: thread exiting with uncaught exception (group=0x414c4700)
09-26 14:04:02.433: E/AndroidRuntime(716): FATAL EXCEPTION: main
09-26 14:04:02.433: E/AndroidRuntime(716): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.sample_proj/com.example.sample_proj.MainActivity}: java.lang.NullPointerException
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2211)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.ActivityThread.access$600(ActivityThread.java:141)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.os.Handler.dispatchMessage(Handler.java:99)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.os.Looper.loop(Looper.java:137)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.ActivityThread.main(ActivityThread.java:5103)
09-26 14:04:02.433: E/AndroidRuntime(716): at java.lang.reflect.Method.invokeNative(Native Method)
09-26 14:04:02.433: E/AndroidRuntime(716): at java.lang.reflect.Method.invoke(Method.java:525)
09-26 14:04:02.433: E/AndroidRuntime(716): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
09-26 14:04:02.433: E/AndroidRuntime(716): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
09-26 14:04:02.433: E/AndroidRuntime(716): at dalvik.system.NativeStart.main(Native Method)
09-26 14:04:02.433: E/AndroidRuntime(716): Caused by: java.lang.NullPointerException
09-26 14:04:02.433: E/AndroidRuntime(716): at com.example.sample_proj.MainActivity.onCreate(MainActivity.java:21)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.Activity.performCreate(Activity.java:5133)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
09-26 14:04:02.433: E/AndroidRuntime(716): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2175)
09-26 14:04:02.433: E/AndroidRuntime(716): ... 11 more
Would someone please help me in understanding why NullPointerException is being thrown and how I can resolve it?
Check this line in your MainActivity
MainActivity.java:21
You have probably used findviewbyid and the following happened
you forgot to put the line "setContentView" or put it after findviewbyid
or you put the contentView to the wrong layout
1 and 2 are not it, and you did findviewbyid to non existing id in the given layout- and tried to use that object aterwards, because the id is incorrect, the object returns null, and you are trying to use it

Unfortunately android application is stopped

05-10 22:12:43.572: E/dalvikvm(566): Could not find class 'com.commonsware.cwac.merge.MergeAdapter', referenced from method FXPAL.Unity.Android.UnityMain.updateView
05-10 22:12:43.862: E/dalvikvm(566): Could not find class 'com.xtify.android.sdk.PersistentLocationManager', referenced from method FXPAL.Unity.Android.ReportingService.onCreate
05-10 22:12:44.182: E/AndroidRuntime(566): FATAL EXCEPTION: main
05-10 22:12:44.182: E/AndroidRuntime(566): java.lang.NoClassDefFoundError: com.xtify.android.sdk.PersistentLocationManager
05-10 22:12:44.182: E/AndroidRuntime(566): at FXPAL.Unity.Android.ReportingService.onCreate(ReportingService.java:240)
05-10 22:12:44.182: E/AndroidRuntime(566): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)
05-10 22:12:44.182: E/AndroidRuntime(566): at android.app.ActivityThread.access$1600(ActivityThread.java:123)
05-10 22:12:44.182: E/AndroidRuntime(566): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
05-10 22:12:44.182: E/AndroidRuntime(566): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 22:12:44.182: E/AndroidRuntime(566): at android.os.Looper.loop(Looper.java:137)
05-10 22:12:44.182: E/AndroidRuntime(566): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-10 22:12:44.182: E/AndroidRuntime(566): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 22:12:44.182: E/AndroidRuntime(566): at java.lang.reflect.Method.invoke(Method.java:511)
05-10 22:12:44.182: E/AndroidRuntime(566): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-10 22:12:44.182: E/AndroidRuntime(566): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-10 22:12:44.182: E/AndroidRuntime(566): at dalvik.system.NativeStart.main(Native Method)
05-10 22:12:55.702: E/dalvikvm(589): Could not find class 'com.xtify.android.sdk.PersistentLocationManager', referenced from method FXPAL.Unity.Android.ReportingService.onCreate
05-10 22:12:55.992: E/AndroidRuntime(589): FATAL EXCEPTION: main
05-10 22:12:55.992: E/AndroidRuntime(589): java.lang.NoClassDefFoundError: com.xtify.android.sdk.PersistentLocationManager
05-10 22:12:55.992: E/AndroidRuntime(589): at FXPAL.Unity.Android.ReportingService.onCreate(ReportingService.java:240)
05-10 22:12:55.992: E/AndroidRuntime(589): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)
05-10 22:12:55.992: E/AndroidRuntime(589): at android.app.ActivityThread.access$1600(ActivityThread.java:123)
05-10 22:12:55.992: E/AndroidRuntime(589): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
05-10 22:12:55.992: E/AndroidRuntime(589): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 22:12:55.992: E/AndroidRuntime(589): at android.os.Looper.loop(Looper.java:137)
05-10 22:12:55.992: E/AndroidRuntime(589): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-10 22:12:55.992: E/AndroidRuntime(589): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 22:12:55.992: E/AndroidRuntime(589): at java.lang.reflect.Method.invoke(Method.java:511)
05-10 22:12:55.992: E/AndroidRuntime(589): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-10 22:12:55.992: E/AndroidRuntime(589): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-10 22:12:55.992: E/AndroidRuntime(589): at dalvik.system.NativeStart.main(Native Method)
05-10 22:13:01.262: E/dalvikvm(605): Could not find class 'com.commonsware.cwac.merge.MergeAdapter', referenced from method FXPAL.Unity.Android.UnityMain.updateView
05-10 22:13:01.502: E/dalvikvm(605): Could not find class 'com.xtify.android.sdk.PersistentLocationManager', referenced from method FXPAL.Unity.Android.ReportingService.onCreate
05-10 22:13:01.722: E/AndroidRuntime(605): FATAL EXCEPTION: main
05-10 22:13:01.722: E/AndroidRuntime(605): java.lang.NoClassDefFoundError: com.xtify.android.sdk.PersistentLocationManager
05-10 22:13:01.722: E/AndroidRuntime(605): at FXPAL.Unity.Android.ReportingService.onCreate(ReportingService.java:240)
05-10 22:13:01.722: E/AndroidRuntime(605): at android.app.ActivityThread.handleCreateService(ActivityThread.java:2253)
05-10 22:13:01.722: E/AndroidRuntime(605): at android.app.ActivityThread.access$1600(ActivityThread.java:123)
05-10 22:13:01.722: E/AndroidRuntime(605): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1201)
05-10 22:13:01.722: E/AndroidRuntime(605): at android.os.Handler.dispatchMessage(Handler.java:99)
05-10 22:13:01.722: E/AndroidRuntime(605): at android.os.Looper.loop(Looper.java:137)
05-10 22:13:01.722: E/AndroidRuntime(605): at android.app.ActivityThread.main(ActivityThread.java:4424)
05-10 22:13:01.722: E/AndroidRuntime(605): at java.lang.reflect.Method.invokeNative(Native Method)
05-10 22:13:01.722: E/AndroidRuntime(605): at java.lang.reflect.Method.invoke(Method.java:511)
05-10 22:13:01.722: E/AndroidRuntime(605): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
05-10 22:13:01.722: E/AndroidRuntime(605): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
05-10 22:13:01.722: E/AndroidRuntime(605): at dalvik.system.NativeStart.main(Native Method)
I am new to android development.I am upgrading an android application from 2.2 Android to 4.0.3. The application is not starting and saying "Unfortunately myUnity application has stopped", but previously the application was good.The above is the error log i am getting while I debug the application.I am also pasting my manifest file below. Please help me out guys as I am facing this problem since many days.
Thanks in advance.
Android manifest file is
-->
Thanks in advance.... i am also new to stackflow... i am really sorry if I posted the question in wrong format.
Regards,
Rakesh.
LogCat
05-15 06:52:35.898: E/dalvikvm(1436): Could not find class 'com.commonsware.cwac.merge.MergeAdapter', referenced from method FXPAL.Unity.Android.UnityMain.updateView
05-15 06:52:36.187: E/dalvikvm(1436): Could not find class 'com.xtify.android.sdk.PersistentLocationManager', referenced from method FXPAL.Unity.Android.ReportingService.onCreate
The above is my logcat. Looking forward to your help guyz. The below is my android Manifest
Well I had made changes in my Android Environment. I was using some external libraries (JARs) and I was also getting this "NoClassDef" error. I made a folder by name of "libs" copied the libraries into it. Right clicked on "libs" then buildpath -> add as source folder.
I hope this helps :)
Your problem is `
java.lang.NoClassDefFoundError: com.xtify.android.sdk.PersistentLocationManager
`
Copied from documentation:
Thrown if the Java Virtual Machine or a ClassLoader instance tries to
load in the definition of a class (as part of a normal method call or
as part of creating a new instance using the new expression) and no
definition of the class could be found. The searched-for class
definition existed when the currently executing class was compiled,
but the definition can no longer be found.
Reason of NoClassDefFoundError is that a particular class is not available in Classpath, so u need to add that into Classpath. Try it.
No apologies needed, posting the logcat is the right thing to do. The first line says "Could not find class 'com.commonsware.cwac.merge.MergeAdapter', referenced from method FXPAL.Unity.Android.UnityMain.updateView". Be sure you are still linking that package into your app.
BTW, I can't see your manifest file.

Error in running Android's TouchPaint example program

I am just trying out the "TouchPaint" sample provided by Google Android examples at:
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.html
Created my own AndroidManifest.xml, and I figured that "GraphicsActivity.java" and "PictureLayout.java" are two other java files before I could compiled and create the apk successfully.
After I load into my Android phone, it displayed a blank screen. At this point nothing happened yet, but once I touch the screen, the apps died, and generated the following trace in logcat output:
D/dalvikvm( 4939): GC_CONCURRENT freed 44K, 49% free 2779K/5379K, external 3286K/4104K, paused 4ms+2ms
D/dalvikvm( 365): GC_CONCURRENT freed 1102K, 54% free 3271K/7047K, external 2612K/3262K, paused 4ms+4ms
I/ActivityManager( 266): Displayed com.example.android.apis.graphics/.TouchPaint: +382ms
D/AndroidRuntime( 4939): Shutting down VM
W/dalvikvm( 4939): threadid=1: thread exiting with uncaught exception (group=0x2aac8578)
E/AndroidRuntime( 4939): FATAL EXCEPTION: main
E/AndroidRuntime( 4939): java.lang.NoSuchMethodError: android.view.MotionEvent.getButtonState
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchOrHoverEvent(TouchPaint.java:346)
E/AndroidRuntime( 4939): at com.example.android.apis.graphics.TouchPaint$PaintView.onTouchEvent(TouchPaint.java:337)
E/AndroidRuntime( 4939): at android.view.View.dispatchTouchEvent(View.java:3952)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:961)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1711)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1145)
E/AndroidRuntime( 4939): at android.app.Activity.dispatchTouchEvent(Activity.java:2096)
E/AndroidRuntime( 4939): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1695)
E/AndroidRuntime( 4939): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2217)
E/AndroidRuntime( 4939): at android.view.ViewRoot.handleMessage(ViewRoot.java:1901)
E/AndroidRuntime( 4939): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 4939): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime( 4939): at android.app.ActivityThread.main(ActivityThread.java:3701)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 4939): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
E/AndroidRuntime( 4939): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
E/AndroidRuntime( 4939): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 266): Force finishing activity com.example.android.apis.graphics/.TouchPaint
W/ActivityManager( 266): Activity pause timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
I/InputDispatcher( 266): Application is not responding: Window{2b3f4d00 com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint paused=false}. 5002.0ms since event, 5001.8ms since wait started
I/InputDispatcher( 266): Dropping event because the pointer is not down.
I/WindowManager( 266): Input event dispatching timed out sending to com.example.android.apis.graphics/com.example.android.apis.graphics.TouchPaint
W/ActivityManager( 266): Activity destroy timeout for HistoryRecord{2afed900 com.example.android.apis.graphics/.TouchPaint}
D/lights ( 266): set_light_backlight: brightness=20
I/ActivityManager( 266): No longer want com.facebook.katana (pid 4319): hidden #16
W/ActivityManager( 266): Scheduling restart of crashed service com.facebook.katana/.service.UploadManager in 5000ms
I am puzzled over what is the possible cause of crashing?
This method is only available since API Level 14, set minSdkVersion to 14 in the Manifest
public final int getButtonState ()
Since: API Level 14
Gets the state of all buttons that are pressed such as a mouse or stylus button.
Returns
The button state.
I found the answer:
http://developer.android.com/resources/dashboard/platform-versions.html
http://developer.android.com/guide/appendix/api-levels.html
From the web page's table, since I know my phone is using Android 2.3.4, so that max target API for SDK should be 10. So instead of using the TouchPaint.java sample from android-14, I copied the TouchPaint.java from android-10,change the minSDK version to 10 inside my AndroidManifest.xml file:
<uses-sdk android:minSdkVersion="10"/>
Everything works!! Thanks to Rajdeep Dua too!!!

Android: How to load an image from gallery into the OpenCv Mat variable?

I'm currently try to run some opencv filters (i.e find egde, Median, ...) on images which are stored in the image gallery folder.
But I get error for loading image. My device is galaxy tab 10.1 with android 3.2, my opencv - API level 8.
I have the following source on a Button:
#Override
public void onClick(View v) {
Bitmap myBitmap = BitmapFactory.decodeFile("/sdcard/image1.jpg");
Bitmap myBitmap32 = myBitmap.copy(Bitmap.Config.ARGB_8888, true);
Mat pic1 = Utils.bitmapToMat(myBitmap32);
}
Here is LogCat:
02-07 12:31:27.290: I/System.out(16522): Not a DRM File, opening notmally
02-07 12:31:27.290: I/System.out(16522): buffer returned
02-07 12:31:27.310: D/dalvikvm(16522): GC_FOR_ALLOC freed 11K, 21% free 6975K/8775K, paused 19ms
02-07 12:31:27.320: I/dalvikvm-heap(16522): Grow heap (frag case) to 12.918MB for 6291472-byte allocation
02-07 12:31:27.340: D/dalvikvm(16522): GC_FOR_ALLOC freed <1K, 13% free 13119K/14983K, paused 19ms
02-07 12:31:27.380: D/dalvikvm(16522): GC_CONCURRENT freed 0K, 13% free 13119K/14983K, paused 2ms+2ms
02-07 12:31:27.710: D/dalvikvm(16522): GC_FOR_ALLOC freed 55K, 13% free 13063K/14983K, paused 20ms
02-07 12:31:27.730: I/dalvikvm-heap(16522): Grow heap (frag case) to 24.864MB for 12582928-byte allocation
02-07 12:31:27.780: D/dalvikvm(16522): GC_FOR_ALLOC freed 0K, 8% free 25351K/27335K, paused 21ms
02-07 12:31:27.830: D/dalvikvm(16522): GC_CONCURRENT freed <1K, 8% free 25351K/27335K, paused 2ms+3ms
02-07 12:31:27.890: W/dalvikvm(16522): Exception Ljava/lang/UnsatisfiedLinkError; thrown while initializing Lorg/opencv/android/Utils;
02-07 12:31:27.890: D/AndroidRuntime(16522): Shutting down VM
02-07 12:31:27.890: W/dalvikvm(16522): threadid=1: thread exiting with uncaught exception (group=0x400fc760)
02-07 12:31:27.890: E/AndroidRuntime(16522): FATAL EXCEPTION: main
02-07 12:31:27.890: E/AndroidRuntime(16522): java.lang.ExceptionInInitializerError
02-07 12:31:27.890: E/AndroidRuntime(16522): at photo.klu.PhotoKLUActivity$1.onClick(PhotoKLUActivity.java:82)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View.performClick(View.java:3127)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.view.View$PerformClick.run(View.java:12025)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.handleCallback(Handler.java:587)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Handler.dispatchMessage(Handler.java:92)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.os.Looper.loop(Looper.java:132)
02-07 12:31:27.890: E/AndroidRuntime(16522): at android.app.ActivityThread.main(ActivityThread.java:4126)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invokeNative(Native Method)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.reflect.Method.invoke(Method.java:491)
02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
02-07 12:31:27.890: E/AndroidRuntime(16522): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
02-07 12:31:27.890: E/AndroidRuntime(16522): at dalvik.system.NativeStart.main(Native Method)
02-07 12:31:27.890: E/AndroidRuntime(16522): Caused by: java.lang.UnsatisfiedLinkError: Couldn't load opencv_java: findLibrary returned null
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.Runtime.loadLibrary(Runtime.java:425)
02-07 12:31:27.890: E/AndroidRuntime(16522): at java.lang.System.loadLibrary(System.java:554)
02-07 12:31:27.890: E/AndroidRuntime(16522): at org.opencv.android.Utils.<clinit>(Utils.java:86)
02-07 12:31:27.890: E/AndroidRuntime(16522): ... 12 more
02-07 12:31:30.010: I/dalvikvm(16522): threadid=4: reacting to signal 3
02-07 12:31:30.010: I/dalvikvm(16522): Wrote stack traces to '/data/anr/traces.txt'
02-07 12:31:37.470: I/Process(16522): Sending signal. PID: 16522 SIG: 9
Any ideas?
Thank you.
The openCV library is not attached to your application. Please do the following (i assume that the openCV library is imported to your workspace). On Package Explorer > Right click on the application project > properties > under Library click Add > select openCV Be sure that on Java Build Path you don't have anything related to openCV

Categories

Resources