question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The application may be doing too much work on its main thread.

See original GitHub issue

I used SimpleDraweeView in adapter, but my app runs slowly, and I saw the log below:

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

so I comment the code mSimpleDraw.setImageUri, the app runs fluently. I think the SimpleDraw blocks the main thread when fetching image from network.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:3
  • Comments:25 (10 by maintainers)

github_iconTop GitHub Comments

3reactions
mikeknoopcommented, Apr 9, 2015

Replacing

view.setImageURI(Uri.parse("content://...");

with

ImageRequest imageRequest =
        ImageRequestBuilder.newBuilderWithSource(Uri.parse("content://...")
                .setResizeOptions(
                        new ResizeOptions(150, 150))
                .build();
DraweeController draweeController = Fresco.newDraweeControllerBuilder()
        .setImageRequest(imageRequest)
        .setOldController(view.getController())
        .setAutoPlayAnimations(true)
        .build();
view.setController(draweeController);

in my code above fixes the performance problem. If I comment out the setResizeOptions line the performance problem comes back. Perhaps something to do with rescaling on the main thread?

0reactions
adkhamjonDevcommented, Jun 13, 2021

need help << The application may be doing too much work on its main thread >> And here is my code ViewModel-> class YoutubeViewModel(apiService: ApiService):ViewModel() { val youtubeLiveData=MutableLiveData<Resource<MyYoutubeData>>() private val youtubeRepository=YoutubeRepository(apiService) init { getVideos() } private fun getVideos() { viewModelScope.launch { youtubeLiveData.postValue(Resource.loading(null)) youtubeRepository.getYoutubeData() .catch {e-> youtubeLiveData.postValue(Resource.error(e.message?:“Error”,null)) }.collect { youtubeLiveData.postValue(Resource.success(it)) } } } @JvmName(“getYoutubeLiveData1”) fun getYoutubeLiveData():MutableLiveData<Resource<MyYoutubeData>>{ return youtubeLiveData } } And in MainFragment youtubeViewModel=ViewModelProviders.of(this,ViewModelFactory(ApiClient.apiService))[YoutubeViewModel::class.java]

    youtubeViewModel.getYoutubeLiveData().observe(viewLifecycleOwner,{
        when(it.status){
            Status.ERROR->{
                binding.progress.visibility=View.INVISIBLE
                Toast.makeText(requireContext(), it.message, Toast.LENGTH_SHORT).show()
            }
            Status.LOADING->{
                binding.progress.visibility=View.VISIBLE
            }
            Status.SUCCESS->{
                binding.progress.visibility=View.INVISIBLE
                videoAdapter.submitList(it.data?.items)
                Log.d(TAG, "onCreateView: ${it.data?.items}")
            }
        }
    })
Read more comments on GitHub >

github_iconTop Results From Across the Web

The application may be doing too much work on its main thread
What this means is that your code is taking long to process and frames are being skipped because of it, It maybe because...
Read more >
“Skipped 611 frames! The application maybe doing too much ...
The application maybe doing too much work on its main thread.” ... But, these 611 frames could not be rendered as the UI...
Read more >
The application may be doing too much work on its main thread
Android : The application may be doing too much work on its main thread [ Beautify Your Computer : https://www.hows.tech/p/recommended.html ] ...
Read more >
[Skipped 47 frames! The application may be doing too much ...
[Skipped 47 frames! The application may be doing too much work on its main thread] in simple app #40563.
Read more >
The application may be doing too much work on its main thread
Does it happen in release mode? If not then ignore it. If it just happens when you stress test your app then you...
Read more >

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found