After several weeks of investigations, the reason of this error has been found.
First of all, in the build.gradle file, it is necessary to refer only to the plugins used by the product. So, in my case, after reading "waitting for enable m or o sensor"", José said that perhaps the problem came from the magnetometer (like 'm'). In the gradle file, I removed this reference from: plugins 'accelerometer', 'device', 'orientation', 'storage', 'vibration', 'display', 'lifecycle', 'statusbar', 'position' But the problem persisted.
In the same direction, I have noticed the 'o'. 'o' like "Orientation"? Perhaps. As I had forced the smartphone orientation in the AndroidManifest.xml" file: , perhaps the orientation plugin is not useful in the build.gradle file?
I do that and now the game works fine.
In conclusion, now, even if the Orientation sensor does not work in my phone, it does not disturb my product.
Just a question: why JavaFxPorts do not directly use the plugin Orientation?
Note: at the end, I have also removed all unused plugins in the build.gradle file, like that:
plugins 'accelerometer', 'device', 'storage', 'display'
Note: Wrong directions of investigation:
There are two possible reasons of this exception (refer to the trace)
1st reason: The symptom of this FATAL exception could be similar to the other one mentioned in Understanding AudioTrack Assertion in Android. In that case, Mimmo solved it like that: "Make AudioTrack buffer size the same you get from minBufferSize. That could fix your issue.".
But, in my case, with AndroidNativeAudio and NativeAudioService, it is not possible to set this buffer size because, at my level, there is no any method to assign the AudioTrack buffer size to minBufferSize value. Another possibility would be to set it, at the low audio level managed by Gluon (I think).
Question1: How can people set AudioTrack buffer size, in the context javafxports + Gluon + AndroidNativeAudio ?
Question2: At low level, near Android ports, what is the assignment of ths size, if exists?
Second reason:
Why does the trace refer to the Magnetometer ("QMCX983D")?
I have clean up the Eclipse project, after modifying the build.gradle file by removing any reference to the magnetometer. So, the .apk is changed (19.4 Mo to 18 Mo).
But, in the trace, the reference to QMCX983D (a magnetometer) persists. Is it normal? I have an Archos Diamond S mobile.
I have no source code about the Magnetometer service.
So, why a trace can always include a reference to that sensor? A hidden dependency that could generate, for instance, a thread that gets Magnetometer data?
Thanks
Note: "ArrayIndexOutOfBoundsException" is only a consequence of the problem. This answer wants to go to the problem source.
D/AudioTrackShared( 319): front(0x6d4800), mIsOut(1), mAvailToClient=1024 stepCount=1024 minimum=2048, FUTEX_WAKE
D/AudioTrackShared( 319): front(0x6d4800), mIsOut 1, avail 2048, mFrameCount 4096, filled 2048
V/AudioTrack( 319): obtainBuffer(2048) returned 2048 = 2048 + 0 err 0
D/AudioTrackShared( 319): front(0x6d4800), mIsOut 1, avail 0, mFrameCount 4096, filled 4096
D/AudioTrackShared( 319): front(0x6d4800), mIsOut 1, avail 0, mFrameCount 4096, filled 4096
D/AudioTrackShared( 319): front(0x6d4800), mIsOut 1, obtainBuffer() FUTEX_WAIT
D/Surface (13077): Surface::setBuffersDimensions(this=0xf45e5500,w=676,h=1206)
D/QMCX983D( 387): waitting for enable m or o sensor
D/QMCX983D( 387): QMC_IOCTL_GET_OPEN_STATUS failed
D/QMCX983D( 387): QMC_IOCTL_GET_DELAY failed
D/QMCX983D( 387): QMC_IOCTL_SET_YPR failed!
E/AndroidRuntime(13077): FATAL EXCEPTION: JavaFX Application Thread
E/AndroidRuntime(13077): Process: com.gluonapplication, PID: 13077
E/AndroidRuntime(13077): java.lang.ArrayIndexOutOfBoundsException: length=30; index=-1
E/AndroidRuntime(13077): at java.util.ArrayList.get(ArrayList.java:310)
E/AndroidRuntime(13077): atvafx.scene.Parent.updateCachedBounds(Parent.java:1583)
E/AndroidRuntime(13077): at javafx.scene.Parent.recomputeBounds(Parent.java:1527)
E/AndroidRuntime(13077): at javafx.scene.Parent.impl_computeGeomBounds(Parent.java:1380)
E/AndroidRuntime(13077): at javafx.scene.layout.Region.impl_computeGeomBounds(Region.java:3078)
E/AndroidRuntime(13077): at javafx.scene.Node.updateGeomBounds(Node.java:3577)
E/AndroidRuntime(13077): at javafx.scene.Node.getGeomBounds(Node.java:3530)
E/AndroidRuntime(13077): at javafx.scene.Node.updateBounds(Node.java:564)
E/AndroidRuntime(13077): at javafx.scene.Parent.updateBounds(Parent.java:1711)
E/AndroidRuntime(13077): at javafx.scene.Scene$ScenePulseListener.pulse(Scene.java:2408)
E/AndroidRuntime(13077): at com.sun.javafx.tk.Toolkit.lambda$runPulse$30(Toolkit.java:348)
E/AndroidRuntime(13077): at com.sun.javafx.tk.Toolkit.access$lambda$3(Toolkit.java)
E/AndroidRuntime(13077): at com.sun.javafx.tk.Toolkit$$Lambda$4.run(Unknown Source)
E/AndroidRuntime(13077): at java.security.AccessController.doPrivileged(AccessController.java:52)
E/AndroidRuntime(13077): at com.sun.javafx.tk.Toolkit.runPulse(Toolkit.java:347)
E/AndroidRuntime(13077): at com.sun.javafx.tk.Toolkit.firePulse(Toolkit.java:374)
E/AndroidRuntime(13077): at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:525)
E/AndroidRuntime(13077): at com.sun.javafx.tk.quantum.QuantumToolkit.pulse(QuantumToolkit.java:503)
E/AndroidRuntime(13077): at com.sun.javafx.tk.quantum.QuantumToolkit.lambda$runToolkit$387(QuantumToolkit.java:321)
E/AndroidRuntime(13077): at com.sun.javafx.tk.quantum.QuantumToolkit.access$lambda$2(QuantumToolkit.java)
E/AndroidRuntime(13077): at com.sun.javafx.tk.quantum.QuantumToolkit$$Lambda$3.run(Unknown Source)
E/AndroidRuntime(13077): at com.sun.glass.ui.monocle.RunnableProcessor.runLoop(RunnableProcessor.java:92)
E/AndroidRuntime(13077): at com.sun.glass.ui.monocle.RunnableProcessor.run(RunnableProcessor.java:51)
E/AndroidRuntime(13077): at java.lang.Thread.run(Thread.java:818)
V/SettingsProvider( 842): call(global:dropbox:data_app_crash) for 0
The build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.2'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.gluonapplication.GluonApplication'
dependencies {
compile 'com.gluonhq:charm:4.3.0'
}
jfxmobile {
downConfig {
version '3.2.0'
plugins 'accelerometer', 'device', 'orientation', 'storage', 'vibration', 'display', 'lifecycle', 'statusbar', 'position'
}
android {
applicationPackage = 'com.gluonapplication'
manifest = 'src/android/AndroidManifest.xml'
androidSdk = 'C:/Users/pascal/AppData/Local/Android/sdk'
resDirectory = 'src/android/res'
compileSdkVersion = '25'
buildToolsVersion = '25.0.1'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
Trace without any explicit reference to the Magnetometer:
I/MediaPlayerService( 318): [setDataSource] setDataSource fd=57, offset=3166308, length=90559
I/MediaPlayerService( 318): [setDataSource_drm_preCheck] fd=57,path=/data/app/com.gluonapplication-1/base.apk
D/DrmMtkUtil/DrmUtil( 318): checkDcf ----> fd [57]
V/DrmMtkUtil/DrmUtil( 318): checkDcf: first 3 bytes [50][4b][3]
E/DrmMtkUtil/DrmUtil( 318): checkDcf: not dcf type, dcf version value [80]
E/Cta5File( 318): Cta5File::isCta5NormalFile false, bad magic:PK
E/Cta5File( 318): Cta5File::isCta5MultimediaFile false, bad magic:
D/DrmMtkUtil( 318): isDcf: result [-1], isCta5:result [0]
D/Sonivox ( 318): EAS_HWOpenFile ----> use file descriptor [58]
D/DrmMtkUtil/DrmUtil( 318): checkDcf ----> fd [58]
V/DrmMtkUtil/DrmUtil( 318): checkDcf: first 3 bytes [50][4b][3]
E/DrmMtkUtil/DrmUtil( 318): checkDcf: not dcf type, dcf version value [80]
E/Cta5File( 318): Cta5File::isCta5NormalFile false, bad magic:PK
E/Cta5File( 318): Cta5File::isCta5MultimediaFile false, bad magic:
D/DrmMtkUtil( 318): isDcf: result [-1], isCta5:result [0]
D/Sonivox ( 318): EAS_HWOpenFile ----> checked, not a DRM file.
D/AudioTrackShared( 318): front(0x343e), mIsOut 1, avail 2972, mFrameCount 4458, filled 1486
V/AudioTrack( 318): obtainBuffer(1486) returned 2972 = 1486 + 1486 err 0
D/AudioTrackShared( 318): front(0x343e), mIsOut 1, avail 1486, mFrameCount 4458, filled 2972
V/AudioTrack( 318): obtainBuffer(1486) returned 1486 = 38 + 1448 err 0
D/MediaPlayerFactory( 318): getPlayerType(): using fd, check for DRM protected midi.
D/AudioTrackShared( 318): front(0x343e), mIsOut 1, avail 1448, mFrameCount 4458, filled 3010
D/DrmMtkUtil/DrmUtil( 318): checkDcf ----> fd [57]
V/AudioTrack( 318): obtainBuffer(1448) returned 1448 = 1448 + 0 err 0
V/DrmMtkUtil/DrmUtil( 318): checkDcf: first 3 bytes [50][4b][3]
E/DrmMtkUtil/DrmUtil( 318): checkDcf: not dcf type, dcf version value [80]
D/AudioTrackShared( 318): front(0x343e), mIsOut 1, avail 0, mFrameCount 4458, filled 4458
D/FileSourceProxy( 318): Fd: 58 register!
D/AudioTrackShared( 318): front(0x343e), mIsOut 1, avail 0, mFrameCount 4458, filled 4458
D/AudioTrackShared( 318): front(0x343e), mIsOut 1, obtainBuffer() FUTEX_WAIT
D/MediaPlayerFactory( 318): Before sniff local sdp
D/MediaPlayerFactory( 318): After sniff local sdp
D/FileSourceProxy( 318): Fd: 58 unregister!
D/FileSourceProxy( 318): Fd: 58, File Cache hit rate: 0.00
D/FileSourceProxy( 318): Fd: 58 register!
D/WVMDrmPlugIn( 317): WVMDrmPlugin::onInitialize : 5043
D/WVMDrmPlugIn( 317): WVMDrmPlugin::onSetOnInfoListener : add 5043
D/DrmCtaPlugIn( 317): onInitialize() : uniqueId : 5043
D/DrmCtaPlugIn( 317): encrypt thread has being created
D/DrmCtaPlugIn( 317): decrypt thread has being created
D/DrmCtaPlugIn( 317): onSetOnInfoListener(): uniqueId : 5043
D/DrmCtaPlugIn( 317): onSetOnInfoListener(): native
D/DrmMtkPlugIn( 317): DrmMtkPlugIn::onInitialize : 5043
D/DrmMtkPlugIn( 317): DrmMtkPlugIn::onSetOnInfoListener : 504
D/DrmManagerClient(Native)( 318): DrmManagerClient(): mUniqueId=[5043]
D/DrmManager(Native)( 317): pid = 11680
D/DrmManager(Native)( 317): pid_str = 11680
D/DrmCtaPlugIn( 317): onOpenDecryptSession() [5043], fd = 15, offset = 3166308, length = 9055
E/DrmCtaPlugIn( 317): [ERROR]onOpenDecryptSession - The key is not set by user
D/DrmMtkPlugIn( 317): onOpenDecryptSession() [5043], Start with file descryptor
D/DrmMtkUtil/DrmUtil( 317): parseDcf ----> fd [15
V/DrmMtkUtil/DrmUtil( 317): parseDcf: first 3 bytes [50][4b][3]
E/DrmMtkUtil/DrmUtil( 317): parseDcf: not dcf type, dcf version value [80]
E/DrmMtkPlugIn( 317): onOpenDecryptSession() : failed to parse dcf file.
D/WVMDrmPlugIn( 317): WVMDrmPlugin::onTerminate : 5043
D/DrmCtaPlugIn( 317): onTerminate():uniqueId : 5043
D/DrmMtkPlugIn( 317): DrmMtkPlugIn::onTerminate : 5043
D/QMCX983D( 369): waitting for enable m or o sensor
D/QMCX983D( 369): QMC_IOCTL_GET_OPEN_STATUS failed
D/QMCX983D( 369): QMC_IOCTL_GET_DELAY failed
D/QMCX983D( 369): QMC_IOCTL_SET_YPR failed!
D/DrmManagerClient(Native)( 318): ~DrmManagerClient(): mUniqueId=[5043]
E/AndroidRuntime(11680): FATAL EXCEPTION: JavaFX Application Thread
E/AndroidRuntime(11680): Process: com.gluonapplication, PID: 11680
E/AndroidRuntime(11680): java.lang.ArrayIndexOutOfBoundsException: length=30; index=-
E/AndroidRuntime(11680): at java.util.ArrayList.get(ArrayList.java:310)
E/AndroidRuntime(11680): at javafx.scene.Parent.updateCachedBounds(Parent.java:1583)
E/AndroidRuntime(11680): at javafx.scene.Parent.recomputeBounds(Parent.java:1527)
E/AndroidRuntime(11680): at javafx.scene.Parent.impl_computeGeomBounds(Parent.java:1380)
E/AndroidRuntime(11680): at javafx.scene.layout.Region.impl_computeGeomBounds(Region.java:3078)
E/AndroidRuntime(11680): at javafx.scene.Node.updateGeomBounds(Node.java:3577)
E/AndroidRuntime(11680): at javafx.scene.Node.getGeomBounds(Node.java:3530)