Android Question ANR in file.exists

SDFP Studio

Member
Licensed User
Hello all :)

I have some ANR in file.exists function.

B4X:
  #00  pc 0x0000000000536054  /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+128)
  #01  pc 0x00000000006ef5e4  /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+236)
  #02  pc 0x00000000006fce70  /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+208)
  #03  pc 0x00000000004000f0  /apex/com.android.art/lib64/libart.so (art::Thread::RunCheckpointFunction()+140)
  #04  pc 0x000000000075a8b0  /apex/com.android.art/lib64/libart.so (artTestSuspendFromCode+48)
  #05  pc 0x000000000043d73c  /apex/com.android.art/lib64/libart.so (art_quick_test_suspend+156)
  at java.lang.Throwable.nativeFillInStackTrace (Native method)
  at java.lang.Throwable.fillInStackTrace (Throwable.java:807)
  at java.lang.Throwable.<init> (Throwable.java:270)
  at java.lang.Exception.<init> (Exception.java:54)
  at android.system.ErrnoException.<init> (ErrnoException.java:40)
  at libcore.io.Linux.access (Native method)
  at libcore.io.ForwardingOs.access (ForwardingOs.java:128)
  at libcore.io.BlockGuardOs.access (BlockGuardOs.java:76)

  at libcore.io.ForwardingOs.access (ForwardingOs.java:128)
  at android.app.ActivityThread$AndroidOs.access (ActivityThread.java:8514)
  at java.io.UnixFileSystem.checkAccess (UnixFileSystem.java:281)
  at java.io.File.exists (File.java:813)
  at anywheresoftware.b4a.objects.streams.File.Exists (File.java:97)
  at sdfpstudio.abmusictrainer.main._vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv3 (main.java:9158)

  at sdfpstudio.abmusictrainer.main._activity_create (main.java:1217)
  at java.lang.reflect.Method.invoke (Native method)

Line 21 is
B4X:
//BA.debugLineNum = 5661;BA.debugLine="If File.Exists(xRep,xFic) Then InitListeFavoris";
if (anywheresoftware.b4a.keywords.Common.File.Exists(_xrep,_xfic)) {

Google says it is more than average
Do you think there is something I can do ?

Thanks
Francis
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

SDFP Studio

Member
Licensed User
Yes I call from a loop

B4X:
For i = 0 To ListeFic.Size -1
        ' On récupère rep + fic
        xRepFic = ListeFic.Get(i)
        data = Regex.Split(TAB,xRepFic)
        If data.Length = 3 Then
            ' rep + fic
            xRep = data(1)
            xFic = data(2)
            ' On ajoute à la liste si le fichier éxiste toujours
            If File.Exists(xRep,xFic) Then InitListeFavorisAdFic(xRep,xFic)
        End If
    Next
 
Upvote 0

SDFP Studio

Member
Licensed User
It's the user who adds files to the list of his favorites so I don't know but it must be a few dozen I suppose.
The list that is filled after checking the existence of the file is not visible right away, a sleep during filling should not be seen.
I will try that,
Thanks Erel
 
Upvote 0
Top