Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/225.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JavaFX Shape3D对象在Android手机上不工作_Java_Android_Javafx_Javafxports_Gluon - Fatal编程技术网

JavaFX Shape3D对象在Android手机上不工作

JavaFX Shape3D对象在Android手机上不工作,java,android,javafx,javafxports,gluon,Java,Android,Javafx,Javafxports,Gluon,我无法在我的Android手机上使用Shape3D对象,例如简单的球体或网格视图。我已经使用用于NetBeans 8.0.2的Gluon插件为我的手机创建了一些小应用程序,这是我第一次使用Shape3D对象 import javafx.application.Application; import javafx.geometry.Rectangle2D; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import

我无法在我的Android手机上使用Shape3D对象,例如简单的球体或网格视图。我已经使用用于NetBeans 8.0.2的Gluon插件为我的手机创建了一些小应用程序,这是我第一次使用Shape3D对象

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();
    }

}
上面的示例应用程序(来自javafxports示例)在我的PC上运行良好,但当我编译应用程序(任务->android->android)并将其安装到我的设备(任务->android->AndroidStall)上时,它确实安装了,但仅在启动时显示黑屏

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
这是我从adb logcat获得的信息(感谢您提供如何从设备获取它的说明)。我不知道如何解决这个问题。我找不到任何涉及着色器的方法,也找不到任何有关Shape3D对象着色器的信息,这似乎是导致问题的原因

我注意到示例程序的build.gradle默认为“jfxmobile-plugin:1.0.6”。我将其更改为1.0.7,但问题仍然存在。“主”项目始终在build.gradle中使用1.0.7。如果由于1.0.7的更改而发生更改,则使用新的stacktrace进行更新

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')
    }
}

正如您所看到的,JavaFX3D使用JavaFXPorts在Android上工作

如果你发现一个黑屏,首先你需要找出原因。通常,根据设备的类型,内存可能是一个问题

将手机连接到PC并启用调试选项(转到“设置”、“开发人员选项”、“设置USB调试已启用”),转到命令行并运行:

adb logcat -v threadtime
现在运行应用程序并尝试在输出中查找异常

如果您碰巧发现一个
java.lang.StackOverflowerError
检查此解决方案,应用它并重试

您可能会发现的另一个问题是,您的设备不支持3D条件功能

对于其他情况,请尝试解决它或张贴相关部分,以便我们能够提供帮助

编辑

根据OP发布的stacktrace,异常显示了从Android 5.1.1更新到6.0时报告的一个问题,因为Android上的最新驱动程序在编译着色器方面要严格得多


此问题的修复程序已经创建,将在javafxports版本8.60.7中提供。

添加了来自adb logcat的异常。很抱歉响应缓慢。请您发布与该应用程序相关的完整stacktrace(或其链接)。它的第一部分包含了有关所用驱动程序的相关数据。更新了文章,提供了更为可靠的stacktrace。我认为这一切都与该应用程序有关。你能发布你正在使用的jfxmobile插件的哪个版本吗?也许它不相关,但为什么你需要该项目的其他依赖项?那些是什么罐子?我用的是华为荣誉6。