NullPointerException in background thread when attempting to call messenger - android

I'm testing a simple Android app that uses a Service, Thread, and Messenger. I noticed when I quickly start and stop the Service I sometimes get a NullPointerException and FORCE CLOSE. I debugged it and found out my Messenger instance is sometimes null and thus my handler does not get called. What am I doing wrong? Do I need to wait before restarting the Service?
OK it just now happened without the quick stop/start of the Service. So I am not sure how to reproduce this problem. It may occur randomly.
I can catch the exception and get rid of the FORCE CLOSE, but that does not solve my problem of my handler not getting called when the Messenger instance is null. I looked at the Services documentation section on Managing the Lifecycle of a Service, and I did not see any mention of having to wait before restarting a Service.
This is how I start my Service:
Intent backgroundService = new Intent(PlayAudio.this, com.marie.mp3player.BackgroundService.class);
backgroundService.putExtra(BackgroundService.EXTRA_MESSENGER, new Messenger(handler));
backgroundService.putExtra(BackgroundService.EXTRA_SONG, song);
startService(backgroundService);
This is how I stop my Service:
Intent backgroundService = new Intent(MP3Player.this, BackgroundService.class);
stopService(backgroundService);
And here is a logcat containing two NullPointerExceptions near the bottom:
D/AndroidRuntime(17736):
D/AndroidRuntime(17736): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17736): CheckJNI is OFF
D/dalvikvm(17736): creating instr width table
D/AndroidRuntime(17736): Calling main entry com.android.commands.pm.Pm
I/ActivityManager( 96): Start proc com.android.defcontainer for service com.android.defcontainer/.DefaultContainerService: pid=17744 uid=10011 gids={1015, 2001}
D/dalvikvm(17744): GC_EXPLICIT freed 46K, 50% free 2720K/5379K, external 1625K/2137K, paused 34ms
W/ActivityManager( 96): No content provider found for:
D/PackageParser( 96): Scanning package: /data/app/vmdl-1782488429.tmp
W/ActivityManager( 96): No content provider found for:
I/PackageManager( 96): Removing non-system package:com.marie.mp3player
I/ActivityManager( 96): Force stopping package com.marie.mp3player uid=10091
D/PackageManager( 96): Scanning package com.marie.mp3player
I/PackageManager( 96): Package com.marie.mp3player codePath changed from /data/app/com.marie.mp3player-2.apk to /data/app/com.marie.mp3player-1.apk; Retaining data and using new
I/PackageManager( 96): Unpacking native libraries for /data/app/com.marie.mp3player-1.apk
D/installd( 70): DexInv: --- BEGIN '/data/app/com.marie.mp3player-1.apk' ---
D/dalvikvm(17752): creating instr width table
D/dalvikvm(17752): DexOpt: load 5ms, verify+opt 18ms
D/installd( 70): DexInv: --- END '/data/app/com.marie.mp3player-1.apk' (success) ---
D/PackageManager( 96): Services: com.marie.mp3player.BackgroundService
D/PackageManager( 96): Activities: com.marie.mp3player.MP3Player com.marie.mp3player.PlayAudio
I/ActivityManager( 96): Force stopping package com.marie.mp3player uid=10091
W/PackageManager( 96): Code path for pkg : com.marie.mp3player changing from /data/app/com.marie.mp3player-2.apk to /data/app/com.marie.mp3player-1.apk
W/PackageManager( 96): Resource path for pkg : com.marie.mp3player changing from /data/app/com.marie.mp3player-2.apk to /data/app/com.marie.mp3player-1.apk
I/installd( 70): move /data/dalvik-cache/data#app#com.marie.mp3player-1.apk#classes.dex -> /data/dalvik-cache/data#app#com.marie.mp3player-1.apk#classes.dex
D/PackageManager( 96): New package installed in /data/app/com.marie.mp3player-1.apk
I/ActivityManager( 96): Force stopping package com.marie.mp3player uid=10091
D/dalvikvm( 96): GC_EXPLICIT freed 842K, 41% free 6421K/10759K, external 2424K/3027K, paused 106ms
D/dalvikvm( 192): GC_EXPLICIT freed 16K, 45% free 4617K/8327K, external 15977K/17649K, paused 67ms
D/dalvikvm( 158): GC_EXPLICIT freed 525K, 54% free 3151K/6791K, external 2480K/3071K, paused 49ms
I/ActivityManager( 96): Start proc com.appspot.swisscodemonkeys.apps for broadcast com.appspot.swisscodemonkeys.apps/.PackageReceiver: pid=17753 uid=10084 gids={3003}
I/ActivityThread(17753): Pub appbrain.SuggestionProvider: com.appspot.swisscodemonkeys.apps.search.SearchSuggestionSampleProvider
D/dalvikvm(11468): GC_EXPLICIT freed 2K, 49% free 2965K/5767K, external 1625K/2137K, paused 314ms
I/ActivityManager( 96): Start proc com.noshufou.android.su for broadcast com.noshufou.android.su/.UninstallReceiver: pid=17761 uid=10056 gids={1015, 3003}
D/dalvikvm( 96): GC_EXPLICIT freed 273K, 41% free 6367K/10759K, external 2424K/3027K, paused 101ms
I/installd( 70): unlink /data/dalvik-cache/data#app#com.marie.mp3player-2.apk#classes.dex
D/AndroidRuntime(17736): Shutting down VM
D/dalvikvm(17736): GC_CONCURRENT freed 101K, 72% free 296K/1024K, external 0K/0K, paused 0ms+1ms
D/jdwp (17736): Got wake-up signal, bailing out of select
D/dalvikvm(17736): Debugger has detached; object registry had 1 entries
I/ActivityManager( 96): Start proc com.android.voicedialer for broadcast com.android.voicedialer/.VoiceDialerReceiver: pid=17770 uid=10048 gids={3002}
D/VoiceDialerReceiver(17770): onReceive Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:com.marie.mp3player flg=0x10000000 cmp=com.android.voicedialer/.VoiceDialerReceiver (has extras) }
V/RecognizerEngine(17770): deleteCachedGrammarFiles /data/data/com.android.voicedialer/files/openentries.txt
I/ActivityManager( 96): Start proc com.android.vending for broadcast com.android.vending/.PackageMonitorReceiver: pid=17779 uid=10046 gids={1015, 3003}
D/dalvikvm( 67): GC_EXPLICIT freed 11K, 50% free 2717K/5379K, external 1625K/2137K, paused 94ms
D/dalvikvm( 67): GC_EXPLICIT freed <1K, 50% free 2717K/5379K, external 1625K/2137K, paused 81ms
I/ActivityThread(17779): Pub com.android.vending.SuggestionsProvider: com.android.vending.SuggestionsProvider
D/vending (17779): [1] VendingApplication.onCreate(): Resetting ServiceLocator from app
D/dalvikvm( 67): GC_EXPLICIT freed <1K, 50% free 2717K/5379K, external 1625K/2137K, paused 93ms
D/InstallReceiver(17761): com.marie.mp3player
I/ActivityManager( 96): Start proc com.google.android.partnersetup for broadcast com.google.android.partnersetup/.AppInstalledReceiver: pid=17791 uid=10021 gids={}
D/AndroidRuntime(17783):
D/AndroidRuntime(17783): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(17783): CheckJNI is OFF
D/dalvikvm(17783): creating instr width table
D/GTalkService( 211): handlePackageInstalled: re-initialize providers
D/GTalkService( 211): [RawStanzaProvidersMgr] ##### searchProvidersFromIntent
D/GTalkService( 211): [RawStanzaProvidersMgr] no intent receivers found
D/VoiceDialerReceiver(17770): onReceive Intent { act=android.intent.action.PACKAGE_ADDED dat=package:com.marie.mp3player flg=0x10000000 cmp=com.android.voicedialer/.VoiceDialerReceiver (has extras) }
V/RecognizerEngine(17770): deleteCachedGrammarFiles /data/data/com.android.voicedialer/files/openentries.txt
I/ActivityManager( 96): Start proc com.google.android.googlequicksearchbox for broadcast com.google.android.googlequicksearchbox/.CorporaUpdateReceiver: pid=17798 uid=10022 gids={3003}
I/ActivityThread(17798): Pub com.google.android.googlequicksearchbox.shortcuts: com.google.android.googlequicksearchbox.ShortcutsProvider
I/ActivityThread(17798): Pub com.google.android.googlequicksearchbox.google: com.google.android.googlequicksearchbox.google.GoogleSuggestionProvider
I/ActivityManager( 96): Start proc com.google.android.apps.maps:FriendService for broadcast com.google.android.apps.maps/com.google.googlenav.friend.android.ServiceReceiver: pid=17812 uid=10033 gids={3003, 1015}
D/AndroidRuntime(17783): Calling main entry com.android.commands.am.Am
I/ActivityManager( 96): Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.marie.mp3player/.MP3Player } from pid 17783
D/AndroidRuntime(17783): Shutting down VM
D/dalvikvm(17783): GC_CONCURRENT freed 102K, 69% free 320K/1024K, external 0K/0K, paused 0ms+0ms
D/jdwp (17783): Got wake-up signal, bailing out of select
D/dalvikvm(17783): Debugger has detached; object registry had 1 entries
I/ActivityManager( 96): Start proc com.marie.mp3player for activity com.marie.mp3player/.MP3Player: pid=17822 uid=10091 gids={}
I/AndroidRuntime(17783): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager( 96): Start proc com.google.android.apps.maps:NetworkLocationService for service com.google.android.apps.maps/com.google.android.location.internal.server.NetworkLocationService: pid=17830 uid=10033 gids={3003, 1015}
I/ActivityManager( 96): Displayed com.marie.mp3player/.MP3Player: +429ms
I/ActivityManager( 96): Start proc com.noinnion.android.greader.readerpro for broadcast com.noinnion.android.greader.readerpro/.OnUpgradeReceiver: pid=17831 uid=10070 gids={3003, 1015}
V/RenderScript_jni( 192): surfaceDestroyed
I/ActivityThread(17831): Pub com.noinnion.android.greader.readerpro: com.noinnion.android.greader.readerpro.ReaderProvider
D/InternalNlpService(17830): onCreate
D/NetworkLocationServiceThread(17830): start monitoring enabled
D/NetworkLocationServiceThread(17830): updateState
D/NetworkLocationServiceThread(17830): Creating RealOs
D/vending (17779): [11] LocalAssetCache.updateOnePackage(): No local info for com.marie.mp3player
D/szipinf (17830): Initializing inflate state
D/szipinf (17830): Initializing zlib to inflate
D/vending (17779): [12] LocalAssetCache.updateOnePackage(): No local info for com.marie.mp3player
D/dalvikvm(17830): GC_CONCURRENT freed 460K, 43% free 3851K/6727K, external 1625K/2137K, paused 2ms+3ms
D/WifiLocator(17830): Too many cache misses. Need server request. hasLocation=0 noLocation=1 cacheMiss=2
I/System.out(17830): [INFO:1747]: f: Running flush
I/System.out(17830): [INFO:1761]: f: Sending payload [bytes=300]
I/System.out(17830): [INFO:6772]: f: Running flush
I/System.out(17830): [INFO:6761]: f: Running delayed flush
I/ActivityManager( 96): Start proc org.my_pod.mypod for service org.my_pod.mypod/net.robmunro.mypod.UpdateFeedsService: pid=17853 uid=10080 gids={3003, 1015}
I/ActivityThread(17853): Pub org.my_pod.mypod: net.robmunro.mypod.util.MyPodContentProvider
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +297ms
W/KeyCharacterMap(17822): No keyboard for id 131074
W/KeyCharacterMap(17822): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
D/MP3Player(17822): Stop the background Service
D/WifiLocator(17830): Too many cache misses. Need server request. hasLocation=0 noLocation=1 cacheMiss=2
E/GlsClient-query(17830): requestFailed
E/GlsClient-query(17830): ay.g
E/GlsClient-query(17830): at ay.d.t(Unknown Source)
E/GlsClient-query(17830): at ay.b.a(Unknown Source)
E/GlsClient-query(17830): at Z.b.g(Unknown Source)
E/GlsClient-query(17830): at Z.a.g(Unknown Source)
E/GlsClient-query(17830): at Z.d.run(Unknown Source)
E/GlsClient-query(17830): at aE.d.run(Unknown Source)
D/dalvikvm(13124): GC_EXPLICIT freed 2K, 50% free 2715K/5379K, external 1625K/2137K, paused 56ms
D/dalvikvm( 192): GC_EXPLICIT freed 88K, 44% free 4690K/8327K, external 16026K/17649K, paused 85ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +305ms
D/MP3Player(17822): Stop the background Service
D/dalvikvm(17830): GC_CONCURRENT freed 1201K, 51% free 3612K/7239K, external 1625K/2137K, paused 3ms+3ms
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/System.out(17830): [INFO:50519]: f: Response [http=200,length=147]
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +307ms
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +255ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +302ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +296ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +294ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
E/(Messenger)messenger: (17822): NullPointerException
W/System.err(17822): java.lang.NullPointerException
W/System.err(17822): at com.marie.mp3player.BackgroundService$ServiceWorker.run(BackgroundService.java:65)
W/System.err(17822): at java.lang.Thread.run(Thread.java:1019)
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +278ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
E/(Messenger)messenger: (17822): NullPointerException
W/System.err(17822): java.lang.NullPointerException
W/System.err(17822): at com.marie.mp3player.BackgroundService$ServiceWorker.run(BackgroundService.java:65)
W/System.err(17822): at java.lang.Thread.run(Thread.java:1019)
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +282ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +307ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +284ms
D/MP3Player(17822): Stop the background Service
I/ActivityManager( 96): Starting: Intent { cmp=com.marie.mp3player/.PlayAudio (has extras) } from pid 17822
I/handleMessge(17822): songNum: 10
I/ActivityManager( 96): Displayed com.marie.mp3player/.PlayAudio: +291ms
It was suggested that I add the code where the NullPointerException occurs. Very important. In fact here's the whole thread where the exception occurs marked with an arrow and stars:
/*
* This is the ServiceWorker thread that calls messenger to pass messages
* and data to the PlayAudio activity.
*/
class ServiceWorker implements Runnable
{
public void run() {
// do background processing here... a simple message for now
// send a message to the handler defined in the PlayAudio
try {
Message msg1 = Message.obtain();
msg1.obj = "Song";
msg1.arg1 = song;
if (messenger == null) Log.e("(Messenger)messenger: ", "NullPointerException");
messenger.send(msg1); // <== *** EXCEPTION OCCURS HERE ***
} catch (RemoteException e) {
e.printStackTrace();
} catch (NullPointerException e) {
e.printStackTrace();
}
// stop the service when done...
// BackgroundService.this.stopSelf();
// Or use the unbindBtn in the MP3Player activity.
}
}
If anyone sees a mistake here that would sometimes cause my Message instance to be null I sure would appreciate an answer.

Marie, assuming that the rest of your service is as in your other question. Here is what happens and causes your NPE.
In onCreate you create and start your thread, but you extract messenger in onStart method. If your worker method executes before onStart, you get NPE. The order of them is random, so sometimes you get NPE and sometimes not.

Related

Unable to start service Intent { flg=0x4 cmp=mypackage/.AlarmReceiver (has extras) }: not found

Here my manifest? Is a manifest problem? Many many hours spent to discover the problem... is a service that starts a class by intent (using alarmmanager). If no a manifest problem, what's the problem?
Thanks for help!
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mypackage"
android:versionCode="1"
android:versionName="1" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" android:name="CrashReports">
<service android:name="UnUsedService">
<intent-filter>
<action
android:name="org.gortcloud.startatboot.UnUsedService" />
</intent-filter>
</service>
<receiver android:name="AutoStart">
<intent-filter>
<action
android:name="android.intent.action.BOOT_COMPLETED" />
<category android:name="android.intent.category.HOME" />
</intent-filter>
</receiver>
<receiver android:name="AlarmReceiver" android:process=":remote"/>
<activity
android:name="com.example.mypackage.MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:enabled="true" android:name=".SobService"/>
<activity android:name="Index"></activity>
<activity android:name="SendText"></activity>
</application>
</manifest>
logcat
E/ThrottleService( 149): problem during onPollAlarm: java.lang.IllegalStateException: problem parsing stats: java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No such file or directory)
D/dalvikvm( 149): GC_CONCURRENT freed 637K, 13% free 8307K/9479K, paused 25ms+12ms, total 142ms
D/AndroidRuntime(14611):
D/AndroidRuntime(14611): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(14611): CheckJNI is ON
D/dalvikvm(14611): Trying to load lib libjavacore.so 0x0
D/dalvikvm(14611): Added shared lib libjavacore.so 0x0
D/dalvikvm(14611): Trying to load lib libnativehelper.so 0x0
D/dalvikvm(14611): Added shared lib libnativehelper.so 0x0
D/AndroidRuntime(14611): Calling main entry com.android.commands.pm.Pm
W/ActivityManager( 149): No content provider found for permission revoke: file:///data/local/tmp/MainActivity.apk
D/dalvikvm( 2860): GC_CONCURRENT freed 457K, 14% free 5292K/6087K, paused 17ms+4ms, total 75ms
W/ActivityManager( 149): No content provider found for permission revoke: file:///data/local/tmp/MainActivity.apk
D/dalvikvm( 149): GC_CONCURRENT freed 614K, 12% free 8360K/9479K, paused 22ms+30ms, total 125ms
D/dalvikvm( 149): GC_FOR_ALLOC freed 282K, 13% free 8265K/9479K, paused 69ms, total 70ms
D/dalvikvm( 149): GC_FOR_ALLOC freed 234K, 13% free 8267K/9479K, paused 86ms, total 87ms
D/dalvikvm( 149): GC_FOR_ALLOC freed 239K, 13% free 8270K/9479K, paused 68ms, total 68ms
I/PackageManager( 149): Removing non-system package:org.gortcloud.perledisaggezza
I/ActivityManager( 149): Force stopping package org.gortcloud.perledisaggezza uid=10044
I/ActivityManager( 149): Killing proc 10610:org.gortcloud.perledisaggezza/u0a44: force stop
W/ActivityManager( 149): Force removing ActivityRecord{411fe0f0 org.gortcloud.perledisaggezza/.MainActivity}: app died, no saved state
W/InputDispatcher( 149): channel '412b50c0 org.gortcloud.perledisaggezza/org.gortcloud.perledisaggezza.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x9
E/InputDispatcher( 149): channel '412b50c0 org.gortcloud.perledisaggezza/org.gortcloud.perledisaggezza.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
I/WindowState( 149): WIN DEATH: Window{412b50c0 org.gortcloud.perledisaggezza/org.gortcloud.perledisaggezza.MainActivity paused=false}
W/InputDispatcher( 149): Attempted to unregister already unregistered input channel '412b50c0 org.gortcloud.perledisaggezza/org.gortcloud.perledisaggezza.MainActivity (server)'
I/Choreographer( 149): Skipped 75 frames! The application may be doing too much work on its main thread.
I/WindowManager( 149): WINDOW DIED Window{412b50c0 org.gortcloud.perledisaggezza/org.gortcloud.perledisaggezza.MainActivity paused=false}
I/Choreographer( 258): Skipped 238 frames! The application may be doing too much work on its main thread.
I/PackageManager( 149): Package org.gortcloud.perledisaggezza codePath changed from /data/app/org.gortcloud.perledisaggezza-2.apk to /data/app/org.gortcloud.perledisaggezza-1.apk; Retaining data and using new
W/InputMethodManagerService( 149): Got RemoteException sending setActive(false) notification to pid 10610 uid 10044
I/PackageManager( 149): Running dexopt on: org.gortcloud.perledisaggezza
D/dalvikvm(14630): DexOpt: load 129ms, verify+opt 643ms, 962252 bytes
W/PackageManager( 149): Code path for pkg : org.gortcloud.perledisaggezza changing from /data/app/org.gortcloud.perledisaggezza-2.apk to /data/app/org.gortcloud.perledisaggezza-1.apk
W/PackageManager( 149): Resource path for pkg : org.gortcloud.perledisaggezza changing from /data/app/org.gortcloud.perledisaggezza-2.apk to /data/app/org.gortcloud.perledisaggezza-1.apk
D/dalvikvm( 149): GC_FOR_ALLOC freed 320K, 13% free 8281K/9479K, paused 72ms, total 73ms
I/ActivityManager( 149): Force stopping package org.gortcloud.perledisaggezza uid=10044
D/PackageManager( 149): New package installed in /data/app/org.gortcloud.perledisaggezza-1.apk
W/PackageManager( 149): Not granting permission android.permission.READ_LOGS to package org.gortcloud.perledisaggezza (protectionLevel=50 flags=0x8be46)
I/ActivityManager( 149): Force stopping package org.gortcloud.perledisaggezza uid=10044
D/dalvikvm( 204): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 258): WAIT_FOR_CONCURRENT_GC blocked 1ms
D/dalvikvm( 204): GC_EXPLICIT freed 216K, 62% free 5881K/15367K, paused 8ms+19ms, total 155ms
D/dalvikvm( 258): GC_EXPLICIT freed 409K, 39% free 7423K/12103K, paused 8ms+22ms, total 156ms
D/dalvikvm( 323): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 323): GC_EXPLICIT freed 177K, 10% free 5564K/6151K, paused 8ms+9ms, total 88ms
I/InputReader( 149): Reconfiguring input devices. changes=0x00000010
D/PackageManager( 149): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
D/PackageManager( 149): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
D/BackupManagerService( 149): Received broadcast Intent { act=android.intent.action.PACKAGE_REMOVED dat=package:org.gortcloud.perledisaggezza flg=0x8000010 (has extras) }
D/dalvikvm( 149): WAIT_FOR_CONCURRENT_GC blocked 0ms
I/AccountTypeManager( 367): Loaded meta-data for 1 account types, 0 accounts in 53ms(wall) 5ms(cpu)
D/dalvikvm( 149): GC_EXPLICIT freed 503K, 15% free 8140K/9479K, paused 65ms+21ms, total 204ms
I/InputReader( 149): Reconfiguring input devices. changes=0x00000010
D/PackageManager( 149): generateServicesMap(android.accounts.AccountAuthenticator): 2 services unchanged
D/PackageManager( 149): generateServicesMap(android.content.SyncAdapter): 4 services unchanged
D/BackupManagerService( 149): Received broadcast Intent { act=android.intent.action.PACKAGE_ADDED dat=package:org.gortcloud.perledisaggezza flg=0x8000010 (has extras) }
V/BackupManagerService( 149): removePackageParticipantsLocked: uid=10044 #1
V/BackupManagerService( 149): addPackageParticipantsLocked: #1
W/InputMethodManagerService( 149): Found no subtypes in a system IME: com.android.inputmethod.pinyin
I/AccountTypeManager( 367): Loaded meta-data for 1 account types, 0 accounts in 11ms(wall) 7ms(cpu)
I/Choreographer( 258): Skipped 533 frames! The application may be doing too much work on its main thread.
D/dalvikvm( 149): WAIT_FOR_CONCURRENT_GC blocked 0ms
D/dalvikvm( 367): GC_CONCURRENT freed 403K, 12% free 5471K/6215K, paused 100ms+14ms, total 174ms
W/RecognitionManagerService( 149): no available voice recognition services found
D/dalvikvm( 149): GC_EXPLICIT freed 400K, 14% free 8170K/9479K, paused 27ms+47ms, total 266ms
D/AndroidRuntime(14611): Shutting down VM
D/dalvikvm(14611): GC_CONCURRENT freed 101K, 78% free 458K/2048K, paused 2ms+1ms, total 13ms
D/jdwp (14611): Got wake-up signal, bailing out of select
D/dalvikvm(14611): Debugger has detached; object registry had 1 entries
I/AndroidRuntime(14611): NOTE: attach of thread 'Binder_3' failed
D/AndroidRuntime(14647):
D/AndroidRuntime(14647): >>>>>> AndroidRuntime START com.android.internal.os.RuntimeInit <<<<<<
D/AndroidRuntime(14647): CheckJNI is ON
D/dalvikvm(14647): Trying to load lib libjavacore.so 0x0
D/dalvikvm(14647): Added shared lib libjavacore.so 0x0
D/dalvikvm(14647): Trying to load lib libnativehelper.so 0x0
D/dalvikvm(14647): Added shared lib libnativehelper.so 0x0
D/AndroidRuntime(14647): Calling main entry com.android.commands.am.Am
I/ActivityManager( 149): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=org.gortcloud.perledisaggezza/.MainActivity u=0} from pid 14647
W/WindowManager( 149): Failure taking screenshot for (123x221) to layer 21025
D/AndroidRuntime(14647): Shutting down VM
D/dalvikvm(14647): GC_CONCURRENT freed 102K, 77% free 489K/2048K, paused 1ms+2ms, total 11ms
D/jdwp (14647): Got wake-up signal, bailing out of select
D/dalvikvm(14647): Debugger has detached; object registry had 1 entries
I/AndroidRuntime(14647): NOTE: attach of thread 'Binder_3' failed
D/dalvikvm( 258): GC_CONCURRENT freed 539K, 38% free 7520K/12103K, paused 16ms+127ms, total 360ms
D/dalvikvm(14658): Not late-enabling CheckJNI (already on)
I/ActivityManager( 149): Start proc org.gortcloud.perledisaggezza for activity org.gortcloud.perledisaggezza/.MainActivity: pid=14658 uid=10044 gids={3003, 1028}
E/Trace (14658): error opening trace file: No such file or directory (2)
I/Choreographer( 149): Skipped 35 frames! The application may be doing too much work on its main thread.
D/ACRA (14658): ACRA is enabled for org.gortcloud.perledisaggezza, intializing...
D/ACRA (14658): Using default Report Fields
D/ACRA (14658): Looking for error files in /data/data/org.gortcloud.perledisaggezza/files
D/dalvikvm(14658): GC_FOR_ALLOC freed 179K, 9% free 5372K/5895K, paused 31ms, total 32ms
I/dalvikvm-heap(14658): Grow heap (frag case) to 5.965MB for 457616-byte allocation
D/dalvikvm(14658): GC_CONCURRENT freed 1K, 9% free 5817K/6343K, paused 19ms+13ms, total 61ms
D/dalvikvm(14658): GC_CONCURRENT freed 48K, 6% free 6322K/6663K, paused 15ms+4ms, total 65ms
D/dalvikvm(14658): WAIT_FOR_CONCURRENT_GC blocked 18ms
D/dalvikvm(14658): GC_FOR_ALLOC freed 48K, 6% free 6464K/6855K, paused 41ms, total 41ms
I/dalvikvm-heap(14658): Grow heap (frag case) to 7.234MB for 668816-byte allocation
D/dalvikvm(14658): GC_FOR_ALLOC freed <1K, 6% free 7117K/7559K, paused 58ms, total 58ms
D/dalvikvm(14658): GC_CONCURRENT freed <1K, 6% free 7117K/7559K, paused 16ms+4ms, total 64ms
I/Choreographer(14658): Skipped 58 frames! The application may be doing too much work on its main thread.
I/Choreographer(14658): Skipped 233 frames! The application may be doing too much work on its main thread.
D/gralloc_goldfish(14658): Emulator without GPU emulation detected.
I/ActivityManager( 149): Displayed org.gortcloud.perledisaggezza/.MainActivity: +1s713ms
I/Choreographer( 149): Skipped 61 frames! The application may be doing too much work on its main thread.
I/Choreographer( 149): Skipped 43 frames! The application may be doing too much work on its main thread.
I/Choreographer(14658): Skipped 271 frames! The application may be doing too much work on its main thread.
D/dalvikvm( 243): GC_CONCURRENT freed 384K, 13% free 5798K/6599K, paused 4ms+4ms, total 36ms
I/Choreographer(14658): Skipped 46 frames! The application may be doing too much work on its main thread.
I/Choreographer( 149): Skipped 36 frames! The application may be doing too much work on its main thread.
D/dalvikvm(14692): Not late-enabling CheckJNI (already on)
I/ActivityManager( 149): Start proc org.gortcloud.perledisaggezza:remote for broadcast org.gortcloud.perledisaggezza/.AlarmReceiver: pid=14692 uid=10044 gids={3003, 1028}
E/Trace (14692): error opening trace file: No such file or directory (2)
D/ACRA (14692): ACRA is enabled for org.gortcloud.perledisaggezza, intializing...
D/ACRA (14692): Using default Report Fields
D/ACRA (14692): Looking for error files in /data/data/org.gortcloud.perledisaggezza/files
D/gralloc_goldfish(14692): Emulator without GPU emulation detected.
UnUsedService (starts from my activity by:
startService(new Intent(this, UnUsedService.class));
UnUsedService
public class UnUsedService extends Service {
//private PendingIntent pendingIntent;
#Override
public IBinder onBind(Intent intent) {
return null;
}
#Override
public void onCreate() {
super.onCreate();
Toast.makeText(this, "Service Created", Toast.LENGTH_LONG).show();
//startService(new Intent(this, UnUsedService.class));
}
#Override
public void onDestroy() {
super.onDestroy();
Toast.makeText(this, "Service Destroyed", Toast.LENGTH_LONG).show();
}
private PendingIntent pendingIntent;
#SuppressWarnings("deprecation")
#Override
public void onStart(Intent intent, int startId) {
// super.onStart();
super.onStart(intent, startId);
Toast.makeText(this, "Service Started", Toast.LENGTH_LONG).show();
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.HOUR_OF_DAY, 23);
calendar.set(Calendar.MINUTE, 32);
calendar.set(Calendar.SECOND, 0); AlarmManager am = (AlarmManager) getApplicationContext().getSystemService (Context.ALARM_SERVICE);
PendingIntent pi = PendingIntent.getService(getApplicationContext(), 0, new Intent(getApplicationContext(), AlarmReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);
am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis()+1000, AlarmManager.INTERVAL_DAY, pi);
}};
Receiver:
public class AlarmReceiver extends BroadcastReceiver {
#Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Alarm worked.", Toast.LENGTH_LONG).show();
}
}
I noticed that you're creating the wrong type of PendingIntent:
pendingIntent = PendingIntent.getService(UnUsedService.this, 0, myIntent, 0);
You want to target your BroadcastReceiver, so you need to use:
pendingIntent = PendingIntent.getBroadcast(AlarmReceiver.this, 0, myIntent, 0);
instead of this in your mainifest. .
try this
<activity android:name="com.example.mypackage.Index"></activity>
<activity android:name="com.example.mypackage.SendText"></activity>

Application dies with "Low Memory: No more background processes."

In my application i try launching the browser with the following url:
https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore
The browser launches and when the map loads my application gets killed with the following logcat message:
I/ActivityManager( 61): Starting: Intent { act=android.intent.action.VIEW dat=
http://View cmp=com.android.browser/.BrowserActivity (has extras) } from pid 355
I/ActivityManager( 61): Starting: Intent { act=android.intent.action.VIEW dat=
https://maps.google.com/maps?saddr=indiranagar bangalore&daddr=mgroad bangalore
cmp=com.android.browser/.BrowserActivity } from pid 355
D/PhoneWindow( 355): couldn't save which view has focus because the focused vie
w android.widget.EditText#40587640 has no id.
I/ActivityManager( 61): Displayed com.android.browser/.BrowserActivity: +760ms
W/IInputConnectionWrapper( 355): showStatusIcon on inactive InputConnection
I/dalvikvm( 373): Jit: resizing JitTable from 1024 to 2048
I/System.out( 355): Logout Counter:30
D/dalvikvm( 373): GC_CONCURRENT freed 369K, 50% free 3921K/7751K, external 2234
K/2645K, paused 5ms+18ms
D/dalvikvm( 355): GC_EXPLICIT freed 866K, 50% free 3666K/7239K, external 2693K/
3310K, paused 1640ms
D/dalvikvm( 373): GC_CONCURRENT freed 1400K, 54% free 3641K/7751K, external 226
6K/2645K, paused 6ms+26ms
W/browser ( 373): We should not show context menu when nothing is touched
W/browser ( 373): We should not show context menu when nothing is touched
W/browser ( 373): We should not show context menu when nothing is touched
**I/ActivityManager( 61): Process com.aavarp.mobile (pid 355) has died.
I/ActivityManager( 61): Low Memory: No more background processes.**
I/WindowManager( 61): WIN DEATH: Window{408793c0 com.aavarp.mobile/com.aavarp.
mobile.core.ui.ApplicationsActivity paused=false}
E/InputDispatcher( 61): channel '4070e4f8 com.aavarp.mobile/com.aavarp.mobile.
dashboard.ui.components.GraphActivity (server)' ~ Consumer closed input channel
or an error occurred. events=0x8
E/InputDispatcher( 61): channel '4070e4f8 com.aavarp.mobile/com.aavarp.mobile.
dashboard.ui.components.GraphActivity (server)' ~ Channel is unrecoverably broke
n and will be disposed!
I/WindowManager( 61): WIN DEATH: Window{4070e4f8 com.aavarp.mobile/com.aavarp.
mobile.dashboard.ui.components.GraphActivity paused=false}
I/WindowManager( 61): WIN DEATH: Window{406836a8 com.aavarp.mobile/com.aavarp.
mobile.dashboard.ui.components.NotificationList paused=false}
I/WindowManager( 61): WIN DEATH: Window{406825a8 com.aavarp.mobile/com.aavarp.
mobile.dashboard.ui.components.TableListActivity paused=false}
I/WindowManager( 61): WIN DEATH: Window{4083df30 com.aavarp.mobile/com.aavarp.
mobile.dashboard.ui.components.DetailsActivity paused=false}
E/InputDispatcher( 61): Received spurious receive callback for unknown input c
hannel. fd=171, events=0x8
E/InputDispatcher( 61): Received spurious receive callback for unknown input c
hannel. fd=175, events=0x8
E/InputDispatcher( 61): Received spurious receive callback for unknown input c
hannel. fd=181, events=0x8
D/dalvikvm( 61): GC_CONCURRENT freed 1735K, 52% free 4435K/9159K, external 529
2K/6609K, paused 8ms+16ms
D/skia ( 129): purging 38K from font cache [5 entries]
D/dalvikvm( 129): GC_EXPLICIT freed 84K, 52% free 2801K/5767K, external 2117K/2
643K, paused 73ms
Again i tried launching the browser from my application with www.google.com and performed a search and browsed through various pages and navigated back to my application without any issues. I am not sure if am missing some message on the logcat. I use Android 2.3 OS.Could someone kindly help me resolve this issue please. Thanks in advance.
why do you want to load the maps in webview..? you load the map in a map activity or
use Intents List: Invoking Google Applications on Android Devices
String uri = "http://maps.google.com/maps?saddr=" + "9982878"+","+"76285774"+"&daddr="+"9992084"+","+"76286455";
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
startActivity(intent);
Note: for displaying route you should use map activity canvas

Detect when user launches a new application on an Android device

I have been trying to detect when the user launches an application on his/her device.
So I found this solution:
https://stackoverflow.com/a/7239840/833219
I added this code inside of a thread. So my application get the log every 3 milliseconds, but I cannot find the difference between logs, so I cannot detect what code is meant for the user's app launching.
Here is an example of the log I got when I add this line:
String w = log.toString();
Log.i("LockService","w ="+w);
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc android.process.media for broadcast com.android.providers.media/.UsbReceiver: pid=375 uid=10013 gids={1015, 1023, 1024, 2001, 3003, 3007}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.inputmethod.latin.dictionarypack for content provider com.google.android.inputmethod.latin.dictionarypack/.DictionaryProvider: pid=407 uid=10043 gids={3003, 1015}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc android.process.acore for content provider com.android.providers.userdictionary/.UserDictionaryProvider: pid=421 uid=10002 gids={3003, 1015}
06-04 00:20:14.765: I/LockService(854): W/ActivityManager( 142): Unable to start service Intent { act=com.android.internal.telephony.IWapPushManager }: not found
06-04 00:20:14.765: I/LockService(854): W/ActivityManager( 142): Unable to start service Intent { act=com.android.ussd.IExtendedNetworkService }: not found
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.android.settings for broadcast com.android.settings/.widget.SettingsAppWidgetProvider: pid=476 uid=1000 gids={1015, 3002, 3001, 3003, 3007}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.android.contacts for broadcast com.android.contacts/.calllog.CallLogReceiver: pid=505 uid=10002 gids={3003, 1015}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.android.providers.calendar for broadcast com.android.providers.calendar/.CalendarReceiver: pid=545 uid=10007 gids={3003, 1015}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Config changed: {1.0 605mcc1mnc fr_FR layoutdir=0 sw320dp w320dp h508dp nrml long port finger -keyb/v/h -nav/h s.4}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.deskclock for broadcast com.google.android.deskclock/com.android.deskclock.AlarmInitReceiver: pid=562 uid=10012 gids={}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.email for broadcast com.google.android.email/com.android.email.service.EmailBroadcastReceiver: pid=577 uid=10014 gids={3003, 1015}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.exchange for service com.google.android.exchange/com.android.exchange.ExchangeService: pid=596 uid=10025 gids={3003, 1015}
06-04 00:20:14.765: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.apps.genie.geniewidget for broadcast com.google.android.apps.genie.geniewidge
06-04 00:20:15.082: I/LockService(854): w =--------- beginning of /dev/log/system
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Memory class: 48
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Config changed: {1.0 0mcc0mnc fr_FR layoutdir=0 sw320dp w320dp h508dp nrml long port ?uimode ?night finger -keyb/v/h -nav/h s.2}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): System now ready
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.android.systemui for service com.android.systemui/.SystemUIService: pid=210 uid=1000 gids={1015, 3002, 3001, 3003, 3007}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.gsf.login for service com.google.android.gsf.login/com.google.android.gsf.loginservice.GoogleLoginService: pid=238 uid=10018 gids={3003, 1015, 1007, 2001, 3006}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.google.process.gapps for content provider com.google.android.gsf/.gservices.GservicesProvider: pid=262 uid=10018 gids={3003, 1015, 1007, 2001, 3006}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Config changed: {1.0 0mcc0mnc fr_FR layoutdir=0 sw320dp w320dp h508dp nrml long port finger -keyb/v/h -nav/h s.3}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.android.wallpaper for service com.android.wallpaper/.nexus.NexusWallpaper: pid=289 uid=10027 gids={1006}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.google.android.inputmethod.latin for service com.google.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME: pid=301 uid=10024 gids={}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.android.phone for added application com.android.phone: pid=316 uid=1001 gids={3002, 3001, 3003, 1015}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.android.nfc for added application com.android.nfc: pid=331 uid=1027 gids={3002, 3001}
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): START {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10000000 cmp=com.android.launcher/com.android.launcher2.Launcher} from pid 0
06-04 00:20:15.082: I/LockService(854): I/ActivityManager( 142): Start proc com.android.launcher for activity com.android.launcher/com.android.launcher2.Launcher: pid=354 uid=10026 gids={}
Using this code, how can I detect that the user launched an application?
Reading the logs is a horrible idea, and also broken across versions of the system. There is actually a broadcast intent for which you can register here: ACTION_PACKAGE_FIRST_LAUNCH, however, take note that this is only available in API level 12+.
you can detect application launch with tag of ActivityManager in logs.
in log you can find useful data.you can detect run packages.
for example :
06-06 16:09:06.007: I/ActivityManager(1663): Starting: Intent { act=android.intent.action.MAIN flg=0x10840000 cmp=com.android.phone/.InCallScreen } from pid -1
it is com.android.phone package and InCallScreen starts for first page.
you can check packages name and detect when your target application launched.

Internet not working in android emulator on ubuntu 11.04

I have installed Android 2.2 Emulator , In it internet is not working ,
I am behind proxy, so I have entered proxy at:
"Settings" -> "Wireless & Networks" -> "Mobile Networks" -> "Access Point Names" -> "Telkila"
but still no improvements.
is there something i am missing .
This is my logcat:
D/SntpClient( 58): request time failed: java.net.SocketException: Address family not supported by protocol
I/java.net.Socket( 237): www.google.com/74.125.235.19(80): java.net.ConnectException: www.google.com/74.125.235.19:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.20(80): java.net.ConnectException: www.google.com/74.125.235.20:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.16(80): java.net.ConnectException: www.google.com/74.125.235.16:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.17(80): java.net.ConnectException: www.google.com/74.125.235.17:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.19(80): java.net.ConnectException: www.google.com/74.125.235.19:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.20(80): java.net.ConnectException: www.google.com/74.125.235.20:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.16(80): java.net.ConnectException: www.google.com/74.125.235.16:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.17(80): java.net.ConnectException: www.google.com/74.125.235.17:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.19(80): java.net.ConnectException: www.google.com/74.125.235.19:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.20(80): java.net.ConnectException: www.google.com/74.125.235.20:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.16(80): java.net.ConnectException: www.google.com/74.125.235.16:80 - Connection refused
I/java.net.Socket( 237): www.google.com/74.125.235.17(80): java.net.ConnectException: www.google.com/74.125.235.17:80 - Connection refused
E/Tab ( 237): onReceivedError -6 http://www.google.com/m?hl=en&gl=us&source=android-launcher-widget&q=hello The connection to the server was unsuccessful.
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }
W/InputManagerService( 58): Ignoring hideSoftInput of: com.android.internal.view.IInputMethodClient$Stub$Proxy#4505fbd8
W/InputManagerService( 58): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#44ea5260 (uid=10019 pid=237)
D/dalvikvm( 237): GC_EXPLICIT freed 2773 objects / 182192 bytes in 71ms
D/dalvikvm( 120): GC_EXPLICIT freed 106 objects / 4272 bytes in 91ms
D /SntpClient( 58): request time failed: java.net.SocketException: Address family not supported by protocol
I/ActivityManager( 58): Starting activity: Intent { act=android.search.action.GLOBAL_SEARCH flg=0x14200000 pkg=com.android.quicksearchbox cmp=com.android.quicksearchbox/.SearchActivity bnds=[86,92][459,157] (has extras) }
W/InputManagerService( 58): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#44f60640 (uid=10012 pid=182)
D/dalvikvm( 113): GC_EXPLICIT freed 485 objects / 22512 bytes in 70ms
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.WEB_SEARCH flg=0x14000000 cmp=com.android.quicksearchbox/.google.GoogleSearch (has extras) }
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.VIEW dat=http://www.google.com/m?hl=en&gl=us&source=android-launcher-widget&q=hello flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) }
I/browser ( 237): Reusing tab for com.android.quicksearchbox
W/IInputConnectionWrapper( 182): showStatusIcon on inactive InputConnection
D/dalvikvm( 182): GC_EXPLICIT freed 2044 objects / 102120 bytes in 76ms
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }
W/InputManagerService( 58): Ignoring hideSoftInput of: com.android.internal.view.IInputMethodClient$Stub$Proxy#450be550
W/InputManagerService( 58): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#44ea5260 (uid=10019 pid=237)
D/dalvikvm( 237): GC_EXPLICIT freed 795 objects / 52256 bytes in 69ms
D/dalvikvm( 120): GC_EXPLICIT freed 33 objects / 1744 bytes in 78ms
D/SntpClient( 58): request time failed: java.net.SocketException: Address family not supported by protocol
I/ActivityManager( 58): Starting activity: Intent { act=android.search.action.GLOBAL_SEARCH flg=0x14200000 pkg=com.android.quicksearchbox cmp=com.android.quicksearchbox/.SearchActivity bnds=[86,92][459,157] (has extras) }
W/InputManagerService( 58): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#44f60640 (uid=10012 pid=182)
D/dalvikvm( 108): GC_EXTERNAL_ALLOC freed 563 objects / 30304 bytes in 68ms
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.WEB_SEARCH flg=0x14000000 cmp=com.android.quicksearchbox/.google.GoogleSearch (has extras) }
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.VIEW dat=http://www.google.com/m?hl=en&gl=us&source=android-launcher-widget&q=hello flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) }
I/browser ( 237): Reusing tab for com.android.quicksearchbox
W/IInputConnectionWrapper( 182): showStatusIcon on inactive InputConnection
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.android.launcher/com.android.launcher2.Launcher }
W/InputManagerService( 58): Ignoring hideSoftInput of: com.android.internal.view.IInputMethodClient$Stub$Proxy#45102f38
W/InputManagerService( 58): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#44ea5260 (uid=10019 pid=237)
I/ActivityManager( 58): Starting activity: Intent { act=android.search.action.GLOBAL_SEARCH flg=0x14200000 pkg=com.android.quicksearchbox cmp=com.android.quicksearchbox/.SearchActivity bnds=[86,92][459,157] (has extras) }
W/InputManagerService( 58): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#44f60640 (uid=10012 pid=182)
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.WEB_SEARCH flg=0x14000000 cmp=com.android.quicksearchbox/.google.GoogleSearch (has extras) }
I/ActivityManager( 58): Starting activity: Intent { act=android.intent.action.VIEW dat=http://www.google.com/m?hl=en&gl=us&source=android-launcher-widget&q=hello flg=0x10000000 cmp=com.android.browser/.BrowserActivity (has extras) }
I/browser ( 237): Reusing tab for com.android.quicksearchbox
W/IInputConnectionWrapper( 182): showStatusIcon on inactive InputConnection
D/dalvikvm( 113): GC_EXPLICIT freed 535 objects / 25976 bytes in 48ms
D/dalvikvm( 182): GC_EXPLICIT freed 4012 objects / 207464 bytes in 81ms
you do not need to set up specific networking.
The emulator makes use of NAT, therefore internet should work "out of the box" from the emulator.
I suggest you remove your entry's and see what the results are.
In fact, i tried to "enable Wifi"on my emulators, but that gives an error, wich is quite logical... An emulator cannot emulate a wireless device....

Application works in Android 1.5 but not 2.2

The spinning globe application unning on the emulator works on android 1.5 as target but puts out a "force close application" error in android 2.2 target. Where should i look to find the problem ?
I have enclosed the logcat details that I get,
D/MediaScanner( 183): prescan time: 4913ms
D/MediaScanner( 183): scan time: 693ms
D/MediaScanner( 183): postscan time: 45ms
D/MediaScanner( 183): total time: 5651ms
D/MediaScannerService( 183): done scanning volume internal
I/PackageManager( 67): Removing non-system package:com.android.SpinningGlobe
I/ActivityManager( 67): Force stopping package com.android.SpinningGlobe uid=10038
D/dalvikvm( 127): GC_EXPLICIT freed 12963 objects / 655936 bytes in 168ms
D/PackageManager( 67): Scanning package com.android.SpinningGlobe
I/PackageManager( 67): Package com.android.SpinningGlobe codePath changed from /data/app/com.android.SpinningGlobe-2.apk to /data/app/com.android.SpinningGlobe-1.apk; Retaining data and using new
I/PackageManager( 67): /data/app/com.android.SpinningGlobe-1.apk changed; unpacking
D/installd( 34): DexInv: --- BEGIN '/data/app/com.android.SpinningGlobe-1.apk' ---
D/dalvikvm( 255): DexOpt: load 214ms, verify 229ms, opt 5ms
D/installd( 34): DexInv: --- END '/data/app/com.android.SpinningGlobe-1.apk' success)---
W/PackageManager( 67): Code path for pkg : com.android.SpinningGlobe changing from /data/app/com.android.SpinningGlobe-2.apk to /data/app/com.android.SpinningGlobe-1.apk
W/PackageManager( 67): Resource path for pkg : com.android.SpinningGlobe changing from /data/app/com.android.SpinningGlobe-2.apk to /data/app/com.android.SpinningGlobe-1.apk
I/ActivityManager( 67): Force stopping package com.android.SpinningGlobe uid=10038
D/PackageManager( 67): Activities: com.android.SpinningGlobe.GLApp
I/installd( 34): move /data/dalvik-cache/data#app#com.android.SpinningGlobe-1.apk#classes.dex -> /data/dalvik-cache/data#app#com.android.SpinningGlobe-1.apk#classes.dex
D/PackageManager( 67): New package installed in /data/app/com.android.SpinningGlobe-1.apk
I/ActivityManager( 67): Force stopping package com.android.SpinningGlobe uid=10038
I/ActivityManager( 67): Start proc com.svox.pico for broadcast com.svox.pico/.VoiceDataInstallerReceiver: pid=256 uid=10028 gids={}
D/dalvikvm( 167): GC_EXPLICIT freed 3943 objects / 244424 bytes in 1708ms
D/dalvikvm( 67): GC_EXPLICIT freed 7297 objects / 468432 bytes in 667ms
W/RecognitionManagerService( 67): no available voice recognition services found
I/ActivityThread( 256): Publishing provider com.svox.pico.providers.SettingsProvider: com.svox.pico.providers.SettingsProvider
I/installd( 34): unlink /data/dalvik-cache/data#app#com.android.SpinningGlobe-2.apk#classes.dex
D/AndroidRuntime( 118): Shutting down VM
D/jdwp ( 118): adbd disconnected
I/AndroidRuntime( 118): NOTE: attach of thread 'Binder Thread #3' failed
D/AndroidRuntime( 266):
D/AndroidRuntime( 266): >>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
D/AndroidRuntime( 266): CheckJNI is ON
D/AndroidRuntime( 266): --- registering native functions ---
I/ActivityManager( 67): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.android.SpinningGlobe/.GLApp }
D/AndroidRuntime( 266): Shutting down VM
D/jdwp ( 266): adbd disconnected
I/AndroidRuntime( 266): NOTE: attach of thread 'Binder Thread #3' failed
I/ActivityManager( 67): Start proc com.android.SpinningGlobe for activity com.android.SpinningGlobe/.GLApp: pid=273 uid=10038 gids={1015}
I/ARMAssembler( 67): generated scanline__00000077:03545404_00000004_00000000 [ 47 ipp] (67 ins) at [0x32b4a0:0x32b5ac] in 3627836 ns
D/libEGL ( 273): egl.cfg not found, using default config
D/libEGL ( 273): loaded /system/lib/egl/libGLES_android.so
D/dalvikvm( 273): GC_EXTERNAL_ALLOC freed 839 objects / 59328 bytes in 151ms
W/dalvikvm( 273): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
I/ActivityManager( 67): Displayed activity com.android.SpinningGlobe/.GLApp: 4870 ms (total 4870 ms)
E/AndroidRuntime( 273): FATAL EXCEPTION: GLThread 8
E/AndroidRuntime( 273): java.lang.IndexOutOfBoundsException
E/AndroidRuntime( 273): at java.nio.IntArrayBuffer.get(IntArrayBuffer.java:63)
E/AndroidRuntime( 273): at com.android.SpinningGlobe.GLRenderer.onDrawFrame(GLRenderer.java:105)
E/AndroidRuntime( 273): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1332)
E/AndroidRuntime( 273): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1116)
W/ActivityManager( 67): Force finishing activity com.android.SpinningGlobe/.GLApp
I/ARMAssembler( 67): generated scanline__00000077:03515104_00000000_00000000 [ 33 ipp] (47 ins) at [0x33f9a8:0x33fa64] in 1258819 ns
Any insights on where the problem could be ?
You should look at the log from the emulator.
You can get this on the command line using:
adb logcat
Or if you're using the ADT Plugin for Eclipse the log is visible there. If you can't see it select Window ▶ Show View ▶ Other... and then select Android ▶ LogCat.
It's probably also worth reading the Debugging page in the Android Developer Documentation.
Recompile it under 2.2 and look for deprecated warnings

Categories

Resources