Android Question Layout-Files there, but not found?

W. Graf

Member
Licensed User
Longtime User
Good morning,

sorry, this is my second question for this morning, but I can't find similar problems in the forum.

I created a new empty project in B4A 8.0.
Then I created a layout and saved it as "LayoutA".

After clicking on OK (for saving the layout in designer), I'm immediatly getting three warnings:
Warning 1:
File 'LAYOUTA.BAL' in Files folder was not added to the Files tab.
You should either delete it or add it to the project.
You can choose Tools - Clean unused files. (warning #14)


Warning 2:
Layout file 'layouta.bal' is not used. Are you missing a call to Activity.LoadLayout? (warning #16)

Warning 3:
File 'LAYOUTA.BAL' is not used (warning #15)


If I start the project in the emulator (click on the Play-Icon in the toolbar), I'm getting the following crash with error-details:
java.io.FileNotFoundException: /data/data/xxxxx/files/virtual_assets/layoutmain.bal: open failed: ENOENT (No such file or directory)
Note: I replaced the app-name by xxxxx in this thread. But: layoutmain.bal was the name of the layout of the project, I have opened before starting this new project. Is there a cache or something else, I can clean?

If I open older projects (which I have started prior B4A 8.0), then I have no Problems with layouts.

Thank you again and kind regards!
Wolfgang
 

W. Graf

Member
Licensed User
Longtime User
Update:
The error, which references to the wrong layoutmain.bal: In Taskmanager, there were a lot of instances of adb.exe. Each time, when I tried to compile the app and got the error, the instance of adb.exe was not closed. After killing all instances, the error still exists, but it references to layouta.bal. So I have no idea, why it cannot find the file. But it searches for the right filename (-> a little advantage ;-) )

The warnings #14 and #15 still exists. #16 was my mistake: I forgot to enable the Activity.LoadLayout-instruction.
But if I enable this line, then I'm getting warning #17: File 'layouta.bal' is missing from the Files Tag.

Thank you!
 
Upvote 0

W. Graf

Member
Licensed User
Longtime User
I already tried this. The file is displayed in the files Tab. I can open it by clicking the blue text "(open designer)". Everything fine.
 
Upvote 0

W. Graf

Member
Licensed User
Longtime User
It seems to be a problem with upper- and lowercase of the filenames. Maybe you have an idea?

You have a reference in the *.b4a-file (zB: File1=Layouta.bal) and you have the *.bal-file in \Files-subfolder in your project-folder.

Try 1:
If you create a project and create a layout (you name it: "LayoutA"), then you have the following constellation, when you save the project on a FAT32-drive (=my situation):
In b4a-file: File1=LayoutA.bal
File in directory (FAT32): LAYOUTA.BAL
The warnings in the IDE appear.

Try 2:
If you copy the BAL-file to another folder, remove it from the files-tab in B4A and add the copied file, then you have the following:
File1=LAYOUTA.BAL
File in directory (FAT32): layouta.bal
The warnings in the IDE disappear.

Try 3:
If you repeat Try 1 and save the project on a NTFS-drive:
In b4a-file: File1=LayoutA.bal
File in directory (NTFS): layouta.bal
No warnings in the IDE.

Try 4:
If you create a project and create a layout (you name it: "layouta" -> all in lowercase), then you have the following constellation, when you save the project on a FAT32-drive:
In b4a-file: File1=layouta.bal
File in directory (FAT32): layouta.bal

I don't know why, but now I can start the project in emulator successfully without crashes. It doesn't matter, if the warnings appear or disappear. Maybe there was something wrong in memory in the morning, which prevents a successfully execution...

But it seems, that there is an issue, when storing the B4A-project on FAT32-drives?!
 
Upvote 0

W. Graf

Member
Licensed User
Longtime User
Sounds logical, but FAT32 supports lowercase filenames ...

I sent the above details, because I thought, maybe you want to check.
But if you don't want to spend time in this issue, then it is ok for me. Now I know, how I can workaround it.
 
Upvote 0

Woody

Member
Licensed User
I ran into a similar problem this morning. I renamed a .bal file to something a bit more readable by inserting two uppercase chars. I then changed some fields in that file, generated the members and compiled. That went fine. But upon execution I got an error telling me "All views in script should be declared." I started pulling my hair for there was a declaration. Then I remembered renaming the file. I removed and re-added the file (in B4A file manager) which solved my problem.

The issue seems to be connected to the way Windows handles case in filenames. In Windows Explorer as well as in the B4A filename dialogs uppercase does not show right away when you rename a file; you have to press refresh to show a filename in the right case. But case is stored and used. Although you cannot have two files Test.bal and tesT.bal in the same directory; these are seen by the OS as the same file. But not by B4A / Android.

There is a regkey (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DontPrettyPath) that should change the behavior of Windows with regard to upper/lowercase file names in Explorer, but maybe the best thing is to just use lowercase file names to prevent this :)
 
Upvote 0

MrKim

Well-Known Member
Licensed User
Longtime User
FYI I just started having this issue. Just bought a new PNY PRO ELITE PSSD external and moved my work to it.
It seems to have a bug. I could not change the case of a filename! I had to rename the file then name it back. IE File.bal > filex.bal > file.bal.
EDIT: did some research. My new drive is formatted in exFAT. Evidently it is a Windows bug that they have no intention of fixing. The upshot is Windows FAT drives require special handling for long file names. Windows is NOT case sensitive. This special handling doesn't see a case change as a name change so it just doesn't do it.
Sigh, Move stuff off, reformat, move it back.

Why on earth would a modern hard drive come formatted exFAT?
 
Last edited:
Upvote 0
Top