Sudden shutdown with IllegalStateException without doing anything - java

After 26 minutes leaving my app running without doing anything with it as a user, "app has stopped" window suddenly pop up and Logcat prints only this:
07-15 20:34:16.595 27361-27363/test.game D/dalvikvm: GC_CONCURRENT freed 1419K, 44% free 13902K/24391K, paused 4ms+9ms, total 66ms
07-15 20:34:28.997 27361-27363/test.game D/dalvikvm: GC_CONCURRENT freed 1416K, 43% free 13903K/24391K, paused 3ms+7ms, total 56ms
07-15 20:34:29.418 27361-27361/test.game D/AndroidRuntime: Shutting down VM
07-15 20:34:29.418 27361-27361/test.game W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x412b52a0)
07-15 20:34:29.498 27361-27361/test.game E/AndroidRuntime: FATAL EXCEPTION: main
java.lang.IllegalStateException: onMeasure() did not set the measured dimension by calling setMeasuredDimension()
at android.view.View.measure(View.java:15293)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
at android.view.View.measure(View.java:15288)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
at android.view.View.measure(View.java:15288)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15288)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15288)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2397)
at android.view.View.measure(View.java:15288)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1974)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1217)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1390)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
Any ideas where could be problem? It happened now for 2nd time (1st time it happened slightly sooner, in about ~13 mins), so it's not some "random" issue.
I can't provide any sample code since none of the Logcat errors links to my code (all goes to the source of specific View). Another strange behaviour is, this happened twice on my S3 Mini (in mentioned 13 and 26 mins), but didn't happened yet on my old Ace S5830i - app is running 4 hours 9 minutes and still nothing here!
edit n1:
Only thing which is running on background is Timer executed each 17ms. I'm displaying hours, minutes, seconds and milis on screen thanks to it.
timer.scheduleAtFixedRate(new TimerTask() ...
currentTime = System.currentTimeMillis() - start;
milisecond = currentTime % 1000;
long x = currentTime / 1000;
second = x % 60;
x /= 60;
minute = x % 60;
x /= 60;
hour = x % 24;
variable start is another System.currentTimeMillis(). It has still value, assigned when this Timer was created.
It's also possible that S3 Mini was a bit "overworked", because I've been developing and testing on it from computer all the day (and the newest Android Studio eats quite a lot memory in phone against AS v1.0.0). I'll try another tests tomorow and let you know how it ended.

Related

Sudden app shutdown without doing any activity, throws IllegalStateException onMeasure()

My app always shutdown in random time interval (mostly from few minutes to something like 20 mins). The "App stopped working" messagebox appears. Biggest problem is, I don't do anything in app (like interacting with it), and it just random shutdown by itself. Here's logcat print:
07-15 20:34:16.595 27361-27363/test.game D/dalvikvm: GC_CONCURRENT freed 141
9K, 44% free 13902K/24391K, paused 4ms+9ms, total 66ms
07-15 20:34:28.997 27361-27363/test.game D/dalvikvm: GC_CONCURRENT freed 1416K, 43% free 13903K/24391K, paused 3ms+7ms, total 56ms
07-15 20:34:29.418 27361-27361/test.game D/AndroidRuntime: Shutting down VM
07-15 20:34:29.418 27361-27361/test.game W/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x412b52a0)
07-15 20:34:29.498 27361-27361/test.game E/AndroidRuntime: FATAL EXCEPTION: main java.lang.IllegalStateException: onMeasure() did not set the measured dimension by calling setMeasuredDimension()
at android.view.View.measure(View.java:15293)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
at android.view.View.measure(View.java:15288)
at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:617)
at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:399)
at android.view.View.measure(View.java:15288)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at android.view.View.measure(View.java:15288)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876)
at android.widget.LinearLayout.measureChildBeforeLayout(LinearLayout.java:1396)
at android.widget.LinearLayout.measureVertical(LinearLayout.java:681)
at android.widget.LinearLayout.onMeasure(LinearLayout.java:574)
at android.view.View.measure(View.java:15288)
at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4876)
at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2397)
at android.view.View.measure(View.java:15288)
at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1974)
at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1217)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1390)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1113)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4481)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
at android.view.Choreographer.doCallbacks(Choreographer.java:555)
at android.view.Choreographer.doFrame(Choreographer.java:525)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4867)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774)
at dalvik.system.NativeStart.main(Native Method)
One would say, it's because I didn't write setMeasuredDimension() when overriding method onMeasure(). Also, docs say you have to write this line to your onMeasure, otherwise the IllegalStateException will be thrown (see it here).
But I don't overriding onMeasure anywhere in my whole project, so problem is not here (at least not on my side in this case).
Few things to note:
this is full logcat log, and any of these lines ("at android. ...") doesn't link to my code, all goes to source - that means all of these links are gray
this exception always happens only on my S3 Mini (android 4.1.2), but never happened on my old Galaxy Ace S5830i (android 2.3.6) (and yes, I tested it alot - over 20hours on old phone and app still running!).
never happened in emulator
there are no "view resizing" operations running in background, which could cause this exception
I would like to post some code, but I have absolutely no idea where this exception could be thrown.
If someone can help, I'd be really, really grateful. I'm lost at this point...
Since there is not code, this is just a random guess. You can start by looking out for activities in which you've added fragments. It might be that the activity containing a fragment has been destroyed on the device due to inactivity for a long time(and memory requirements by the system, which I think is the reason that you are finding the bug on a device and not on the other). So the case is that the fragment might be referring to a view which might not be attached to the window now. (You can also look for views that use fragment adapters like viewPager, etc if you have used them).

App crashes when Home or Back button press

So, my app crashes when I press Home button or Back button. I don't know how to solve this issue. Help!!!
public class Game extends SurfaceView implements SurfaceHolder.Callback {
public Game(Context context) {
super(context);
getHolder().addCallback(this);
gameContext = context;
}
...
public void surfaceDestroyed(SurfaceHolder holder) {
boolean retry = true;
updateThread.setRunning(false);
while (retry) {
try {updateThread.join();
retry = false; }
catch (InterruptedException e) {
}
}
}
}
And here is a log of process when I press Home button:
07-15 07:43:47.333: I/ActivityManager(285): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 285
07-15 07:43:47.673: W/WindowManager(285): Screenshot failure taking screenshot for (290x515) to layer 21015
07-15 07:43:48.013: D/gralloc(36): Registering a buffer in the process that created it. This may cause memory ordering problems.
07-15 07:43:48.043: I/ARMAssembler(36): generated scanline__00000077:03010104_00008004_00000000 [ 84 ipp] (103 ins) at [0x4296eea0:0x4296f03c] in 599261 ns
07-15 07:43:48.464: D/gralloc(36): Registering a buffer in the process that created it. This may cause memory ordering problems.
07-15 07:43:48.504: I/ActivityManager(285): Config changes=1480 {1.0 310mcc260mnc en_US ldltr sw360dp w360dp h567dp 320dpi nrml port finger -keyb/v/h tball/v s.8}
07-15 07:43:48.574: I/InputReader(285): Reconfiguring input devices. changes=0x00000004
07-15 07:43:48.574: I/InputReader(285): Device reconfigured: id=0, name='qwerty2', size 720x1280, orientation 0, mode 1, display id 0
07-15 07:43:49.003: I/Choreographer(560): Skipped 168 frames! The application may be doing too much work on its main thread.
07-15 07:43:49.343: D/PhoneStatusBar(560): mSettingsPanelGravity = 55
07-15 07:43:49.593: D/dalvikvm(560): GC_FOR_ALLOC freed 7091K, 51% free 7087K/14336K, paused 111ms, total 131ms
07-15 07:43:49.743: W/WindowManager(285): Window freeze timeout expired.
07-15 07:43:49.743: W/WindowManager(285): Force clearing orientation change: Window{41ada620 u0 NavigationBar}
07-15 07:43:49.824: I/WindowManager(285): Screen frozen for +2s101ms due to Window{41ada620 u0 NavigationBar}
07-15 07:43:50.194: I/Choreographer(560): Skipped 124 frames! The application may be doing too much work on its main thread.
07-15 07:43:50.803: I/Choreographer(400): Skipped 119 frames! The application may be doing too much work on its main thread.
07-15 07:43:51.783: I/Choreographer(400): Skipped 106 frames! The application may be doing too much work on its main thread.
07-15 07:43:52.493: I/Choreographer(560): Skipped 194 frames! The application may be doing too much work on its main thread.
07-15 07:43:53.105: W/IInputConnectionWrapper(799): showStatusIcon on inactive InputConnection
07-15 07:43:54.173: D/dalvikvm(285): GC_EXPLICIT freed 3158K, 52% free 5244K/10724K, paused 5ms+11ms, total 134ms
try releasing resources which are consuming memory whenever they are in no use and you can do this in onPause() methods
you can also make some changes in manifiest.xml file like this
<activity android:name="your.package.name.YourActivity" android:configChanges="orientation|keyboard|keyboardHidden|screenLayout|uiMode|screenSize|smallestScreenSize" android:screenOrientation="landscape">
...

RecognizerIntent gives error after latest Google Search update

I have implemented a continous speech recognizer using SpeechRecognizer.
RecognitionListener generally goes to ERROR_NETWORK (Error no 2) after onBeginningOfSpeech.
This occurs not every time but many times.
This behaviour started since last update of Google 4.1.24.1672412.arm update (12 January 2015)
protected class SpeechRecognitionListener implements RecognitionListener
{
public void onBeginningOfSpeech()
{
}
public void onError(int error)
{
if (mIsStreamSolo)
{ // CAudioLibrary.unmute();
mIsStreamSolo = false;
}
if(error == SpeechRecognizer.ERROR_NETWORK||error == SpeechRecognizer.ERROR_SERVER)
{
.....
I have examined logcat and found out that it gives many errors like this:
It is not my device specific, it gives the same error on my users devices also. Is there a problem on google site ? If I revert google update, it works without giving these errors.
Thank you in advance.
01-15 14:36:48.656 3012-3012/? D/STATUSBAR-NetworkController﹕
onDataActivity: direction=2 01-15 14:36:48.656 3012-3012/?
D/STATUSBAR-NetworkController﹕ refreshSignalCluster -
setNWBoosterIndicators(false) 01-15 14:36:48.656 3012-3012/?
D/STATUSBAR-NetworkController﹕ refreshSignalCluster: data=2 bt=false
01-15 14:36:48.691 32404-32409/? D/dalvikvm﹕ GC_CONCURRENT freed
384K, 25% free 10740K/14260K, paused 10ms+3ms, total 40ms 01-15
14:36:48.871 5732-13019/? W/JavaNetConnection﹕ Failed to get
connection status.
java.io.FileNotFoundException: https://www.google.com/m/voice-search/down?pair=6239918a-dc45-4eea-ac6f-b9bf8de57ced
at kxb.getInputStream(PG:228)
at kxa.getInputStream(PG:210)
at kxc.getInputStream(PG:25)
at cla.Gj(PG:256)
at dzz.Gj(PG:26)
at cla.Gi(PG:240)
at cla.disconnect(PG:132)
at clb.b(PG:110)
at clb.a(PG:66)
at dzb.a(PG:197)
at cqj.HS(PG:529)
at cqi.run(PG:314) 01-15 14:36:48.871 5732-13019/? W/S3NetworkUtils﹕ [Download] response code: 400, internal error
header: -74061 01-15 14:36:49.071 5732-13104/? W/JavaNetConnection﹕
Failed to get connection status.
java.io.FileNotFoundException: https://www.google.com/m/voice-search/down?pair=af1df3dc-08ac-45fd-bb30-eee3393bcb9c
at kxb.getInputStream(PG:228)
at kxa.getInputStream(PG:210)
at kxc.getInputStream(PG:25)
at cla.Gj(PG:256)
at dzz.Gj(PG:26)
at cla.Gi(PG:240)
at cla.disconnect(PG:132)
at clb.b(PG:110)
at clb.a(PG:66)
at dzb.a(PG:197)
at cqj.HS(PG:529)
at cqi.run(PG:314) 01-15 14:36:49.071 5732-13104/? W/S3NetworkUtils﹕ [Download] response code: 400, internal error
Also, I have noticed following lines:
01-15 14:36:55.556 5732-6800/? W/EventLogger﹕ recordGsaError
eyd: tr-TR
at hdv.a(PG:121)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at fid.run(PG:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841) 01-15 14:36:55.556 5732-6800/? W/ErrorProcessor﹕ onFatalError, ignoring
error from engine(1): eyd: tr-TR 01-15 14:36:55.556 5732-6800/?
W/EventLogger﹕ recordGsaError
eyb: GsaErrorCode: 458756, engine: 1
at hdv.a(PG:126)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at fid.run(PG:102)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:152)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:265)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841) 01-15 14:36:55.556 5732-6800/? W/DefaultRecognitionState﹕ Repeated error
from secondary engine. 01-15 14:36:55.556 5732-6800/?
W/ErrorProcessor﹕ onFatalError, ignoring error from engine(1): eyb:
GsaErrorCode: 458756, engine: 1

Service not registered: org.OpenUDID.OpenUDID_manager#2b038438

I have an application published in Google play and some time ago i received two error reports in my developer console which looks just like this:
java.lang.IllegalArgumentException: Service not registered: org.OpenUDID.OpenUDID_manager#2b038438
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:891)
at android.app.ContextImpl.unbindService(ContextImpl.java:921)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:352)
at org.OpenUDID.OpenUDID_manager.onServiceConnected(OpenUDID_manager.java:68)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1064)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1081)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3701)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:624)
at dalvik.system.NativeStart.main(Native Method)
and second:
java.lang.IllegalArgumentException: Service not registered: org.OpenUDID.OpenUDID_manager#40590d88
at android.app.LoadedApk.forgetServiceDispatcher(LoadedApk.java:934)
at android.app.ContextImpl.unbindService(ContextImpl.java:952)
at android.content.ContextWrapper.unbindService(ContextWrapper.java:352)
at org.OpenUDID.OpenUDID_manager.onServiceConnected(OpenUDID_manager.java:68)
at android.app.LoadedApk$ServiceDispatcher.doConnected(LoadedApk.java:1107)
at android.app.LoadedApk$ServiceDispatcher$RunConnection.run(LoadedApk.java:1124)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:150)
at android.app.ActivityThread.main(ActivityThread.java:4293)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)
Can somebody explain me what is all this about? Non of the specified packages in stack trace are from my app.
Some of the libraries which i use are adcolony and appbooster. (I suppose that this libs might be the cause of problem).
Have a great new year 2014.if the answer is feasible than raise the answer and points :)
Hi i think i got the this problem please have a look.
Make sur you are using correct context.
one of these days
mService.unbindService(mConnection);
is obviously nonsense, calling unbind in the wrong context. It should be
unbindService(mConnection);
Additional mistake in the posted coding is the missing of
#Override
public boolean onUnbind(Intent intent) {
// All clients have unbound with unbindService()
return false;
}

Couldn't get connection factory client

everything is working fine but the problem when i am map a location nothing nothing happen
i registered my google map and i did every instruction here
http://code.google.com/intl/pl/android/add-ons/google-apis/mapkey.html
i can see the map i can zoom in & out but when i am searching for a location i am getting this in logcat
05-01 12:59:35.512: ERROR/MapActivity(488): Couldn't get connection factory client
05-01 12:59:36.012: INFO/ActivityManager(70): Displayed TaskManager.com/.AddLocationMapActivity: +4s562ms
05-01 12:59:36.692: WARN/KeyCharacterMap(488): No keyboard for id 0
05-01 12:59:36.692: WARN/KeyCharacterMap(488): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
05-01 12:59:41.192: DEBUG/dalvikvm(238): GC_EXPLICIT freed 6K, 54% free 2543K/5511K, external 410K/517K, paused 77ms
05-01 12:59:46.352: DEBUG/dalvikvm(318): GC_EXPLICIT freed 6K, 54% free 2597K/5639K, external 410K/517K, paused 158ms
05-01 12:59:51.362: DEBUG/dalvikvm(352): GC_EXPLICIT freed <1K, 54% free 2539K/5511K, external 410K/517K, paused 144ms
05-01 12:59:54.262: WARN/System.err(488): java.io.IOException: Service not Available
05-01 12:59:54.272: WARN/System.err(488): at android.location.Geocoder.getFromLocationName(Geocoder.java:178)
05-01 12:59:54.282: WARN/System.err(488): at TaskManager.com.AddLocationMapActivity.mapCurrentLocation(AddLocationMapActivity.java:59)
05-01 12:59:54.282: WARN/System.err(488): at TaskManager.com.AddLocationMapActivity$1.onClick(AddLocationMapActivity.java:49)
05-01 12:59:54.292: WARN/System.err(488): at android.view.View.performClick(View.java:2485)
05-01 12:59:54.302: WARN/System.err(488): at android.view.View$PerformClick.run(View.java:9080)
05-01 12:59:54.302: WARN/System.err(488): at android.os.Handler.handleCallback(Handler.java:587)
05-01 12:59:54.332: WARN/System.err(488): at android.os.Handler.dispatchMessage(Handler.java:92)
05-01 12:59:54.332: WARN/System.err(488): at android.os.Looper.loop(Looper.java:123)
05-01 12:59:54.342: WARN/System.err(488): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-01 12:59:54.342: WARN/System.err(488): at java.lang.reflect.Method.invokeNative(Native Method)
05-01 12:59:54.352: WARN/System.err(488): at java.lang.reflect.Method.invoke(Method.java:507)
05-01 12:59:54.362: WARN/System.err(488): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-01 12:59:54.362: WARN/System.err(488): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-01 12:59:54.372: WARN/System.err(488): at dalvik.system.NativeStart.main(Native Method)
and here is my java code
protected void mapCurrentLocation() {
String addressString = addressText.getText().toString();
Geocoder g = new Geocoder(this,Locale.getDefault());
List<Address> addresses;
try
{
//when i use the debugger i get exception at next line
addresses = g.getFromLocationName(addressString, 1);
if(null != addresses && addresses.size()>0)
{
address=addresses.get(0);
List<Overlay> mapOverlay=mapView.getOverlays();
AdreesOverlay addressoverlay = new AdreesOverlay(address);
mapOverlay.add(addressoverlay);
mapView.invalidate();
final MapController mapController=mapView.getController();
mapController.animateTo(addressoverlay.getGeopoint(),new Runnable(){
public void run() {
mapController.setZoom(12);
}});
}
else
{
}
}
catch(IOException exception)
{
exception.printStackTrace();
}
}
any help ? thanks in advance
If you are running this in an emulator either version API 8 or API 9, this is a known bug with the emulator, see this bug report service not available
I find the same behaviour. I can get it to work on an API level 7 emulator (2.1), although sometimes it fails, so I have my code try twice before popping up a "geocoder error" Toast.
make sure you're using the correct API KEY... follow the instructions here:
http://code.google.com/android/add-ons/google-apis/mapkey.html
note that the debug test build uses the debug.keystore, so make sure you create a key for it...while not in production.

Categories

Resources