I read and hope that I have followed the advice about the resource access, mentioned in How to access a resource in Java project using Gradle? .. but without success. My configuration is not really the same (but I think that it does not matter):
In src/main/java: there is the package called "pack" in which there are all java files
In src/main/resources, there are all mp3 and wav files
And here is the part of Java code:
String musicFile = "deepSpaceInit.mp3";
URL resource = GluonApplication.class.getClassLoader()getResource(musicFile); // that works
// URL resource = GluonApplication.class.getResource(musicFile); // that works too with the same result
// resource is equal to jar:file/data/app/pack-2/base.apk!/deepSpaceInit.mp3
BUT, this next line does not work whereas the URL seems to be found (and correct):
Media soundMedia = new Media(resource.toExternalForm());
// Media soundMedia = new Media(resource.toString()); // it does not work too
The error (through adb) is:
" D/QMCX983D (374): Waiting for enable m or o sensor"
"QMC_IOCTL_GET_OPEN_STATUS failed"
"QMC_IOCTL_GET_DELAY failed"
"QMC_IOCTL_GET_YPR failed"
Have you an idea for solving this problem?
Note: GluonApplication is the "main" class for Gluon (i.e.the class in which there is the "start" input)
Note: Before getting this problem above, the javafx code worked fine in "pure" Java debug (application for PC platform), but it did not work when this application was ported for Android platform:
String musicFile = "deepSpaceInit.mp3";
Media sound = new Media(new File(repertoireMP3 + musicFile).toURI().toString()); // it does not work
with repertoireMP3 = "" or "/" or "./" or "src/main/resources" or "/src/main/resources" ... without success