19

I am getting this when using a recycle view along with Picasso library to fetch images from sound cloud. The problem is that the app freezes for few seconds sometimes. Then, I get a message of skipping frames and doing too much work on the main thread. I am using retrofit to perform the Http connection.

I/System.out: (HTTPLog)-Static: isSBSettingEnabled false
KnoxVpnUidStorageknoxVpnSupported API value returned is false
I/Choreographer: Skipped 102 frames!  The application may be doing too much work on its main thread.
OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
jelmood jasser
  • 878
  • 1
  • 13
  • 30
  • Possible Duplicate of http://stackoverflow.com/questions/14678593/the-application-may-be-doing-too-much-work-on-its-main-thread – OneCricketeer Sep 04 '16 at 03:39
  • And `I/System.out` is simply an INFO message from `System.out.println`, not necessarily an error or anything to care about – OneCricketeer Sep 04 '16 at 03:40
  • Another possible duplicate. http://stackoverflow.com/questions/30360823/how-do-i-fix-whatever-is-causing-this-to-flood-my-logcat-i-system-out-httplog – OneCricketeer Sep 04 '16 at 03:43

9 Answers9

36

The reason for App freezing is because of the error " The application may be doing too much work on its main thread". The reason for this error is maybe you are trying to download images of a bigger size which is exceeding the app memory.Using large size images or resource files also causes this error. "isSBSettingEnabled false" is may be because of using HttpUrlConnection, this mainly occurs while using Samsung devices. Try using emulator.

Jahnavi Nandamuri
  • 431
  • 1
  • 6
  • 9
5

I may be too late but it can help someone. I encountered this situation in two case. First situation I was trying to download something big and doing simultaneous download, I was not quite sure if it was a problem but I changed the mechanism for download and used okhttp. Second time Yes it was also in downloading but this time it was a bad URL that I was using: http://example.com/file to download.pdf (look here space was the problem). Formatting the URL was the only thing to fix it.

3

You can try to add this attribute to your part in the AndroidManifest.xml

android:usesCleartextTraffic="true"

This could solve the problem on my app.

Dharman
  • 30,962
  • 25
  • 85
  • 135
SparkRTG
  • 51
  • 6
1

Change the compile sdk version to 27, I also faced the same issue with my app, just replace the compilesdk version to 27,

Hope it helps!

  • I have a game that connects to socket.io and was having this issue, it wouldn't connect to the server, this solution worked for me, care to explain with details? It's weird because it started when I downloaded the latest android version – centenond Apr 18 '19 at 07:17
1

I tried simply changing the target not even the compiledsdkVersion and it worked! :

targetSdkVersion 27

edit :

However to upload on google play your targetSdk version must not be lower than the compiledSdk

Phil
  • 305
  • 1
  • 3
  • 13
0

For anyone out there trying to debug this problem.

This occurs to me, whenever I try to access a null variable.

I am yet to learn the intricacies of null safety thoroughly. The code does not through any error.

The execution just seems to freeze before the null variable is encountered.

Spent quiet a number of days trying to figure this out.

unlockme
  • 3,897
  • 3
  • 28
  • 42
-1

You should increase the request timeout, that's how:

1) Subclass a Downloader class

2) Preconfigure OkHttpClient with timeouts and pass it to Picasso

xKobalt
  • 1,498
  • 2
  • 13
  • 19
-1

this reason is you are targeting android 12 just add android:usesCleartextTraffic="true" in the androidManifist.xml file

-7

add this in AndroidMainfest and try

<uses-permission android:name="android.permission.INTERNET"></uses-permission>