Android Question Is File.DirAssets a Hog


Licensed User
  1. I load a run an app that has one png file to display in an imageview as a test and with a package name: b4a.example.
  2. I load and run another app with the same package name and label as the first: b4a.example (since it is a test, I want to overwrite the first) that displays a few png files. Before I run the second app, I clean project, clean files folder, then re-sync folder, but the file from the first app which does not belong to the second app appears when I display all files when app is run, although it is not shown in the IDE right pane of the file manager or in the files folder.
The only way to get rid of the stray png file belonging to the first b4a.example app is to uninstall the app and reinstall it. Then, the stray file is gone. All above work is done in Debug Mode. I did not test this behavior in Release mode.

Is this a normal File.DirAssets folder behavior to inherit a file(s) from a previously run app with the same package name?


Well-Known Member
Licensed User

I think not that File.DirAssets is a Hog. I think what you are describing is normal behavior.

Let me explain.
The app name is b4a.example, you install that on your device and the system then creates all it needs to run the app (.apk). On Android, when you delete your apk (or App) then it will delete all associated files and directories required to run the app.

So in your explanation above, you create app Number 1 and install on your device. This app is called b4a.example. Now you no longer have use for it and in your PC, you download a second example - also called b4a.example (app Number 2), to a new directory there (keep in mind both app Number 1 and App number 2 now reside on your PC in separate directories), compile it and install it to your device . To your device this is an UPDATE of the previous b4a.example (the name is the same) and only over writes the apk and adds the additional files that reside in "Files" on your PC to the appropriate place on your device. That is why the "stray file" remains on your device.

If you took App Number 2 and named it b4a.example2 - you would not have the stray file and it will function as required.

I hope this makes sense.

Eish - Erel is quick !!
Upvote 0