FileNotFound FC error

JonPM

Well-Known Member
Licensed User
Longtime User
My app is using Map to store settings. I tried it on a different computer with a new emulator and now it is force closing at startup. Log shows:
Caused by: java.io.FileNotFoundException: /data/data/myB4Aprog/files/Map.dat (No such file or directory)

In Activity_Create I am using:
B4X:
   If File.Exists(File.DirInternal,"Map.dat") = False Then
      Map1.Initialize
      Map1.Put("DefHeight","in")
      Map1.Put("DefWeight","kg")
      File.WriteMap(File.DirInternal, "Map.dat", Map1)
   Else
      Map1 = File.ReadMap(File.DirInternal,"Map.dat")
      DefHeight = Map1.Get("DefHeight")
      DefWeight = Map1.Get("DefWeight")
   End If

What am I doing wrong? I am thinking if the file doesn't exist it will create it with the above values.
 

JonPM

Well-Known Member
Licensed User
Longtime User
Here is the entire log. I replaced my actual app name with "myB4Aapp"

B4X:
>>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
CheckJNI is ON


--- registering native functions ---
GC_EXPLICIT freed 103 objects / 5848 bytes in 140ms
asec list
Size of container 2 MB 185028 bytes
asec create smdl2tmp1 2 fat {} 10010
/system/bin/newfs_msdos: warning, /dev/block/dm-5 is not a character device
/system/bin/newfs_msdos: Skipping mount checks
Bogus heads from kernel - setting sane value
Bogus sectors from kernel - setting sane value
/dev/block/dm-5: 4176 sectors in 522 FAT32 clusters (4096 bytes/cluster)
bps=512 spc=8 res=32 nft=2 sec=4221 mid=0xf0 spt=63 hds=64 hid=0 bspf=5 rdcl=2 infs=1 bkbs=2
/system/bin/newfs_msdos terminated by exit(0)
Filesystem formatted OK
asec path smdl2tmp1
Created secure container smdl2tmp1 at /mnt/asec/smdl2tmp1
Created container for smdl2tmp1 at path : /mnt/asec/smdl2tmp1
Copied /data/local/tmp/myB4Aapp_DEBUG.apk to /mnt/asec/smdl2tmp1/pkg.apk
asec finalize smdl2tmp1
Finalized container smdl2tmp1
Unmounting smdl2tmp1 at path /mnt/asec/smdl2tmp1
GC_EXPLICIT freed 146 objects / 11640 bytes in 66ms
asec unmount smdl2tmp1 force
asec mount smdl2tmp1 {} 1000
asec path smdl2tmp1
Scanning package: /mnt/asec/smdl2tmp1/pkg.apk
asec unmount smdl2tmp1 force
asec rename smdl2tmp1 myB4Aapp-1
Mounting container myB4Aapp-1
asec mount myB4Aapp-1 {} 1000
asec path myB4Aapp-1
Succesfully renamed smdl2tmp1 at path: /mnt/asec/smdl2tmp1 to myB4Aapp-1 at new path: /mnt/asec/myB4Aapp-1
Removing non-system package:myB4Aapp
GC_FOR_MALLOC freed 7909 objects / 466288 bytes in 1474ms
Force stopping package myB4Aapp uid=10054
Scanning package myB4Aapp
Package myB4Aapp codePath changed from /mnt/asec/myB4Aapp-2/pkg.apk to /mnt/asec/myB4Aapp-1/pkg.apk; Retaining data and using new
/mnt/asec/myB4Aapp-1/pkg.apk changed; unpacking
DexInv: --- BEGIN '/mnt/asec/myB4Aapp-1/pkg.apk' ---
DexOpt: load 151ms, verify 1131ms, opt 37ms
DexInv: --- END '/mnt/asec/myB4Aapp-1/pkg.apk' (success) ---
Code path for pkg : myB4Aapp changing from /mnt/asec/myB4Aapp-2/pkg.apk to /mnt/asec/myB4Aapp-1/pkg.apk
Resource path for pkg : myB4Aapp changing from /mnt/asec/myB4Aapp-2/pkg.apk to /mnt/asec/myB4Aapp-1/pkg.apk
  Activities: myB4Aapp.main myB4Aapp.actabg myB4Aapp.actabw myB4Aapp.actanion myB4Aapp.actapgar myB4Aapp.actbmi myB4Aapp.actbsa myB4Aapp.actburns
Force stopping package myB4Aapp uid=10054
move /data/dalvik-cache/mnt@asec@myB4Aapp-1@pkg.apk@classes.dex -> /data/dalvik-cache/mnt@asec@myB4Aapp-1@pkg.apk@classes.dex
New package installed in /mnt/asec/myB4Aapp-1/pkg.apk
Force stopping package myB4Aapp uid=10054
GC_EXPLICIT freed 1306 objects / 74640 bytes in 75ms
GC_EXPLICIT freed 7901 objects / 477976 bytes in 251ms
asec unmount myB4Aapp-2 force
ASEC myB4Aapp-2 unmount attempt 1 failed (Device or resource busy)
no available voice recognition services found
unlink /data/dalvik-cache/mnt@asec@myB4Aapp-2@pkg.apk@classes.dex
Forcibly destroying container myB4Aapp-2
asec destroy myB4Aapp-2 force
Shutting down VM
adbd disconnected
JNI: AttachCurrentThread (from ???.???)
NOTE: attach of thread 'Binder Thread #3' failed



>>>>>>>>>>>>>> AndroidRuntime START <<<<<<<<<<<<<<
CheckJNI is ON
--- registering native functions ---
Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=myB4Aapp/.main }
Start proc myB4Aapp for activity myB4Aapp/.main: pid=884 uid=10054 gids={3003}
Shutting down VM
adbd disconnected
NOTE: attach of thread 'Binder Thread #3' failed
GREF has increased to 301


Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@43f5ace8 (uid=10054 pid=884)


Client not active, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43ec7ec0


Displayed activity myB4Aapp/.main: 1266 ms (total 1266 ms)


Shutting down VM


threadid=1: thread exiting with uncaught exception (group=0x4001d800)


FATAL EXCEPTION: main


java.lang.RuntimeException: java.io.FileNotFoundException: /data/data/myB4Aapp/files/Map.dat (No such file or directory)
   at myB4Aapp.main.initializeProcessGlobals(main.java:638)
   at myB4Aapp.main.afterFirstLayout(main.java:80)
   at myB4Aapp.main.access$100(main.java:16)
   at myB4Aapp.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   at dalvik.system.NativeStart.main(Native Method)


Caused by: java.io.FileNotFoundException: /data/data/myB4Aapp/files/Map.dat (No such file or directory)
   at org.apache.harmony.luni.platform.OSFileSystem.openImpl(Native Method)
   at org.apache.harmony.luni.platform.OSFileSystem.open(OSFileSystem.java:152)
   at java.io.FileInputStream.<init>(FileInputStream.java:82)
   at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:193)
   at anywheresoftware.b4a.objects.streams.File.ReadMap2(File.java:298)
   at anywheresoftware.b4a.objects.streams.File.ReadMap(File.java:285)
   at myB4Aapp.main._process_globals(main.java:746)
   at myB4Aapp.main.initializeProcessGlobals(main.java:627)
   ... 12 more
  Force finishing activity myB4Aapp/.main


Activity pause timeout for HistoryRecord{43e348c0 myB4Aapp/.main}


GC_EXPLICIT freed 11 objects / 488 bytes in 120ms


Unknown binder error code. 0xfffffff7


Sending signal. PID: 884 SIG: 9


Process myB4Aapp (pid 884) has died.
WIN DEATH: Window{43fc08e0 myB4Aapp/myB4Aapp.main paused=false}
WIN DEATH: Window{43feb960 myB4Aapp/myB4Aapp.main paused=false}
Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@43fd3058


Activity destroy timeout for HistoryRecord{43e348c0 myB4Aapp/.main}


request time failed: java.net.SocketException: Address family not supported by protocol
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
What code do you mean? The map code is under Activity_Create.

Btw the same app runs fine on my phone. But Fcs on emulator.

Sent from my DROIDX
 
Upvote 0

JonPM

Well-Known Member
Licensed User
Longtime User
You're right Erel. I was trying to take a shortcut. Problem fixed, thanks!
 
Upvote 0
Top