4 Replies - 337 Views - Last Post: 21 June 2017 - 07:19 AM

#1 Nova6112  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 90
  • Joined: 28-November 14

Creating Directory makes ANR sometimes

Posted 21 June 2017 - 04:48 AM

Hello guys,
My App is in playstore i checked some ANRs that time it cames to know only few users are getting ANR while creating codewise folder.

File wallpaperDirectory =null;
			if(!foldername.trim().equals(""))
				wallpaperDirectory = new File(extStorageDirectory+"/"+APP_FOLDER+"/"+foldername+"/");
			else
				wallpaperDirectory = new File(extStorageDirectory+"/"+APP_FOLDER+"/");
			wallpaperDirectory.mkdirs();


at android.os.BinderProxy.transactNative(Native method)
at android.os.BinderProxy.transact(Binder.java:628)
at android.os.storage.IMountService$Stub$Proxy.getVolumeList(IMountService.java:807)
at android.os.storage.StorageManager.getVolumeList(StorageManager.java:935)
at android.os.Environment$UserEnvironment.getExternalDirs(Environment.java:140)
at android.os.Environment.getExternalStorageDirectory(Environment.java:457)

here
wallpaperDirectory.mkdirs();
throws ANR, please help.

This post has been edited by Nova6112: 21 June 2017 - 04:50 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Creating Directory makes ANR sometimes

#2 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13400
  • View blog
  • Posts: 53,480
  • Joined: 12-June 08

Re: Creating Directory makes ANR sometimes

Posted 21 June 2017 - 06:37 AM

Do you have the actual error message?
Was This Post Helpful? 0
  • +
  • -

#3 Nova6112  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 90
  • Joined: 28-November 14

Re: Creating Directory makes ANR sometimes

Posted 21 June 2017 - 07:07 AM

View Postmodi123_1, on 21 June 2017 - 06:37 AM, said:

Do you have the actual error message?

at java.lang.Throwable.nativeFillInStackTrace!(Native method)
at java.lang.Throwable.fillInStackTrace(Throwable.java:166)
at java.lang.Throwable.<init>(Throwable.java:85)
at java.lang.Exception.<init>(Exception.java:36)
at android.system.ErrnoException.<init>(ErrnoException.java:39)
at libcore.io.Posix.mkdir(Native method)
at libcore.io.BlockGuardOs.mkdir(BlockGuardOs.java:173)
at java.io.File.mkdirErrno(File.java:875)
at java.io.File.mkdirs(File.java:899)
at java.io.File.mkdirs(File.java:893)
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13400
  • View blog
  • Posts: 53,480
  • Joined: 12-June 08

Re: Creating Directory makes ANR sometimes

Posted 21 June 2017 - 07:11 AM

Okay, I get the call stack. No actual error message?

Whoah.. does "extStorageDirectory" mean 'external storage'? As in an SD card? Are you assuming everyone has one of those?
Was This Post Helpful? 0
  • +
  • -

#5 Nova6112  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 90
  • Joined: 28-November 14

Re: Creating Directory makes ANR sometimes

Posted 21 June 2017 - 07:19 AM

View Postmodi123_1, on 21 June 2017 - 07:11 AM, said:

Okay, I get the call stack. No actual error message?

Whoah.. does "extStorageDirectory" mean 'external storage'? As in an SD card? Are you assuming everyone has one of those?

ANR error message contains 1000s of lines

"main" prio=5 tid=1 Native
  | group="main" sCount=1 dsCount=0 obj=0x758a6268 self=0xeb085400
  | sysTid=19784 nice=-4 cgrp=default sched=0/0 handle=0xee5e8534
  | state=S schedstat=( 30521775219 7353692720 28917 ) utm=2215 stm=837 core=0 HZ=100
  | stack=0xff1fc000-0xff1fe000 stackSize=8MB
  | held mutexes=
  kernel: (couldn't read /proc/self/task/19784/stack)
  native: #00 pc 000174b8  /system/lib/libc.so (syscall+28)
  native: #01 pc 000b669d  /system/lib/libart.so (_ZN3art17ConditionVariable16WaitHoldingLocksEPNS_6ThreadE+92)
  native: #02 pc 003f4efb  /system/lib/libart.so (_ZN3artL12GoToRunnableEPNS_6ThreadE+230)
  native: #03 pc 003f4deb  /system/lib/libart.so (_ZN3art12JniMethodEndEjPNS_6ThreadE+8)
  native: #04 pc 006be86d  /system/framework/arm/boot-framework.oat (Java_android_os_BinderProxy_transactNative__ILandroid_os_Parcel_2Landroid_os_Parcel_2I+152)
  at android.os.BinderProxy.transactNative(Native method)
  at android.os.BinderProxy.transact(Binder.java:628)
  at android.os.storage.IMountService$Stub$Proxy.getVolumeList(IMountService.java:807)
  at android.os.storage.StorageManager.getVolumeList(StorageManager.java:935)
  at android.os.Environment$UserEnvironment.getExternalDirs(Environment.java:140)
  at android.os.Environment.getExternalStorageDirectory(Environment.java:457)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:944)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:956)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:956)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:956)
  ... repeated 857 times
  at com.qqq.aaa.myapp.ReceiptDetailCrop.access$000(ReceiptDetailCrop.java:94)
  at com.qqq.aaa.myapp.myapp.ReceiptDetailCrop$7.onclick(ReceiptDetailCrop.java:510)
  at android.view.View.performClick(View.java:6207)
  at android.view.View$PerformClick.run(View.java:23639)
  at android.os.Handler.handleCallback(Handler.java:751)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:154)
  at android.app.ActivityThread.main(ActivityThread.java:6688)
  at java.lang.reflect.Method.invoke!(Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)


one more is:

"main" prio=5 tid=1 Runnable
  | group="main" sCount=0 dsCount=0 obj=0x759aa598 self=0xf4da4500
  | sysTid=23087 nice=0 cgrp=default sched=0/0 handle=0xf75b2b4c
  | state=R schedstat=( 0 0 0 ) utm=6431 stm=969 core=5 HZ=100
  | stack=0xff1cf000-0xff1d1000 stackSize=8MB
  | held mutexes= "mutator lock"(shared held)
  native: #00 pc 0037175f  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+142)
  native: #01 pc 00350d21  /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEP12BacktraceMap+160)
  native: #02 pc 0035ac3f  /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+446)
  native: #03 pc 00349f5f  /system/lib/libart.so (_ZN3art6Thread21RunCheckpointFunctionEv+162)
  native: #04 pc 003fbe23  /system/lib/libart.so (_ZN3artL12GoToRunnableEPNS_6ThreadE+394)
  native: #05 pc 000e55b1  /system/lib/libart.so (_ZN3art25JniMethodEndWithReferenceEP8_jobjectjPNS_6ThreadE+20)
  native: #06 pc 0001bc17  /system/framework/arm/boot.oat (Java_java_lang_Throwable_nativeFillInStackTrace__+82)
  at java.lang.Throwable.nativeFillInStackTrace!(Native method)
  at java.lang.Throwable.fillInStackTrace(Throwable.java:166)
  at java.lang.Throwable.<init>(Throwable.java:85)
  at java.lang.Exception.<init>(Exception.java:36)
  at android.system.ErrnoException.<init>(ErrnoException.java:39)
  at libcore.io.Posix.mkdir(Native method)
  at libcore.io.BlockGuardOs.mkdir(BlockGuardOs.java:173)
  at java.io.File.mkdirErrno(File.java:875)
  at java.io.File.mkdirs(File.java:899)
  at java.io.File.mkdirs(File.java:893)
  at com.qqq.aaa.myapp.Global.readFile(Global.java:2390)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:947)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:956)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:956)
  at com.qqq.aaa.myapp.ReceiptDetailCrop.readsdcardcategoryjson(ReceiptDetailCrop.java:956)
  ... repeated 1007 times
  at com.qqq.aaa.myapp.ReceiptDetailCrop.access$000(ReceiptDetailCrop.java:94)
  at com.qqq.aaa.myapp.ReceiptDetailCrop$7.onclick(ReceiptDetailCrop.java:510)
  at android.view.View.performClick(View.java:5702)
  at android.view.View$PerformClick.run(View.java:22533)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:158)
  at android.app.ActivityThread.main(ActivityThread.java:7229)
  at java.lang.reflect.Method.invoke!(Native method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

"AsyncTask #1Signinin dashbord" prio=5 tid=14 Waiting
  | group="main" sCount=1 dsCount=0 obj=0x12fe3a00 self=0xeeb59100
  | sysTid=23289 nice=10 cgrp=bg_non_interactive sched=0/0 handle=0xdac1d930
  | state=S schedstat=( 0 0 0 ) utm=2193 stm=38 core=4 HZ=100
  | stack=0xdab1b000-0xdab1d000 stackSize=1038KB
  | held mutexes=
  at java.lang.Object.wait!(Native method)
  - waiting on <0x0b1b4f05> (a java.lang.Object)
  at java.lang.Thread.parkFor$(Thread.java:1220)
  - locked <0x0b1b4f05> (a java.lang.Object)
  at sun.misc.Unsafe.park(Unsafe.java:299)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2013)
  at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1036)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1098)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
  at java.lang.Thread.run(Thread.java:818)

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1