IDE files tab usage?

boten

Active Member
Licensed User
Longtime User
I understand that if I need a file in a program, it should be added into the files list (under files tab).
But when a prog compiles, it creates an APK that "packs in" ALL the files in the files sub-directory, whether they are needed or not.

Isn't the Files tab created for the purpose of specifying needed files only? (and ignore all other files, some of them might be just junk)
 

warwound

Expert
Licensed User
Longtime User
I found that the only files packed in the APK were ones i'd added using the IDE Files button.

Files added using Windows Explorer for example - but not using the IDE Files button were not in my APK.

That was with v1.5 of B4A - haven't tested with latest v1.6.

Martin.
 
Upvote 0

kickaha

Well-Known Member
Licensed User
Longtime User
I would not describe it as a problem, but putting a file in the "Files" directory does add it to the apk for me, same as the OP (1.6)
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
In Addition;

If I load a bitmap via:
B4X:
bmp.Initialize(File.DirAssets,"abc.jpg")

the bitmap is loaded even though I did NOT include abc.jpg using the files tab.

So, to sum it up, ALL files in the files sub-directory are "packed" in the APK and are available to be used in File.DirAssets and the files tab in the IDE seems useless.
What am doing wrong?
 
Upvote 0

Brad

Active Member
Licensed User
Longtime User
The way I understand it and how it works for me is I add files such as png files using the file tab if I want to use them in the designer. Such as adding graphics to a image view. If I want to assign a graphic to a image view in code I just toss them in the file folder.
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Try this...

Export your project as ZIP.

Open the ZIP archive and look in the Files folder.

The only files that the B4A IDE will add to the Files folder in the ZIP archive are those that have been added using the IDE 'Add Files' button - is that what others see?

Martin.
 
Upvote 0

margret

Well-Known Member
Licensed User
Longtime User
.apk

Try this...

Export your project as ZIP.

Open the ZIP archive and look in the Files folder.

The only files that the B4A IDE will add to the Files folder in the ZIP archive are those that have been added using the IDE 'Add Files' button - is that what others see?

Martin.

On mine I added two directories under files to create art work, I did not add them to the project but they are in the .apk file. On another project I have had errors at run time, can't find file because I forgot to add it under the projects file tab but they were in the files directory.

Margret
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
Warwound, I'm not talking about the ZIP file which seems to be ok.

I tried this : (the Files sub-directory was empty, NOTHING under the Files tab)

B4X:
Sub Process_Globals
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
End Sub

Sub Activity_Resume
Msgbox("done","")
End Sub

Sub Activity_Pause (UserClosed As Boolean)
End Sub

The resulting APK was 82K.
Then I just copied -with windows explorer - a jpg file (1354K) to the Files sub-dir and compiled again (still with NOTHING under the Files tab).

The resulting APK was 1435K.

Checking the actual byte sizes of all 3 files it turned out that the 2nd, bigger APK file was 284 bytes bigger than the sum of the jpg + the smaller APK.

So my question still remains: why do ALL the files in the Files sub-dir get packed into the APK? What exactly is the purpose of the Files tab (as I can refer to files in code)?
 
Upvote 0

warwound

Expert
Licensed User
Longtime User
Warwound, I'm not talking about the ZIP file which seems to be ok.

Sorry i meant to add to my last post that my original post referred to ZIPing a project and not the compiled APK.

I would have thought the same logic would apply to ZIPing a project as applies to creating the APK.
That files added using the Add Files button would be included in the ZIP or APK file and files in the Files folder that had NOT been added with the Add Files button would NOT be added to the ZIP or APK.
It seems that's not correct...

Martin.
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
So if Files folder contains some test files, different versions of used files, test pictures, etc... It is better (maybe even a MUST) to move then to a different folder b4 compiling?
 
Upvote 0
Top