First, I use a System.Out.print to output something but I don't see that in the console or logcat, where does it display?
Then when hit the button, it takes long time to respond. I log the files from logcat and have No idea what the OS is doing behind which took so long.
02-16 13:01:07.859: WARN/WindowManager(51): Key dispatching timed out sending to com.test.finalapp/com.test.finalapp.tab.FeaturedActivity
02-16 13:01:08.101: WARN/WindowManager(51): Dispatch state: {{KeyEvent{action=1 code=4 repeat=0 meta=0 scancode=158 mFlags=8} to Window{44dcd868 com.test.finalapp/com.test.finalapp.MyAccount1_1Activity paused=false} # 1329425383564
lw=Window{44dcd868 com.test.finalapp/com.test.finalapp.MyAccount1_1Activity paused=false} lb=android.os.BinderProxy#44e756f0 fin=false gfw=true ed=true tts=0 wf=false fp=false mcf=Window{44e2b0a0 com.test.finalapp/com.test.finalapp.games.slotMachine paused=false}}}
02-16 13:01:08.119: WARN/WindowManager(51): Current state: {{null to Window{44e2c788 com.test.finalapp/com.test.finalapp.tab.FeaturedActivity paused=false} # 1329426068120 lw=Window{44e2c788 com.test.finalapp/com.test.finalapp.tab.FeaturedActivity paused=false} lb=android.os.BinderProxy#44e2c5a0 fin=true gfw=true ed=true tts=0 wf=false fp=false mcf=Window{44e2b0a0 com.test.finalapp/com.test.finalapp.games.slotMachine paused=false}}}
02-16 13:01:08.240: INFO/ActivityManager(51): ANR in process: com.test.finalapp (last in com.test.finalapp)
02-16 13:01:08.240: INFO/ActivityManager(51): Annotation: keyDispatchingTimedOut
02-16 13:01:08.240: INFO/ActivityManager(51): CPU usage:
02-16 13:01:08.240: INFO/ActivityManager(51): Load: 0.37 / 0.37 / 0.38
02-16 13:01:08.240: INFO/ActivityManager(51): CPU usage from 8216ms to 81ms ago:
02-16 13:01:08.240: INFO/ActivityManager(51): system_server: 4% = 3% user + 1% kernel / faults: 4 minor
02-16 13:01:08.240: INFO/ActivityManager(51): obango.finalapp: 0% = 0% user + 0% kernel
02-16 13:01:08.240: INFO/ActivityManager(51): qemud: 0% = 0% user + 0% kernel
02-16 13:01:08.240: INFO/ActivityManager(51): logcat: 0% = 0% user + 0% kernel
02-16 13:01:08.240: INFO/ActivityManager(51): events/0: 0% = 0% user + 0% kernel
02-16 13:01:08.240: INFO/ActivityManager(51): TOTAL: 5% = 4% user + 1% kernel
02-16 13:01:08.251: INFO/ActivityManager(51): Removing old ANR trace file from /data/anr/traces.txt
02-16 13:01:09.081: INFO/Process(51): Sending signal. PID: 239 SIG: 3
02-16 13:01:09.239: INFO/dalvikvm(239): threadid=7: reacting to signal 3
02-16 13:01:09.458: INFO/Process(51): Sending signal. PID: 51 SIG: 3
02-16 13:01:09.486: INFO/dalvikvm(51): threadid=7: reacting to signal 3
02-16 13:01:10.457: INFO/dalvikvm(239): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:12.037: INFO/dalvikvm(51): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:12.055: INFO/Process(51): Sending signal. PID: 223 SIG: 3
02-16 13:01:12.269: INFO/dalvikvm(223): threadid=7: reacting to signal 3
02-16 13:01:12.358: INFO/Process(51): Sending signal. PID: 213 SIG: 3
02-16 13:01:12.375: INFO/dalvikvm(213): threadid=7: reacting to signal 3
02-16 13:01:12.608: INFO/Process(51): Sending signal. PID: 154 SIG: 3
02-16 13:01:12.885: INFO/Process(51): Sending signal. PID: 146 SIG: 3
02-16 13:01:12.905: INFO/dalvikvm(213): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:13.113: INFO/Process(51): Sending signal. PID: 189 SIG: 3
02-16 13:01:13.348: INFO/Process(51): Sending signal. PID: 181 SIG: 3
02-16 13:01:13.602: INFO/Process(51): Sending signal. PID: 170 SIG: 3
02-16 13:01:13.816: INFO/dalvikvm(146): threadid=7: reacting to signal 3
02-16 13:01:13.976: INFO/dalvikvm(189): threadid=7: reacting to signal 3
02-16 13:01:14.084: INFO/Process(51): Sending signal. PID: 103 SIG: 3
02-16 13:01:14.144: INFO/dalvikvm(103): threadid=7: reacting to signal 3
02-16 13:01:14.342: INFO/Process(51): Sending signal. PID: 106 SIG: 3
02-16 13:01:16.950: INFO/dalvikvm(170): threadid=7: reacting to signal 3
02-16 13:01:18.814: INFO/dalvikvm(181): threadid=7: reacting to signal 3
02-16 13:01:23.204: WARN/MediaPlayer(239): info/warning (1, 44)
02-16 13:01:23.578: DEBUG/AudioSink(30): bufferCount (4) is too small and increased to 12
02-16 13:01:24.137: WARN/AudioFlinger(30): write blocked for 76 msecs, 2 delayed writes, thread 0xb388
02-16 13:01:24.385: DEBUG/dalvikvm(239): GC freed 4564 objects / 281416 bytes in 77ms
02-16 13:01:24.914: INFO/MediaPlayer(239): Info (1,44)
02-16 13:01:25.537: INFO/dalvikvm(106): threadid=7: reacting to signal 3
02-16 13:01:26.370: INFO/dalvikvm(103): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:26.435: INFO/dalvikvm(223): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:27.350: INFO/dalvikvm(170): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:27.611: INFO/dalvikvm(181): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:28.074: INFO/ActivityManager(51): Starting activity: Intent { cmp=com.test.finalapp/.Leaderboard1 (has extras) }
02-16 13:01:28.934: INFO/ActivityManager(51): Displayed activity com.test.finalapp/.Leaderboard1: 754 ms (total 754 ms)
02-16 13:01:29.889: INFO/dalvikvm(189): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:30.152: INFO/dalvikvm(146): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:30.375: INFO/dalvikvm(154): Wrote stack trace to '/data/anr/traces.txt'
02-16 13:01:31.183: INFO/dalvikvm(106): Wrote stack trace to '/data/anr/traces.txt'
You should give us the code that is executed and, if you just call a method, give us the code of the method, too. Yous system.out will be printed in the logcat, just check for the tag System.
Even without your code, I can start a educated guess: Your button probably trigger a long taking operation and blocks the UI thread as the touchlistener runs on the UI Thread.
You should also consider moving it into an AsyncTask that is meant to be used for long term operations like internet access or calculations. You can update your UI easily from the AsyncTask, too.
Related
I have made game in cocos2dx for ios device. Now I want to port it for android but, the code which works fine for ios is crashing for android. The eclipse shows 3 types of logCat outputs which are as follows.
///////////////////////////////////////////////////////////////////////////////////////////////////////
1) 11-27 10:41:05.168: W/SharedBufferStack(4417): waitForCondition(LockCondition) timed out (identity=302, status=0). CPU may be pegged. trying again.
///////////////////////////////////////////////////////////////////////////////////////////////////////
2) 11-27 10:41:36.448: D/lights(248): set_light_backlight: brightness=255
11-27 10:41:41.518: I/InputDispatcher(248): Application is not responding: Window{2b452080 org.cocos2dx.Saburbia_android/org.cocos2dx.Saburbia_android.Saburbia_android paused=false}. 5000.4ms since event, 5000.4ms since wait started
11-27 10:41:41.518: I/WindowManager(248): Input event dispatching timed out sending to org.cocos2dx.Saburbia_android/org.cocos2dx.Saburbia_android.Saburbia_android
11-27 10:41:41.528: I/Process(248): Sending signal. PID: 4417 SIG: 3
11-27 10:41:41.528: I/dalvikvm(4417): threadid=4: reacting to signal 3
11-27 10:41:41.728: I/Process(248): Sending signal. PID: 248 SIG: 3
11-27 10:41:41.728: I/dalvikvm(248): threadid=4: reacting to signal 3
11-27 10:41:41.748: I/dalvikvm(248): Wrote stack traces to '/data/anr/traces.txt'
11-27 10:41:41.748: I/Process(248): Sending signal. PID: 355 SIG: 3
11-27 10:41:41.748: I/dalvikvm(355): threadid=4: reacting to signal 3
11-27 10:41:41.758: I/dalvikvm(355): Wrote stack traces to '/data/anr/traces.txt'
11-27 10:41:41.758: I/Process(248): Sending signal. PID: 320 SIG: 3
11-27 10:41:41.758: I/dalvikvm(320): threadid=4: reacting to signal 3
11-27 10:41:41.758: I/dalvikvm(320): Wrote stack traces to '/data/anr/traces.txt'
11-27 10:41:41.968: D/dalvikvm(248): GC_EXPLICIT freed 952K, 49% free 6943K/13447K, external 3286K/4888K, paused 78ms
11-27 10:41:42.518: E/ActivityManager(248): ANR in org.cocos2dx.Saburbia_android (org.cocos2dx.Saburbia_android/.Saburbia_android)
11-27 10:41:42.518: E/ActivityManager(248): Reason: keyDispatchingTimedOut
11-27 10:41:42.518: E/ActivityManager(248): Load: 7.93 / 7.92 / 7.79
11-27 10:41:42.518: E/ActivityManager(248): CPU usage from 27270ms to 0ms ago:
11-27 10:41:42.518: E/ActivityManager(248): 99% 4417/org.cocos2dx.Saburbia_android: 99% user + 0% kernel / faults: 2 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3877/com.google.android.apps.maps: 0% user + 0% kernel / faults: 418 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3957/com.svox.pico: 0% user + 0% kernel / faults: 678 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 248/system_server: 0% user + 0% kernel / faults: 8 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 1679/com.sonyericsson.customization: 0% user + 0% kernel / faults: 283 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3647/com.sonyericsson.devicemonitor: 0% user + 0% kernel / faults: 179 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 121/rild: 0% user + 0% kernel / faults: 1 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 320/com.android.systemui: 0% user + 0% kernel / faults: 3 minor
11-27 10:41:42.518: E/ActivityManager(248): 0% 3731/com.sonyericsson.android.datamonitor: 0% user + 0% kernel / faults: 25 minor
11-27 10:41:42.518: E/ActivityManager(248): 100% TOTAL: 100% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): CPU usage from 461ms to 976ms later:
11-27 10:41:42.518: E/ActivityManager(248): 98% 4417/org.cocos2dx.Saburbia_android: 98% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): 96% 4418/HeapWorker: 96% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): 3.8% 248/system_server: 1.9% user + 1.9% kernel
11-27 10:41:42.518: E/ActivityManager(248): 1.9% 291/InputDispatcher: 0% user + 1.9% kernel
11-27 10:41:42.518: E/ActivityManager(248): 1.9% 442/er$SensorThread: 1.9% user + 0% kernel
11-27 10:41:42.518: E/ActivityManager(248): 100% TOTAL: 98% user + 1.9% kernel
11-27 10:41:42.518: I/InputDispatcher(248): Dropping event because the pointer is not down.
////////////////////////////////////////////////////////////////////////////////////////////////
3) and third reason is unknows as it shows meny memory address in logCat.
////////////////////////////////////////////////////////////////////////////////////////////////
I am using libcurl for web calls and pThread for threading. This game also have Facebook Integration which is done using Facebook API for mobile (Hackbook).
After facebook login, the native code connects to the server using libcurl and makes about 30 http calls using pThread so that rendering thread should not be paused for getting the response from server. Still while this loading is going on the logcat shows any of these 3 logs and restarts loading from the start. There are http request present in game also which are executed using pThreads but in game also it shows any of this 3 log and crashes randomely.
The same code works fine for the ios build. I am not able to find why its not running properly for Android. Please suggest if any rules have to be followed for android porting.
I am using versions as follows.
Android NDK : r8b
Cocos2dx : 2.0.3
Eclipse : 3.6.2
Android version : 2.2
System : Ubuntu 10.0.4
Devices : SonyEricsson NeoV (android2.3.4), Samsung Galaxy SII (android4.0.3).
Thanks in advance..
Try to find memory issue in iPhone,because auto-release code might not working correctly.
Also use the NDK stack for more detail error.
Update:Another way to track ndk stack on remote use the https://www.crittercism.com
Thank you.
I've been trying to figure this out for days, to no avail. I'm developing a simple android app with Titanium that works perfectly fine on iOS. Yet, when I launch it on android, it never starts. Here is my manifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.tiki.signals" android:versionCode="1"
android:versionName="1">
<uses-sdk android:minSdkVersion="8" />
<!-- TI_MANIFEST -->
<application android:icon="#drawable/appicon"
android:label="Signals" android:name="SignalsApplication"
android:debuggable="false">
<!-- TI_APPLICATION -->
<activity android:name=".SignalsActivity"
android:label="Signals" android:theme="#style/Theme.Titanium"
android:configChanges="keyboardHidden|orientation">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="ti.modules.titanium.facebook.FBActivity"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
/>
<activity android:name="org.appcelerator.titanium.TiActivity"
android:configChanges="keyboardHidden|orientation" />
<activity android:name="org.appcelerator.titanium.TiTranslucentActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="#android:style/Theme.Translucent" />
<activity android:name="org.appcelerator.titanium.TiModalActivity"
android:configChanges="keyboardHidden|orientation"
android:theme="#android:style/Theme.Translucent" />
<activity android:name="ti.modules.titanium.ui.TiTabActivity"
android:configChanges="keyboardHidden|orientation" />
<activity android:name="ti.modules.titanium.ui.android.TiPreferencesActivity" />
<service android:name="org.appcelerator.titanium.analytics.TiAnalyticsService"
android:exported="false" />
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
</manifest>
Here's the logcat:
I/ActivityManager( 81): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.tiki.signals/.SignalsActivity} from pid 176
D/PermissionCache( 35): checking android.permission.READ_FRAME_BUFFER for uid=1000 => granted (1163 us)
D/dalvikvm( 81): GC_FOR_ALLOC freed 842K, 14% free 11108K/12807K, paused 106ms
I/dalvikvm-heap( 81): Grow heap (frag case) to 12.385MB for 1536016-byte allocation
D/dalvikvm( 81): GC_FOR_ALLOC freed 1K, 13% free 12606K/14343K, paused 105ms
W/WindowManager( 81): Failure taking screenshot for (180x300) to layer 21005
I/ActivityManager( 81): Start proc com.tiki.signals for activity com.tiki.signals/.SignalsActivity: pid=457 uid=10040 gids={1015, 3003}
I/dalvikvm( 457): Turning on JNI app bug workarounds for target SDK version 8...
W/NetworkManagementSocketTagger( 81): setKernelCountSet(10040, 1) failed with errno -2
D/dalvikvm( 81): GC_CONCURRENT freed 13K, 13% free 12619K/14343K, paused 8ms+32ms
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/TiApplication( 457): (main) [0,0] checkpoint, app created.
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
D/dalvikvm( 457): GC_CONCURRENT freed 243K, 4% free 9294K/9607K, paused 7ms+6ms
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/TiApplication( 457): (main) [682,682] Titanium 1.8.2 (2012/02/23 17:46 59b3a90)
D/dalvikvm( 457): GC_CONCURRENT freed 422K, 5% free 9434K/9927K, paused 6ms+4ms
I/TiApplication( 457): (main) [254,936] Titanium Javascript runtime: v8
D/dalvikvm( 457): Trying to load lib /data/data/com.tiki.signals/lib/libstlport_shared.so 0x412a1e60
D/dalvikvm( 457): Added shared lib /data/data/com.tiki.signals/lib/libstlport_shared.so 0x412a1e60
D/dalvikvm( 457): No JNI_OnLoad found in /data/data/com.tiki.signals/lib/libstlport_shared.so 0x412a1e60, skipping init
D/dalvikvm( 457): Trying to load lib /data/data/com.tiki.signals/lib/libkroll-v8.so 0x412a1e60
I/TiRootActivity( 457): (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
D/dalvikvm( 457): Added shared lib /data/data/com.tiki.signals/lib/libkroll-v8.so 0x412a1e60
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
E/TiApplication( 457): (KrollRuntimeThread) [3551,3551] APP PROXY: ti.modules.titanium.app.AppModule#41334e08
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
D/dalvikvm( 457): GC_CONCURRENT freed 349K, 5% free 9566K/10055K, paused 7ms+6ms
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
D/dalvikvm( 457): GC_FOR_ALLOC freed 452K, 7% free 9534K/10183K, paused 84ms
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
D/TiLocation( 457): (main) [2290,5841] preferredProvider property found [null]
D/TiLocation( 457): (main) [1,5842] accuracy property found [0]
E/TiLocationHelper( 457): (main) [31,5873] unable to register, provider is null
D/dalvikvm( 457): GC_FOR_ALLOC freed 105K, 7% free 9571K/10183K, paused 61ms
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
I/dalvikvm-heap( 457): Grow heap (frag case) to 10.878MB for 1536016-byte allocation
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
D/dalvikvm( 457): GC_CONCURRENT freed 1K, 6% free 11070K/11719K, paused 8ms+5ms
I/TiRootActivity( 457): (main) [0,0] checkpoint, on root activity resume. activity = com.tiki.signals.SignalsActivity#412aba88
V/PhoneStatusBar( 134): setLightsOn(true)
I/Process ( 81): Sending signal. PID: 457 SIG: 3
I/dalvikvm( 457): threadid=3: reacting to signal 3
W/InputManagerService( 81): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy#41434cb8 (uid=10013 pid=176)
I/dalvikvm( 457): Wrote stack traces to '/data/anr/traces.txt'
D/gralloc_goldfish( 457): Emulator without GPU emulation detected.
I/ActivityManager( 81): Displayed com.tiki.signals/.SignalsActivity: +9s553ms
W/NetworkManagementSocketTagger( 81): setKernelCountSet(10013, 0) failed with errno -2
D/ExchangeService( 355): Received deviceId from Email app: androidc259148960
D/ExchangeService( 355): Reconciling accounts...
D/dalvikvm( 81): GC_EXPLICIT freed 1712K, 23% free 11125K/14343K, paused 7ms+11ms
W/ThrottleService( 81): unable to find stats for iface rmnet0
W/TiAnalyticsSvc( 457): (Thread-65) [23787,23787] Analytics Service Started
I/TiAnalyticsSvc( 457): (Thread-65) [152,23939] Sending 2 analytics events.
W/TiAnalyticsSvc( 457): (Thread-65) [1072,25011] Stopping Analytics Service
Here's my tiapp.xml:
<?xml version="1.0" encoding="UTF-8"?>
<ti:app xmlns:ti="http://ti.appcelerator.org">
<property name="ti.android.runtime">v8</property>
<property name="ti.android.threadstacksize" type="int">132768</property>
<property name="ti.android.fastdev" type="bool">false</property>
<sdk-version>1.8.2</sdk-version>
<deployment-targets>
<target device="mobileweb">false</target>
<target device="iphone">true</target>
<target device="ipad">true</target>
<target device="android">true</target>
<target device="blackberry">false</target>
</deployment-targets>
<id>com.tiki.signals</id>
<name>Signals</name>
<version>1.0</version>
<publisher>Michael</publisher>
<url>http://</url>
<description>not specified</description>
<copyright>2012 by meilers</copyright>
<icon>appicon.png</icon>
<persistent-wifi>false</persistent-wifi>
<prerendered-icon>false</prerendered-icon>
<statusbar-style>default</statusbar-style>
<statusbar-hidden>false</statusbar-hidden>
<fullscreen>false</fullscreen>
<navbar-hidden>false</navbar-hidden>
<analytics>true</analytics>
<guid>49aefe11-b922-4f04-bffd-887ed59cb5d3</guid>
<iphone>
<orientations device="iphone">
<orientation>Ti.UI.PORTRAIT</orientation>
</orientations>
<orientations device="ipad">
<orientation>Ti.UI.PORTRAIT</orientation>
<orientation>Ti.UI.UPSIDE_PORTRAIT</orientation>
<orientation>Ti.UI.LANDSCAPE_LEFT</orientation>
<orientation>Ti.UI.LANDSCAPE_RIGHT</orientation>
</orientations>
</iphone>
<android xmlns:android="http://schemas.android.com/apk/res/android"/>
<modules/>
</ti:app>
What is happening here? I don't see any error in logcat. The VM is just shutting down, with no reason. Please help!
One item comes to mind just looking at the logcat... Not enough memory. You'll see memory free dip to 3% YIKES!. Usually try to keep 10% free or OS may go into a paging fit and possible time out some features.
Disable some features in the app and watch the memory under the emulator.
Best recommendation install the app onto actual phone, though the emulator is supposed to give close tor real world results. Which I dont count on emulating any hardware device well.
Here's some code to dump memory usage. You need to find out what your target class is.
Older phones have as little as 16MB newer ones 48MB before the OS starts picking on your app. Put code in Oncreate.
Runtime rt = Runtime.getRuntime();
long maxMemory = rt.maxMemory();
Log.v("onCreate", "maxMemory:>>>>>" + Long.toString(maxMemory)); //max available memory to use
ActivityManager am = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
int memoryClass = am.getMemoryClass();
Log.v("onCreate", "memoryClass:>>>>" + Integer.toString(memoryClass)); //max available you should use to keep from getting bumped off
printl("PGM MEM FREE MB", GetInternalMemAvail());
printl("INTERNAL STORAGE FREE MEMORY BYTES",getmem());
printl("INTERNAL TOTAL MEMORY BYTES",TotalMemory());
printl("SD MEM FREE MB",GetSDMemAvail());
printl("SD MEM GB",getAvailableSpaceInGB());
private static void printl(String printstring,long x)
{
String temp;
temp=String.format(" %d",x);
Log.e(printstring,temp);
}
I am using the built in camera app in android using intents like this:
final Button Capture=(Button)findViewById(sankalp.jain.sky.R.id.capture);
Capture.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
Uri fileUri;
final Intent intent=new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
Log.w("intent","for camera");//displayed
fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); // create a file to save the image
Log.w("getoutput","getit");//displayed
intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); // set the image file name
Log.w("hello","hello the 2nd step");//displayed
startActivityForResult(intent,CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE);
}
I have implemented the relevant getOutputMediafile() method and the image gets saved in /mnt/sdcard/Pictures/Samarth/chart.png
The sdcard is 40MB and there are only 2 files presently totaling some 100KB.
The problem is that the camera works perfectly for some random number of snaps and then randomly hangs and then gives an ANR.
Its totally random,restarting the emulator doesnt work and sometimes it does.
Here is the logcat output
LOGCAT:
I/ActivityManager( 70): Displayed sankalp.jain.sky/.Tabinit: +1s364ms
W/intent ( 596): for camera
D/path ( 596): /mnt/sdcard/Pictures/Samarth
W/getoutput( 596): getit
W/hello ( 596): hello the 2nd step
I/ActivityManager( 70): Starting: Intent { act=android.media.action.IMAGE_CAPT
URE cmp=com.android.camera/.Camera (has extras) } from pid 596
D/PhoneWindow( 596): couldn't save which view has focus because the focused vie
w com.android.internal.policy.impl.PhoneWindow$DecorView#4056d7e0 has no id.
I/WindowManager( 70): Setting rotation to 1, animFlags=1
I/ActivityManager( 70): Config changed: { scale=1.0 imsi=310/260 loc=en_US tou
ch=3 keys=2/1/2 nav=3/1 orien=2 layout=34 uiMode=17 seq=13}
V/CameraHolder( 411): open camera 0
D/CameraHardwareStub( 34): initHeapLocked: preview size=320x240
I/StagefrightPlayer( 34): setDataSource('/system/media/audio/ui/camera_click.o
gg')
I/StagefrightPlayer( 34): setDataSource('/system/media/audio/ui/VideoRecord.og
g')
D/Camera ( 411): app passed NULL surface
D/CameraHardwareStub( 34): initHeapLocked: preview size=320x240
V/camera ( 411): startPreview
I/ActivityManager( 70): Displayed com.android.camera/.Camera: +1s198ms
W/OrientationEventListener( 411): Cannot detect sensors. Not enabled
E/SurfaceFlinger( 70): texture=10, using format 17, which is not supported by
the GL
V/GLRootView( 411): onSurfaceChanged: 627x470, gl10: com.google.android.gles_jn
i.GLImpl#40511140
V/GLRootView( 411): layout content pane 627x470
W/IInputConnectionWrapper( 596): showStatusIcon on inactive InputConnection
D/dalvikvm( 70): GC_EXPLICIT freed 130K, 47% free 4929K/9159K, external 3511K/
4385K, paused 795ms
V/camera ( 411): Start autofocus.
D/dalvikvm( 411): GC_EXTERNAL_ALLOC freed 34K, 51% free 2932K/5895K, external 2
480K/2565K, paused 697ms
V/camera ( 411): mAutoFocusTime = 1622ms
V/camera ( 411): doSnap: mFocusState=3
D/CameraHardwareStub( 34): initHeapLocked: preview size=320x240
D/dalvikvm( 596): GC_EXPLICIT freed 209K, 49% free 2870K/5575K, external 3065K/
3507K, paused 650ms
D/SntpClient( 70): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
I/InputDispatcher( 70): Application is not responding: Window{40751af8 com.and
roid.camera/com.android.camera.Camera paused=false}. 5014.6ms since event, 5014
.0ms since wait started
I/WindowManager( 70): Input event dispatching timed out sending to com.android
.camera/com.android.camera.Camera
I/Process ( 70): Sending signal. PID: 411 SIG: 3
I/dalvikvm( 411): threadid=4: reacting to signal 3
I/dalvikvm( 411): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 70): Sending signal. PID: 70 SIG: 3
I/dalvikvm( 70): threadid=4: reacting to signal 3
I/dalvikvm( 70): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 70): Sending signal. PID: 340 SIG: 3
I/dalvikvm( 340): threadid=4: reacting to signal 3
I/dalvikvm( 340): Wrote stack traces to '/data/anr/traces.txt'
I/Process ( 70): Sending signal. PID: 115 SIG: 3
I/dalvikvm( 115): threadid=4: reacting to signal 3
I/dalvikvm( 115): Wrote stack traces to '/data/anr/traces.txt'
D/dalvikvm( 70): GC_EXPLICIT freed 354K, 45% free 5052K/9159K, external 3511K/
4385K, paused 157ms
E/ActivityManager( 70): ANR in com.android.camera (com.android.camera/.Camera)
E/ActivityManager( 70): Reason: keyDispatchingTimedOut
E/ActivityManager( 70): Load: 0.12 / 0.23 / 0.25
E/ActivityManager( 70): CPU usage from 42677ms to 0ms ago:
E/ActivityManager( 70): 0.3% 70/system_server: 0.1% user + 0.1% kernel / fau
lts: 5 minor
E/ActivityManager( 70): 0.3% 115/com.android.systemui: 0.2% user + 0% kernel
/ faults: 4 minor
E/ActivityManager( 70): 0.1% 340/com.android.phone: 0% user + 0% kernel / fa
ults: 4 minor
E/ActivityManager( 70): 0% 34/mediaserver: 0% user + 0% kernel
E/ActivityManager( 70): 0% 32/rild: 0% user + 0% kernel
E/ActivityManager( 70): 0% 41/adbd: 0% user + 0% kernel
E/ActivityManager( 70): 1.1% TOTAL: 0.7% user + 0.4% kernel
E/ActivityManager( 70): CPU usage from 1031ms to 1675ms later:
E/ActivityManager( 70): 10% 70/system_server: 6.2% user + 4.6% kernel
E/ActivityManager( 70): 10% 100/InputDispatcher: 7.8% user + 3.1% kernel
E/ActivityManager( 70): 34% TOTAL: 17% user + 17% kernel
I/InputDispatcher( 70): Dropping event because the pointer is not down.
D/dalvikvm( 115): GC_CONCURRENT freed 365K, 49% free 2977K/5831K, external 2169
K/2674K, paused 9ms+6ms
D/SntpClient( 70): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
W/ProcessStats( 70): Skipping unknown process pid 734
W/ProcessStats( 70): Skipping unknown process pid 735
V/BackupManagerService( 70): Backup requested but nothing pending
D/SntpClient( 70): request time failed: java.net.SocketException: Address fami
ly not supported by protocol
I/EventLogService( 266): Aggregate from 1332336498594 (log), 1332336498594 (dat
a)
D/dalvikvm( 266): GC_EXPLICIT freed 61K, 55% free 3085K/6727K, external 1625K/2
137K, paused 296ms
I could never figure out the reason myself but due to some problems when I decided to upgrade the emulator to Google API15(from API10) the camera doesn't hang anymore.
Upgrading also rectified some weird problems like
Force portrait mode in camera
Hope that helps someone.
I'm developping a simple widget which update by downloading a big image file.
To do so I'm just launching a service which retrieve the image. I launch it from the onUpdate method of AppWidgetProvider.
Like that :
public void onUpdate(Context context, AppWidgetManager appWidgetManager,
int[] appWidgetIds)
{
Intent intent = new Intent(context, UpdateService.class);
context.startService(intent);
}
In wifi everything is working well.
But in 3G network is slow, the downloading take too much time. As a result my service is killed by android system.
Here the trace:
03-04 15:19:02.698: INFO/ActivityManager(166): Start proc com.testpic for broadcast
com.testpic/com.testpic.TestPicActivity: pid=1994 uid=10087 gids={1015, 3003}
03-04 15:19:22.889: WARN/ActivityManager(166): Timeout executing service:
ServiceRecord{41851230 com.testpic/com.testpic.service.UpdateService}
03-04 15:19:22.944: INFO/dalvikvm(166): Jit: resizing JitTable from 8192 to 16384
03-04 15:19:22.967: INFO/Process(166): Sending signal. PID: 1994 SIG: 3
03-04 15:19:22.967: INFO/dalvikvm(1994): threadid=3: reacting to signal 3
03-04 15:19:22.994: INFO/dalvikvm(1994): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:22.994: INFO/Process(166): Sending signal. PID: 166 SIG: 3
03-04 15:19:22.994: INFO/dalvikvm(166): threadid=3: reacting to signal 3
03-04 15:19:23.053: INFO/dalvikvm(166): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.053: INFO/Process(166): Sending signal. PID: 232 SIG: 3
03-04 15:19:23.053: INFO/dalvikvm(232): threadid=3: reacting to signal 3
03-04 15:19:23.061: INFO/dalvikvm(232): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.061: INFO/Process(166): Sending signal. PID: 342 SIG: 3
03-04 15:19:23.061: INFO/dalvikvm(342): threadid=3: reacting to signal 3
03-04 15:19:23.084: INFO/dalvikvm(342): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.084: INFO/Process(166): Sending signal. PID: 359 SIG: 3
03-04 15:19:23.084: INFO/dalvikvm(359): threadid=3: reacting to signal 3
03-04 15:19:23.096: INFO/dalvikvm(359): Wrote stack traces to '/data/anr/traces.txt'
03-04 15:19:23.272: DEBUG/dalvikvm(166): GC_CONCURRENT freed 914K, 16% free
13371K/15879K, paused 3ms+5ms
03-04 15:19:23.467: DEBUG/dalvikvm(166): GC_EXPLICIT freed 459K, 16% free 13475K/15879K,
paused 3ms+5ms
03-04 15:19:24.065: ERROR/ActivityManager(166): ANR in com.testpic
Reason: Executing service com.testpic/com.testpic.service.UpdateService
Load: 1.58 / 1.52 / 0.84
CPU usage from 12327ms to 0ms ago with 99% awake:
16% 166/system_server: 7.3% user + 9.4% kernel / faults: 8 minor
9.1% 1994/com.testpic: 7.1% user + 2% kernel / faults: 249 minor
0.7% 374/com.android.launcher: 0.6% user + 0% kernel / faults: 15 minor
0.6% 342/com.android.phone: 0.4% user + 0.2% kernel / faults: 15 minor
0.4% 5/kworker/u:0: 0% user + 0.4% kernel
0.4% 1343/kworker/0:1: 0% user + 0.4% kernel
0.4% 66/yaffs-bg-1: 0% user + 0.4% kernel
0.4% 77/rild: 0% user + 0.3% kernel
0.2% 897/de.devmil.minimaltext: 0.2% user + 0% kernel / faults: 63 minor
0.1% 293/com.google.process.gapps: 0% user + 0% kernel / faults: 4 minor
0% 159/logcat: 0% user + 0% kernel
0% 160/flush-179:0: 0% user + 0% kernel
0% 232/com.android.systemui: 0% user + 0% kernel / faults: 1 minor
0% 835/com.google.android.apps.maps:NetworkLocationService: 0% user + 0% kernel /
faults: 15 minor
25% TOTAL: 14% user + 11% kernel + 0.2% softirq
CPU usage from 577ms to 1090ms later with 99% awake:
22% 166/system_server: 8.7% user + 14% kernel
10% 182/ActivityManager: 3.5% user + 7% kernel
7% 179/system_server: 0% user + 7% kernel
3.5% 199/er$SensorThread: 0% user + 3.5% kernel
1.7% 181/er.ServerThread: 1.7% user + 0% kernel
4.5% 1994/com.testpic: 4.5% user + 0% kernel / faults: 4 minor
4.5% 1994/com.testpic: 4.5% user + 0% kernel
19% TOTAL: 7.6% user + 11% kernel
03-04 15:19:24.065: WARN/ActivityManager(166): Killing ProcessRecord{416316c0
1994:com.testpic/10087}: background ANR
03-04 15:19:24.073: INFO/ActivityManager(166): Process com.testpic (pid 1994) has died.
03-04 15:19:24.073: WARN/ActivityManager(166): Scheduling restart of crashed service
com.testpic/com.testpic.service.UpdateService in 42380ms
So my questions are :
- How can I do to avoid this ANR ?
- Is it correct to use a service in this kind of situation ?
- If not what should I use to perform that kind of treatment ?
Thank you in advance for your help :)
A regular Service still runs on the UI thread unless you tell it to spawn another one. Consider using an IntentService instead which handles that for you.
I have got this type of memory exception some times on my apps, any body have idea about why this exception is occurred ?
E/ActivityThread( 390): Failed to find provider info for com.google.settings
E/ActivityThread( 390): Failed to find provider info for com.google.settings
I/ActivityThread( 390): Publishing provider com.android.globalsearch.SuggestionProvider: com.android.globalsearch.SuggestionProvider
W/ActivityManager( 51): Timeout executing service: ServiceRecord{439b4c30 com.android.inputmethod.latin/.LatinIME}
I/ActivityManager( 51): ANR in process: com.android.inputmethod.latin
I/ActivityManager( 51): Annotation: Executing service ComponentInfo{com.android.inputmethod.latin/com.android.inputmethod.latin.LatinIME}
I/ActivityManager( 51): CPU usage:
I/ActivityManager( 51): Load: 2.07 / 0.89 / 0.35
I/ActivityManager( 51): CPU usage from 27357ms to 1782ms ago:
I/ActivityManager( 51): system_server: 10% = 3% user + 6% kernel / faults: 8566 minor 447 major
I/ActivityManager( 51): com.babbleville: 6% = 1% user + 4% kernel / faults: 3031 minor 188 major
I/ActivityManager( 51): com.android.inputmethod.latin: 5% = 0% user + 4% kernel / faults: 6296 minor 473 major
I/ActivityManager( 51): com.android.phone: 2% = 0% user + 2% kernel / faults: 3052 minor 101 major
I/ActivityManager( 51): adbd: 0% = 0% user + 0% kernel
I/ActivityManager( 51): logcat: 0% = 0% user + 0% kernel / faults: 291 minor 6 major
I/ActivityManager( 51): zygote: 0% = 0% user + 0% kernel / faults: 70 minor 3 major
I/ActivityManager( 51): pdflush: 0% = 0% user + 0% kernel
I/ActivityManager( 51): servicemanager: 0% = 0% user + 0% kernel / faults: 16 minor 4 major
I/ActivityManager( 51): logcat: 0% = 0% user + 0% kernel / faults: 290 minor 7 major
I/ActivityManager( 51): qemud: 0% = 0% user + 0% kernel / faults: 272 minor 3 major
I/ActivityManager( 51): +android.process.acore: 0% = 0% user + 0% kernel
I/ActivityManager( 51): TOTAL: 100% = 9% user + 30% kernel + 59% iowait + 0% irq + 0% softirq
I/ActivityManager( 51): Removing old ANR trace file from /data/anr/traces.txt
I/Process ( 51): Sending signal. PID: 384 SIG: 3
I/dalvikvm( 384): threadid=7: reacting to signal 3
I/Process ( 51): Sending signal. PID: 51 SIG: 3
I/dalvikvm( 51): threadid=7: reacting to signal 3
I/dalvikvm( 384): Wrote stack trace to '/data/anr/traces.txt'
I/ActivityThread( 390): Publishing provider com.android.globalsearch.stats: com.android.globalsearch.StatsProvider
I/ActivityThread( 390): Publishing provider contacts;call_log: com.android.providers.contacts.ContactsProvider
I/dalvikvm( 51): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 51): Sending signal. PID: 390 SIG: 3
I/dalvikvm( 390): threadid=7: reacting to signal 3
I/Process ( 51): Sending signal. PID: 358 SIG: 3
I/dalvikvm( 358): threadid=7: reacting to signal 3
I/dalvikvm( 390): Wrote stack trace to '/data/anr/traces.txt'
I/dalvikvm( 358): Wrote stack trace to '/data/anr/traces.txt'
I/Process ( 51): Sending signal. PID: 92 SIG: 3
I/dalvikvm( 92): threadid=7: reacting to signal 3
I/dalvikvm( 92): Wrote stack trace to '/data/anr/traces.txt'
==> ANR in process: com.android.inputmethod.latin
latin ime maybe blocked, find "message history" in your log or get /data/anr/traces.txt to know which process/thread is busy?
And from:
TOTAL: 100% = 9% user + 30% kernel + 59% iowait + 0% irq + 0% softirq
iowait is hight: maybe file read/write in busy status