Android Question Crash when running App directly from Tablet icon and not from Ide

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi to All
I develop an App, named GOrto, using the Usb cable connection. I work either in Debug or in Release mode, run the app and it works. In Release mode, the App is installed on the Tablet.
When I try to run the App, directly from the Tablet, it crashes. Having the cable connected, despite, as I said, the App is not launched by the B4A ide, I get this message, in the Log window:

java.io.FileNotFoundException: /storage/emulated/0/Android/data/b4A.GOrto/files/symbols.png: open failed: EACCES (Permission denied)

All permissions are activated. The file exists in the abovementioned directory. Moreover, the App works, when I run it by B4A ide, either in debug or in release mode, as I said.

The crash is (probably, because with debug it doesn't crash; by the way it is the only place where symbols.png is loaded) is:

B4X:
Dim BaseDir As String : BaseDir="RibaGolfe"
Public rp As RuntimePermissions

Sub loadTexture(gl As GL1, filename As String, texture As Int)
  
    bm.Initialize(rp.GetSafeDirDefaultExternal(BaseDir), filename)
 
End Sub

The App should work on the directory: Android/data/b4A.GOrto/files/RibaGolfe
To test the situation, I have put the file "Symbols.png" either in Android/data/b4A.GOrto/files or in its subdirectory RibaGolfe, as shown in the pictures. Strangely (for me, of course) it claims not to find the file not in the "RibaGolfe" subdirectory, but in its parent, where it exists too, anyway..

Or, it crashes for another reason and the message on the file is not a valid indication.. Nevertheless the fact remains that when the App is run from the Ide, and cable, it works
Finally, tried also with B4ABridge and same story: works when launched by the ide, not directly...
 

Attachments

  • Immagine.png
    Immagine.png
    160.3 KB · Views: 112
  • Immagine2.png
    Immagine2.png
    104.8 KB · Views: 108

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi. This strange behaviour was probably due to my tablet. Restarting it didn't resolve. But installing the apk after having sent it to the tablet, not from the ide, and letting Android to install, resolved. Much probably the icon on the tablet was calling a wrong version or something like that.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Final comment, if necessary: in the tablet there were 3 Apps installed with same name. Evidently in Android this is possible. From this fact derived the problem, I think.
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
Evidently in Android this is possible.
Yes, that it true. The name displayed with the app icon in the launcher is irrelevant and there can be duplicates. Android identifies individual apps by the package name you set in the project Build Configuration.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Yes, that it true. The name displayed with the app icon in the launcher is irrelevant and there can be duplicates. Android identifies individual apps by the package name you set in the project Build Configuration.
But i didn't change anything in the configuration. At least this is what seems to me. But the bad thing is that it is not irrelevant, for me: as a matter of fact, any of the displayed icons were not working, that is that they were all related to a crashing App (which of the 3 is not given to know..). I discovered to have 3 apps only going to the configuration manager. Otherwise i could have been fooled by Android for much time. By the way, the wonderful idea to delete the directory of the App, were it is "adviced", to work in, when unistallingthe App itself, was particularly annoying for me, in this case. Infact this App need files whose copy to the tablet takes half an hour. Therefore being forced to unistall the 3 fake Apps, I had to copy all the stuff again.. Thanks for commenting.
 
Upvote 0
Top