1

I have an Android app that saves the values from different EditText boxes on pressing "SAVE" Button to a Sqlite database. This app works fine on Emulator and gives desired output. But app shows "Force Close" error on pressing "SAVE" Button in mobile device.

I have worked on Sqlite database previously and I am pretty sure there is no error in that part. Then what is the problem. Please Help.

Here are the LogCat entries it if help :-

08-03 12:08:28.875: I/ActivityManager(59): Starting activity: Intent {cmp=com.SMSDb/.Settings }
08-03 12:08:29.665: I/ActivityManager(59): Displayed activity com.SMSDb/.Settings: 744 ms (total 744 ms)
08-03 12:08:47.126: D/dalvikvm(10469): GC_FOR_MALLOC freed 6935 objects / 332488 bytes in 108ms
08-03 12:08:47.155: I/ActivityManager(59): Starting activity: Intent { cmp=com.SMSDb/.SMSDbActivity }
08-03 12:08:47.765: I/ActivityManager(59): Displayed activity com.SMSDb/.SMSDbActivity: 498 ms (total 498 ms)
08-03 12:08:57.765: I/ActivityManager(59): Starting activity: Intent { cmp=com.SMSDb/.Settings }
08-03 12:08:58.526: I/ActivityManager(59): Displayed activity com.SMSDb/.Settings: 665 ms (total 665 ms)
08-03 12:09:00.438: W/KeyCharacterMap(10469): No keyboard for id 0
08-03 12:09:00.438: W/KeyCharacterMap(10469): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
08-03 12:09:04.646: I/ActivityManager(59): Starting activity: Intent { cmp=com.SMSDb/.SMSDbActivity }
08-03 12:09:05.316: I/ActivityManager(59): Displayed activity com.SMSDb/.SMSDbActivity: 535 ms (total 535 ms)
Name is Nilay
  • 2,743
  • 4
  • 35
  • 77
  • possibly path problem in device, can you upload your code with error ( if any ) ? – Lucifer Aug 03 '12 at 06:33
  • please post the error that u get in logcat – Vikram Gupta Aug 03 '12 at 06:33
  • @vickey-When I run my App on Emulator, I do not get any error or Exception.. – Name is Nilay Aug 03 '12 at 06:34
  • @Lucifer-When I run my App on Emulator, I do not get any error or Exception.. – Name is Nilay Aug 03 '12 at 06:35
  • How can we say what is the problem without see your code ? – Chirag Aug 03 '12 at 06:39
  • You can debug with your device and not with Emulator. and then you will get the error, if any. – CSharp Aug 03 '12 at 06:42
  • @ChiragRaval-I have updated the LogCat entries...should I upload the code too..?? – Name is Nilay Aug 03 '12 at 06:42
  • @Nirav-I dont know how to Debug with device...Can u give some tutorial or link that could help..Thanks for helping. – Name is Nilay Aug 03 '12 at 06:44
  • You can refer [this](http://stackoverflow.com/questions/2714400/how-to-debug-on-a-real-device-using-eclipse-adt) and/or [this](http://pirko.info/blog/how-to-debug-android-applications-on-your-phone/) link to debug android application on real device. You can refer [this](http://stackoverflow.com/questions/5819195/how-to-run-the-android-application-in-device) too. – CSharp Aug 03 '12 at 06:48

3 Answers3

3

Follow this:-

As explianed above by Nirav-:

You can check the build target version(Right Click Project - Property - Android) and verify with your devcie. if not matching, change the target version to your devcie platform version.

Never ever do the above step because doing this would immensely effect the entire eclipse environment for android,as a result you would face errors in your XML file which you won't be able to fix easily..

you entire project would start showing errors on all your java files using any of the respective layouts--specifically on setcontentview(R.layout.YourXMLFileName)

you would be asked to import'R'(android),which won't fix your problem...

Now that if you have changed the version of android platform on which you were developing your application,what you should do is change it back to original,you would be asked to install certain packages only after you are through with installations you would be able to restore your original settings or resolve errors...

Manik

Manik
  • 31
  • 3
1

You can check the build target version(Right Click Project - Property - Android) and verify with your devcie. if not matching, change the target version to your devcie platform version.

Added to that you can verify following

-Unknown Source to true

-Debuggable requires USB Debugging

-Non Mass Storage mode/USB connect to access the SD Card

-unplug replug

-reboot the phone (to be sure you can unplug the usb and remove the battery)

-restart adb

I have refered these from here

I hope this will help you.

Community
  • 1
  • 1
CSharp
  • 1,573
  • 2
  • 14
  • 25
1

May be the problem is that you are not running a fresh copy of your app on Emulator. Due to this the code for creating a new SQLite database for new installation of your Application is not checked, but this always happens in your Mobile device coz it would make a fresh installation of App. So try debugging on "Create" part of SQLite db of app. It may solve the problem !!