1

Am using android latest version sdk with 4.1 version emulator in eclipse (Helios). Every thing is working fine. But in my logcat for each run of any application am getting following statement.

I/Choreographer(1250): Skipped 1001 frames!  The application may be doing too much work on its main thread.

Even in Hello world application, am getting the same logcat output. I am not using multi threads in my applications. Can some one please tell the reason why am getting these logs in my logcat.

Here is my code

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_jsonparsing);

    _mContext = this;
    lv = (ListView) findViewById(R.id.listview);

    new JSONParserTask().execute();
}

In my async Task am getting JSONArray from server, parsing it and listing out.

Dipak Keshariya
  • 22,193
  • 18
  • 76
  • 128
Androholic
  • 526
  • 3
  • 9
  • Maybe it shows the same even when your application is not running? – Alexander Kulyakhtin Oct 23 '12 at 10:16
  • No, it showing only when am launching my (any i.e sample or my working project) application. – Androholic Oct 23 '12 at 10:19
  • as it says: you are doing non UI calculations on UI thread. like querying sqlite db, assessing shared preferences etc – Gaurav Vashisth Oct 23 '12 at 10:27
  • But am not at all using any database, shared preferences and not doing drawing, animations also. – Androholic Oct 23 '12 at 10:29
  • Are you using JSONParserTask() correctly, Remember to use doInBackground() only for bulky task. onPostExecute() Executes in Main UI thread so don't do any bulky task there, If possible paste your JSONParserTask as well!! – Ash Oct 23 '12 at 11:06
  • ACCEPT the answer from which u found the solution. So that if the same problem replicates for anyone, can found the solution from ur question – Avadhani Y Oct 23 '12 at 11:15
  • yes. am using async task in a correct manner and am aware that onPreExecute() and onPostExecute() will execute on main ui thread. other than that every thing non related to ui thread have to be in doInBackground(). – Androholic Oct 23 '12 at 11:32

3 Answers3

3

Android Developer Documentation provided this:

The choreographer receives timing pulses (such as vertical synchronization) from the display subsystem then schedules work to occur as part of rendering the next display frame.

Applications typically interact with the choreographer indirectly using higher level abstractions in the animation framework or the view hierarchy.

For more info, please refer this link and this.

Community
  • 1
  • 1
Avadhani Y
  • 7,566
  • 19
  • 63
  • 90
  • So, how can i prevent these logs from my logcat.Because am not using any animations and drawing. – Androholic Oct 23 '12 at 10:23
  • 1
    @Androholic Sometimes this is inevitable. I often see this log when using step by step debugging. The choreographer only tell u the frames it skipped, it may be caused by some time consuming tasks on your UI thread, or like my case caused by debugging pause and restart. So if you don't have any heavy tasks invoked in UI thread, just ignore it. – dumbfingers Oct 23 '12 at 10:27
  • I think there is no way of preventing that.. as the system takes long time to complete the particular task, Choreographer will post in logcat saying that "The application may be doing too much work on its main thread". – Avadhani Y Oct 23 '12 at 10:30
3

This logcat trace

 I/Choreographer(1250): Skipped 1001 frames! 

The application may be doing too much work on its main thread, suggests that you are doing some bulky tasks in your main thread. If you are doing such tasks, use a separate threading mechanism (AsyncTask, Thread etc.) to do that, This log should go away.

If not, Please paste the snippet of your code!!

Avadhani Y
  • 7,566
  • 19
  • 63
  • 90
Ash
  • 1,391
  • 15
  • 20
1

Are you running your application on emulator.I guess you increase the Memory allocated to your AVD might remove this warning!!..I face similar issues when my device emulator is allocated less memory

B Kalra
  • 821
  • 6
  • 17