Reputation: 117
I can't get Shape3D objects such as a simple Sphere or MeshView to work on my Android phone. I have used Gluon plugin for NetBeans 8.0.2 to create small apps for my phone and this is the first time I am using Shape3D objects.
import javafx.application.Application;
import javafx.geometry.Rectangle2D;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Sphere;
import javafx.stage.Screen;
import javafx.stage.Stage;
public class testGluonApp extends Application {
@Override
public void start(Stage stage) throws Exception {
Rectangle2D visualBounds = Screen.getPrimary().getVisualBounds();
double width = visualBounds.getWidth();
double height = visualBounds.getHeight();
Sphere sphere = new Sphere(64.0);
StackPane stackPane = new StackPane();
stackPane.getChildren().addAll(sphere);
Scene scene = new Scene(stackPane, visualBounds.getWidth(), visualBounds.getHeight());
stage.setScene(scene);
stage.show();
}
}
The sample application above ( from javafxports samples ) works fine on my PC but when I compile the app (Tasks->android->android) and install it on my device (Tasks->android->androidInstall) it does install but only shows a black screen when started up.
I HwLauncher: FPSMonitor [Launcher , dispatchTouchEvent begin, false, true] down event x = 697 y = 697
I HwLauncher: FPSMonitor [PagedView , onIntercept] down event x = 697 y = 697
I HwLauncher: FPSMonitor [Launcher , dispatchTouchEvent end, false, true] down event x = 697 y = 697
I HwLauncher: FPSMonitor [Launcher , dispatchTouchEvent begin, false, true] up event x = 697 y = 697
I HwLauncher: FPSMonitor snapToPage whichPage = 2 delta = -1 duration = 550
I HwLauncher: FPSMonitor [PagedView , onIntercept] up event x = 697 y = 697
I HwLauncher: FPSMonitor [Launcher , dispatchTouchEvent end, false, true] up event x = 697 y = 697
W ResourceType: No known package when getting name for resource number 0x9c020200
I HwLauncher: Launcher onclick begin com.huawei.android.launcher.BubbleTextView{39e53f77 VFED..CL ...P.... 528,120-792,399 #9c020200}
I HwLauncher: Launcher.Utilities startActivitySafely useLaunchAnimation begin startActivity()
I K3V3CpuGovernorPolicy: set scene Hmp policy : 300 , 150
I HwLauncher: Launcher.Utilities startActivitySafely useLaunchAnimation end startActivity()
I HwLauncher: Launcher onclick end
I HwLauncher: Launcher onPause()
I HwLauncher: Launcher.MotionManager stopMotionAppsReco 402
I HwLauncher: Launcher.MotionManager stopMotionAppsReco 403
W HwLauncher: Launcher.MotionManager stopMotionAppsReco service flg 402 is unavailable
W HwLauncher: Launcher.MotionManager stopMotionAppsReco service flg 403 is unavailable
I art : Late-enabling -Xcheck:jni
I View : ssignParent(ViewParent parent) parent is: android.view.ViewRootImpl@26e8f389
I [Gralloc]: alloc w[1080] h[1920] format[1] usage[2355]
I [Gralloc]: alloc succ handle[0xb80a6778] stride[1120]
I [Gralloc]: alloc w[1080] h[1920] format[1] usage[3]
I [Gralloc]: alloc succ handle[0xb8044e70] stride[1120]
I HwLauncher: Launcher onStop()
I HwLauncher: Launcher dismissDialog
I HwLauncher: Launcher dismissDialog
I HwLauncher: Launcher dynamicIconsUnregister
I HwLauncher: DynamicUpdater unregisterReceiver
I PhoneStatusBar: shouldTranslucent:true
I PhoneStatusBar: hw_status_bar_operators = true, setSystemUIVisibily(SHOW_OPERATOR = false)
I HwLauncher: DynamicIcon onPause isvisible = true mAttachedToWindow:true mWindowVisible:truecom.android.deskclock
I HwLauncher: DynamicUpdater unregisterReceiver
I HwLauncher: DynamicIcon onPause isvisible = true mAttachedToWindow:true mWindowVisible:truecom.android.calendar
I HwLauncher: DynamicUpdater unregisterReceiver
I HwSystemManager: AppLockService:applock password not initial or function is closed
I HwLauncher: DynamicIcon onPause isvisible = true mAttachedToWindow:false mWindowVisible:falsecom.huawei.android.totemweather
I HwLauncher: DynamicIcon onVisibilityChanged 4 - com.android.deskclock
I HwLauncher: DynamicIcon onVisibilityChanged 4 - com.android.calendar
I HwLauncher: Launcher onWindowVisibilityChanged visibility = 8
I HwLauncher: DynamicIcon onWindowVisibilityChanged 8 - com.android.deskclock
I HwLauncher: DynamicIcon onWindowVisibilityChanged 8 - com.android.calendar
I HwSystemManager: AppLockService:applock password not initial or function is closed
I HwSystemManager: AppManager:getNetAppInfoFromDB cursor lenth = 1
I MultiDex: VM with version 2.1.0 has multidex support
I MultiDex: install
I MultiDex: VM has multidex support, MultiDex support library is disabled.
I HwCust : Constructor found for class android.app.HwCustApplicationPackageManagerImpl
I CachedDir: file changed, refill cache - 1357
W PG Utils: set mRatioMinBrightness to default value for other product
W PG Utils: mRatioMinBrightness = 35
W PGApi_client: recv actoionId = 10000, action = com.huawei.pgmng.PGAction@1188d995 actionId =10000 pkg =com.gluonapplication3 extend1 =1907 extend2 = flag =3 type =1
I AudioEffectLowPowerImpl: handle default mActionId = 10000, action = com.huawei.pgmng.PGAction@1188d995 actionId =10000 pkg =com.gluonapplication3 extend1 =1907 extend2 = flag =3 type =1
I View : ssignParent(ViewParent parent) parent is: android.view.ViewRootImpl@3cb24db8
I OpenGLRenderer: Initialized EGL, version 1.4
I [Gralloc]: alloc w[1080] h[1920] format[1] usage[2816]
I [Gralloc]: alloc succ handle[0xb8058cc8] stride[1120]
I [Gralloc]: alloc w[1080] h[1920] format[1] usage[2816]
I [Gralloc]: alloc succ handle[0xb81e4ec0] stride[1120]
I [Gralloc]: alloc w[1080] h[1920] format[1] usage[2816]
I [Gralloc]: alloc succ handle[0xb8006808] stride[1120]
I System.out: javax.xml.stream.XMLEventFactory=com.sun.xml.stream.events.ZephyrEvent...
I System.out: prism.text=native
I System.out: java.vendor.url=http://www.android.com/
I System.out: java.ext.dirs=
I System.out: line.separator=
I System.out: file.encoding=UTF-8
I System.out: java.runtime.version=0.9
I System.out: prism.dirtyopts=true
I System.out: user.name=root
I System.out: java.compiler=
I System.out: android.icu.unicode.version=6.3
I System.out: javax.xml.stream.XMLOutputFactory=com.sun.xml.stream.ZephyrWriterFactory
I System.out: prism.debugfonts=true
I System.out: com.sun.javafx.gestures.rotate=true
I System.out: java.version=0
I System.out: android.icu.library.version=53.1.0.1
I System.out: use.egl=true
I System.out: embedded=monocle
I System.out: com.sun.javafx.gestures.scroll=true
I System.out: prism.lcdtext=false
I System.out: os.arch=armv7l
I System.out: java.io.tmpdir=/data/data/com.gluonapplication3/cache
I System.out: glass.platform=Monocle
I System.out: android.zlib.version=1.2.8
I System.out: user.language=fi
I System.out: java.vm.version=2.1.0
I System.out: com.sun.javafx.isEmbedded=true
I System.out: javax.xml.stream.XMLInputFactory=com.sun.xml.stream.ZephyrParserFactory
I System.out: prism.glDepthSize=16
I System.out: path.separator=:
I System.out: java.runtime.name=Android Runtime
I System.out: java.specification.version=0.9
I System.out: user.dir=/
I System.out: prism.maxTextureSize=2048
I System.out: java.vm.specification.vendor=The Android Project
I System.out: com.sun.javafx.gestures.zoom=true
I System.out: java.vm.name=Dalvik
I System.out: log.lens=FINEST
I System.out: java.vm.specification.version=0.9
I System.out: user.home=
I System.out: java.specification.name=Dalvik Core Library
I System.out: file.separator=/
I System.out: java.library.path=/vendor/lib:/system/lib
I System.out: user.variant=
I System.out: os.version=3.10.74-gc69e6c2
I System.out: java.boot.class.path=/system/framework/core-libart.jar:/sy...
I System.out: DALVIK.prism.verbose=true
I System.out: java.vm.specification.name=Dalvik Virtual Machine Specification
I System.out: javafx.platform=android
I System.out: glass.lens=eglfb
I System.out: user.region=FI
I System.out: os.name=Linux
I System.out: java.class.path=.
I System.out: prism.verbose=true
I System.out: prism.vsync=false
I System.out: java.specification.vendor=The Android Project
I System.out: java.vm.vendor=The Android Project
I System.out: prism.allowhidpi=true
I System.out: java.vendor=The Android Project
I System.out: http.agent=Dalvik/2.1.0 (Linux; U; Android 5.1.1...
I System.out: android.icu.cldr.version=25.0
I System.out: android.openssl.version=OpenSSL 1.0.1k 8 Jan 2015
I System.out: java.home=/system
I System.out: java.vm.vendor.url=http://www.android.com/
I System.out: java.class.version=50.0
I System.out: Prism pipeline init order: es2
I System.out: Using native-based Pisces rasterizer
I System.out: Using dirty region optimizations
I System.out: Using system sized mask for primitives
I System.out: Not forcing power of 2 sizes for textures
I System.out: Using hardware CLAMP_TO_ZERO mode
I System.out: Opting in for HiDPI pixel scaling
I System.out: Prism pipeline name = com.sun.prism.es2.ES2Pipeline
I System.out: Loading ES2 native library ... prism_es2_monocle
E art : dlopen("/vendor/lib/libprism_es2_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libprism_es2_monocle.so" not found
E art : dlopen("/system/lib/libprism_es2_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libprism_es2_monocle.so" not found
I System.out: succeeded.
I System.out: GLFactory using com.sun.prism.es2.MonocleGLFactory
E art : dlopen("/vendor/lib/libglass_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libglass_monocle.so" not found
E art : dlopen("/system/lib/libglass_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libglass_monocle.so" not found
I GLASS : I have to Call dlopen libGLESv2.so
I GLASS : handle = 0xb6c87004
I GLASS : I have to Call dlopen libEGL.so
I GLASS : handle = 0xb6f01bd4
I GLASS : Binding to libactivity.so
I GLASS : GetNativeWindow = 0xb3c68d05, getDensitiy = 0xb3c68d11
I System.out: (X) Got class = class com.sun.prism.es2.ES2Pipeline
I System.out: Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline
I View : ssignParent(ViewParent parent) parent is: null
I ActivityManager: Displayed com.gluonapplication3/javafxports.android.FXActivity: +514ms
I View : ssignParent(ViewParent parent) parent is: null
I DENSITY : GETDENSITY, answer = 3.000000
I System.out: Maximum supported texture size: 8192
I System.out: Maximum texture size clamped to 2048
I System.out: Non power of two texture support = true
I System.out: Maximum number of vertex attributes = 16
I System.out: Maximum number of uniform vertex components = 4096
I System.out: Maximum number of uniform fragment components = 4096
I System.out: Maximum number of varying components = 60
I System.out: Maximum number of texture units usable in a vertex shader = 16
I System.out: Maximum number of texture units usable in a fragment shader = 16
I System.out: Graphics Vendor: ARM
I System.out: Renderer: Mali-T624
I System.out: Version: OpenGL ES 3.1
I System.out: register device done
W System.err: vsync: false vpipe: true
I System.out: [MON] Create device
I System.out: [MON] Create device done, add done
E art : dlopen("/vendor/lib/libjavafx_font.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libjavafx_font.so" not found
E art : dlopen("/system/lib/libjavafx_font.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libjavafx_font.so" not found
W System.err: Loading FontFactory com.sun.javafx.font.freetype.FTFactory
W System.err: Subpixel: enabled
E art : dlopen("/vendor/lib/libjavafx_font_freetype.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libjavafx_font_freetype.so" not found
E art : dlopen("/system/lib/libjavafx_font_freetype.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libjavafx_font_freetype.so" not found
W System.err: Freetype2 Loaded (version 2.5.0)
W System.err: LCD support Enabled
W art : Before Android 4.1, method void com.sun.javafx.scene.transform.TransformUtils$ImmutableTransform.ensureCanTransform2DPoint() would have incorrectly overridden the package-private method in javafx.scene.transform.Transform
W javafx.scene.Scene: System can't support antiAliasing
E javafx : Shader compile log: 0:79: P0001: Extension directive must occur before any non-preprocessor tokens
E javafx : 0:138: P0001: Extension directive must occur before any non-preprocessor tokens
E javafx : 0:194: P0001: Extension directive must occur before any non-preprocessor tokens
E javafx : 0:250: P0001: Extension directive must occur before any non-preprocessor tokens
E javafx :
W System.err: java.lang.RuntimeException: Error creating fragment shader
W System.err: at com.sun.prism.es2.ES2Shader.createFromSource(ES2Shader.java:141)
W System.err: at com.sun.prism.es2.ES2PhongShader.getShader(ES2PhongShader.java:177)
W System.err: at com.sun.prism.es2.ES2Context.getPhongShader(ES2Context.java:122)
W System.err: at com.sun.prism.es2.ES2Context.renderMeshView(ES2Context.java:451)
W System.err: at com.sun.prism.es2.ES2MeshView.render(ES2MeshView.java:119)
W System.err: at com.sun.javafx.sg.prism.NGShape3D.renderMeshView(NGShape3D.java:179)
W System.err: at com.sun.javafx.sg.prism.NGShape3D.renderContent(NGShape3D.java:201)
W System.err: at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
W System.err: at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
W System.err: at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:235)
W System.err: at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:576)
W System.err: at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2053)
W System.err: at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1945)
W System.err: at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:477)
W System.err: at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:330)
W System.err: at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
W System.err: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
W System.err: at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:279)
W System.err: at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
W System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
W System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
W System.err: at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
W System.err: at java.lang.Thread.run(Thread.java:831)
I K3V3CpuGovernorPolicy: close previously scene Hmp policy : 300 , 150
I MQoS : MSG_QUERY_TCP_INFO called,count:2174
This is what I got from adb logcat ( thanks for the instructions how to get it from a device ). I do not know how to go around solving this. I can't find any methods involving shaders or any info about Shape3D object shaders which seem to be causing the problem.
I noticed that the build.gradle for the sample program had ''jfxmobile-plugin:1.0.6'' by default. I changed this to 1.0.7 but the problem still persists. The ''main'' project had 1.0.7 in the build.gradle all along. Updated with a new stacktrace in case of changes due to the change to 1.0.7.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.0.7'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
}
mainClassName = 'com.gluonapplication3.GluonApplication3'
jfxmobile {
android {
manifest = 'src/android/AndroidManifest.xml'
androidSdk = 'dirHavingSDK/AndroidSDK'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
}
}
Upvotes: 3
Views: 559
Reputation: 45476
JavaFX3D works on Android using JavaFXPorts, as you can see here.
If you find a black screen, first you need to find out what could be the reason. Usually, depending on the type of device, memory could be an issue.
With your mobile connected to your PC, and with debugging options enabled (go to Settings, Developer options, set USB debugging enabled), go to command line and run:
adb logcat -v threadtime
Now run your app and try to find in the output an exception.
If you happen to find a java.lang.StackOverflowError
check this answer for a solution, apply it and try again.
Other issue you may find is that your device doesn't support 3D conditional feature.
For other cases, try to solve it or post the relevant parts so we can help.
EDIT
Based on the stacktrace posted by the OP, the exception shows a problem that has been reported when updating from Android 5.1.1 to 6.0, since the latest drivers on Android are much more strict in compiling shaders.
A fix for this issue has been already created here, and will be available with the javafxports version 8.60.7.
Upvotes: 2