I am working on a JavaFX mobile project which uses AdoptOpenJDK 11.0.4-hotspot. When I run the app on Mobile, the TextField doesn't draw android soft keyboard if it is clicked for the second time. It is same as this issue. I am trying the accepted answer in that thread where we have to create 'AndroidKeyboardService' which uses some android specific classes. For that, I added 'android.jar' in project's classpath. After that I stumbled upon another issue. Many imports started showing errors like The package java.util is accessible from more than one module: <unnamed>, java.base
, The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
. Some of the StackOverflow answers suggested moving the library from modulepath to classpath. But, I've already placed that library in classpath and the imports issue still occurs. How do I resolve this issue?
Asked
Active
Viewed 693 times
0

Mani kandan
- 51
- 4
-
JavaFXPorts is for Java 1.8. If you want to use JDK 11, you have to migrate your app to the new Client plugin. See https://github.com/gluonhq/client-samples, or a similar question https://stackoverflow.com/questions/61334909/animation-ghosting-on-xxhdpi-android-javafxports-application/ – José Pereda Sep 08 '20 at 10:45
-
Alright, but when I add 'android.jar' in classpath, this error "The package java.util is accessible from more than one module:
, java.base" shows up. How do I resolve it? – Mani kandan Sep 08 '20 at 10:58 -
You don't need to add the `android.jar` to the classpath. There should be only Java code in your main. Attach already has a `KeyboardService`: https://github.com/gluonhq/attach/tree/master/modules/keyboard. – José Pereda Sep 08 '20 at 11:00
-
Does Gluon Attach work with jdk8 based javafx mobile projects too? Because I have another project which uses jdk8 and this keyboard issue occurs in it too. – Mani kandan Sep 08 '20 at 11:12
-
No, JavaFXPorts is for Java 1.8 with Charm Down, the new Client plugin is for JDK 11+ with Gluon Attach. – José Pereda Sep 08 '20 at 11:16
-
In that case, Do I have to create the keyboard service myself as shown in this answer - https://stackoverflow.com/questions/41523778/how-to-make-the-softkeyboard-show-up-again/41526346#41526346 ? – Mani kandan Sep 08 '20 at 11:24
-
For JDK 1.8, yes, you'd need a KeyboardService if you need to access Android API. – José Pereda Sep 08 '20 at 11:26
-
So I have to add 'android.jar' in classpath to use android native classes. Doing so result in this issue. "The package java.util is accessible from more than one module:
, java.base". – Mani kandan Sep 08 '20 at 11:38 -
If you use JDK 1.8 there are no modules. So use JDK 1.8 and follow that question you have linked. – José Pereda Sep 08 '20 at 11:40
-
Actually, our project is bit different. In a single project, we develop both 'desktop' and 'mobile' versions of same app. Mobile app is a subset of desktop app, because it uses the same api requests as dektop app does but only required ones.We use JDK11 while developing for both desktop and mobile app. But when building JDK11 and JDK8 is used for desktop app and mobile app respectively. To resolve this 'keyboard issue' in mobile version I have to add 'android.jar' in project's classpath and this 'module accessibility' issue occurs everywhere. Any possible workaround to handle this issue? – Mani kandan Sep 08 '20 at 12:03
-
@Manikandan Why don't you just invest a little time and streamline your development process to consistently use only JDK11 for desktop and mobile? That way you could completely avoid your problem. – mipa Sep 08 '20 at 12:52