简体   繁体   中英

App works fine on Emulator but not on Mobile device

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)

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

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.

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 !!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM