Marian López
Marian López

Reputation: 37

JavaFXPorts doesn't load a second activity

I have modified the project kokos of javafxports and android to make a javafx application on android and when I try to load the second activity, it closes and returns to the main activity. There are no compilation errors in the debug file:

29 18829 V DalvikLauncher: preloader class: [null]

12-11 17:49:36.031 18829 18829 V DalvikLauncher: javafx application class: [class javafx.application.Application]

12-11 17:49:36.031 18829 18829 V DalvikLauncher: javafx launcher class: [class com.sun.javafx.application.LauncherImpl]

12-11 17:49:36.031 18829 18829 V DalvikLauncher: launch application method: [public static void com.sun.javafx.application.LauncherImpl.launchApplication(java.lang.Class,java.lang.Class,java.lang.String[])]

12-11 17:49:36.031 18829 18829 V FXEntity: Called Surface changed [1280, 727], format 4

12-11 17:49:36.031 18829 18829 V FXEntity: Called Surface redraw needed

12-11 17:49:36.051 18829 18829 V FXEntity: Called Surface redraw needed

12-11 17:49:36.071 18829 18856 I System.out: Prism pipeline init order: es2

12-11 17:49:36.071 18829 18856 I System.out: Using native-based Pisces rasterizer

12-11 17:49:36.071 18829 18856 I System.out: Using dirty region optimizations

12-11 17:49:36.071 18829 18856 I System.out: Using system sized mask for primitives

12-11 17:49:36.071 18829 18856 I System.out: Not forcing power of 2 sizes for textures

12-11 17:49:36.071 18829 18856 I System.out: Using hardware CLAMP_TO_ZERO mode

12-11 17:49:36.071 18829 18856 I System.out: Opting in for HiDPI pixel scaling

12-11 17:49:36.081 18829 18857 I System.out: Prism pipeline name = com.sun.prism.es2.ES2Pipeline

12-11 17:49:36.081 18829 18857 I System.out: Loading ES2 native library ... prism_es2_monocle

12-11 17:49:36.091 18829 18857 E art : dlopen("/vendor/lib/libprism_es2_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libprism_es2_monocle.so" not found

12-11 17:49:36.091 18829 18857 E art : dlopen("/system/lib/libprism_es2_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libprism_es2_monocle.so" not found

12-11 17:49:36.111 573 597 I ActivityManager: Displayed hidralab.Hidrasmartcm_app_2/hidralab.hidrasmartcm_app_2.MainActivity: +983ms

12-11 17:49:36.111 18829 18857 D houdini : [18857] Added shared library /data/app/hidralab.Hidrasmartcm_app_2-2/lib/arm/libprism_es2_monocle.so for ClassLoader by Native Bridge.

12-11 17:49:36.111 18829 18857 I System.out: succeeded.

12-11 17:49:36.111 18829 18857 I System.out: GLFactory using com.sun.prism.es2.MonocleGLFactory

12-11 17:49:36.121 18829 18857 E art : dlopen("/vendor/lib/libglass_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libglass_monocle.so" not found

12-11 17:49:36.131 18829 18857 E art : dlopen("/system/lib/libglass_monocle.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libglass_monocle.so" not found

12-11 17:49:36.131 573 588 W InputMethodManagerService: Got RemoteException sending setActive(false) notification to pid 18792 uid 10301

12-11 17:49:36.131 18829 18857 D houdini : [18857] Added shared library /data/app/hidralab.Hidrasmartcm_app_2-2/lib/arm/libglass_monocle.so for ClassLoader by Native Bridge.

12-11 17:49:36.141 18829 18848 V FXEntity: notify_glassHasStarted called in FXActivity. register device now.

12-11 17:49:36.191 18829 18857 E libEGL : eglMakeCurrent:786 error 3009 (EGL_BAD_MATCH)

12-11 17:49:36.201 18829 18857 I System.out: (X) Got class = class com.sun.prism.es2.ES2Pipeline

12-11 17:49:36.201 18829 18857 I System.out: Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline

12-11 17:49:36.251 18829 18857 I System.out: Maximum supported texture size: 4096

12-11 17:49:36.251 18829 18857 I System.out: Maximum texture size clamped to 2048

12-11 17:49:36.261 18829 18857 I System.out: Non power of two texture support = true

12-11 17:49:36.261 18829 18857 I System.out: Maximum number of vertex attributes = 16

12-11 17:49:36.261 18829 18857 I System.out: Maximum number of uniform vertex components = 1024

12-11 17:49:36.261 18829 18857 I System.out: Maximum number of uniform fragment components = 1024

12-11 17:49:36.261 18829 18857 I System.out: Maximum number of varying components = 48

12-11 17:49:36.261 18829 18857 I System.out: Maximum number of texture units usable in a vertex shader = 0

12-11 17:49:36.261 18829 18857 I System.out: Maximum number of texture units usable in a fragment shader = 8

12-11 17:49:36.261 18829 18857 I System.out: Graphics Vendor: ARM

12-11 17:49:36.261 18829 18857 I System.out: Renderer: Mali-450 MP

12-11 17:49:36.261 18829 18857 I System.out: Version: OpenGL ES 2.0

12-11 17:49:36.271 18829 18848 I System.out: register device done

12-11 17:49:36.281 18829 18859 W System.err: vsync: false vpipe: true

12-11 17:49:36.281 18829 18859 I System.out: [MON] Create device

12-11 17:49:36.291 18829 18859 I System.out: [MON] Create device done, add done

12-11 17:49:36.451 18829 18842 I art : Background sticky concurrent mark sweep GC freed 4094(153KB) AllocSpace objects, 1(40KB) LOS objects, 3% free, 7MB/7MB, paused 6.418ms total 26.688ms

12-11 17:49:36.501 18829 18842 I art : Background partial concurrent mark sweep GC freed 3710(130KB) AllocSpace objects, 6(534KB) LOS objects, 35% free, 7MB/11MB, paused 6.120ms total 48.173ms

12-11 17:49:36.581 18829 18859 E art : dlopen("/vendor/lib/libjavafx_font.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libjavafx_font.so" not found

12-11 17:49:36.581 18829 18859 E art : dlopen("/system/lib/libjavafx_font.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libjavafx_font.so" not found

12-11 17:49:36.581 18829 18859 D houdini : [18859] Added shared library /data/app/hidralab.Hidrasmartcm_app_2-2/lib/arm/libjavafx_font.so for ClassLoader by Native Bridge.

12-11 17:49:36.591 18829 18859 W System.err: Loading FontFactory com.sun.javafx.font.freetype.FTFactory

12-11 17:49:36.591 18829 18859 W System.err: Subpixel: enabled

12-11 17:49:36.601 18829 18859 E art : dlopen("/vendor/lib/libjavafx_font_freetype.so", RTLD_LAZY) failed: dlopen failed: library "/vendor/lib/libjavafx_font_freetype.so" not found

12-11 17:49:36.601 18829 18859 E art : dlopen("/system/lib/libjavafx_font_freetype.so", RTLD_LAZY) failed: dlopen failed: library "/system/lib/libjavafx_font_freetype.so" not found

12-11 17:49:36.601 18829 18859 D houdini : [18859] Added shared library /data/app/hidralab.Hidrasmartcm_app_2-2/lib/arm/libjavafx_font_freetype.so for ClassLoader by Native Bridge.

12-11 17:49:36.611 18829 18859 W System.err: Freetype2 Loaded (version 2.5.0)

12-11 17:49:36.611 18829 18859 W System.err: LCD support Enabled

12-11 17:49:36.671 18829 18859 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

12-11 17:49:37.351 18829 18859 W art : Before Android 4.1, method double javafx.scene.text.TextFlow.computeChildPrefAreaHeight(javafx.scene.Node, javafx.geometry.Insets) would have incorrectly overridden the package-private method in javafx.scene.layout.Region

12-11 17:49:37.351 18829 18859 W art : Before Android 4.1, method double javafx.scene.text.TextFlow.computeChildPrefAreaWidth(javafx.scene.Node, javafx.geometry.Insets) would have incorrectly overridden the package-private method in javafx.scene.layout.Region

12-11 17:49:37.521 662 662 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'

12-11 17:49:37.681 18829 18857 I System.out: max rectangle texture cell size = 62

12-11 17:49:37.731 18829 18857 I System.out: wrap rectangle texture = 2 x 2

12-11 17:49:37.741 18829 18857 I System.out: ES2ResourceFactory: Prism - createStockShader: AlphaTexture_Color.frag

12-11 17:49:37.761 18829 18857 I System.out: ES2ResourceFactory: Prism - createStockShader: FillRoundRect_Color.frag

12-11 17:49:37.781 18829 18857 I System.out: ES2ResourceFactory: Prism - createStockShader: FillRoundRect_LinearGradient_PAD.frag

12-11 17:49:37.801 18829 18857 I System.out: ES2ResourceFactory: Prism - createStockShader: Solid_TextureRGB.frag

12-11 17:49:37.811 18829 18857 I System.out: ES2ResourceFactory: Prism - createStockShader: Mask_TextureSuper.frag

12-11 17:49:40.531 662 662 D wpa_supplicant: wlan0: Control interface command 'SIGNAL_POLL'

The part that I have modified of the project is in the repository: https://github.com/MarianLN/Pruebas-JAVAFXPORTS-ANDROID/tree/master

Part of the app folder and the build.gradle of the project.

What error can it be? Thanks in advance.

Upvotes: 0

Views: 214

Answers (1)

José Pereda
José Pereda

Reputation: 45476

I've just modified the build.gradle file, according to the version 25 I have installed in my system.

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'me.tatarka:gradle-retrolambda:3.7.0'
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath 'org.javafxports:jfxmobile-plugin:1.3.10'
    }
}
repositories {
    jcenter()
}
apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion '25.0.3'
    dexOptions {
        preDexLibraries = false
        additionalParameters = ['--core-library']
    }
    defaultConfig {
        applicationId "hidralab.Hidrasmartcm_app_2"
        minSdkVersion 16
        targetSdkVersion 16
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
    }

    sourceSets {
        main {
            jniLibs.srcDir file("/Users/.../.gradle/caches/modules-2/files-2.1/org.javafxports/dalvik-sdk/8.60.8/.../unpacked/dalvik-sdk/rt/lib")
            assets.srcDirs = ['assets']
        }
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    productFlavors {
    }
}

dependencies {
    compile "com.android.support:appcompat-v7:25.3.1"
    compile 'com.android.support:design:25.3.1'
    testCompile 'junit:junit:4.12'
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile fileTree(include: ['*.jar'], dir: '/Users/.../.gradle/caches/modules-2/files-2.1/org.javafxports/dalvik-sdk/8.60.8/.../unpacked/dalvik-sdk/rt/lib/ext')
    compile 'com.google.android.gms:play-services-maps:11.0.4'
}

After deploying to a Nexus 6 with Android 7.1.1, the second activity shows up fine, and stays all the time.

Since you are using a main JavaFX activity and a pure native Android activity, the only way to go back is with the back button, and this also works.

As a possible suggestion: have you considered using Gluon Mobile to manage properly the different Views instead? It can be combined easily with Gluon Maps (over OpenStreetMap), and it will also work on iOS.

The 'kokos' project is more a proof of concept, I don't think doing a JavaFX application on mobile over an Android project will be easy at all in the long term. If you really need JavaFX, then consider a pure JavaFX app with JavaFXPorts/Gluon Mobile. Existing Android and iOS native frameworks can be easily combined (see Charm Down library for existing services here).

Upvotes: 0

Related Questions