Icons not displayed in Gluon Desktop - javafx

I'm new to Gluon mobile and desktop. I started a new project and built it successfully for android and desktop. It ran well without a hitch on the android device. However when I ran it on desktop, the Icons did not appear instead I got a rectangle where they should be. Below is the code for the fxml document.
<?import com.gluonhq.charm.glisten.control.Icon?>
<?import com.gluonhq.charm.glisten.mvc.View?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.effect.DropShadow?>
<?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.layout.VBox?>
<View fx:id="start" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="600.0" prefWidth="350.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.id3editor.views.StartPresenter">
<center>
<VBox alignment="CENTER" prefHeight="200.0" prefWidth="100.0" spacing="15.0" BorderPane.alignment="CENTER">
<children>
<Label fx:id="label" text="Hello JavaFX World!" />
<Button mnemonicParsing="false" onAction="#buttonClick" stylesheets="#start.css" text="Change the World!">
<graphic>
<Icon content="LANGUAGE">
<effect>
<DropShadow />
</effect></Icon>
</graphic>
</Button>
</children>
</VBox>
</center>
</View>
And this is what it looks like on my desktop:
Please I really hope this questions can be answered. I checked and made sure there was no question like it. My apologies if this ends up being a duplicate. Thanks.
Here is the build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.10'
}
}
apply plugin: 'org.javafxports.jfxmobile'
repositories {
jcenter()
maven {
url 'http://nexus.gluonhq.com/nexus/content/repositories/releases'
}
}
mainClassName = 'com.id3editor.Id3editor'
dependencies {
compile 'com.gluonhq:charm:4.4.1'
compile 'com.airhacks:afterburner.mfx:1.6.3'
}
jfxmobile {
downConfig {
version = '3.6.0'
// Do not edit the line below. Use Gluon Mobile Settings in your project context menu instead
plugins 'display', 'lifecycle', 'statusbar', 'storage'
}
android {
manifest = 'src/android/AndroidManifest.xml'
}
ios {
infoPList = file('src/ios/Default-Info.plist')
forceLinkClasses = [
'com.id3editor.**.*',
'com.gluonhq.**.*',
'javax.annotations.**.*',
'javax.inject.**.*',
'javax.json.**.*',
'org.glassfish.json.**.*'
]
}
}
And I get these warnings when running
Gtk-Message: Failed to load module "unity-gtk-module"
Jan 17, 2018 12:40:13 PM com.gluonhq.charm.down.Platform <clinit>
SEVERE: javafx.platform is not defined. Desktop will be assumed by default.
Jan 17, 2018 12:40:14 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFO: Could not load #font-face font [gls:file:/root/.gradle/caches/modules-2/files-2.1/com.gluonhq/charm-glisten/4.4.1/7bdb2fab385f250b2821c206ea669ff65a1c9ad6/charm-glisten-4.4.1.jar!/com/gluonhq/charm/glisten/control/MaterialIcons-Regular.ttf]
Jan 17, 2018 12:40:14 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFO: Could not load #font-face font [gls:file:/root/.gradle/caches/modules-2/files-2.1/com.gluonhq/charm-glisten/4.4.1/7bdb2fab385f250b2821c206ea669ff65a1c9ad6/charm-glisten-4.4.1.jar!/com/gluonhq/charm/glisten/control/Roboto-Regular.ttf]
Jan 17, 2018 12:40:14 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFO: Could not load #font-face font [gls:file:/root/.gradle/caches/modules-2/files-2.1/com.gluonhq/charm-glisten/4.4.1/7bdb2fab385f250b2821c206ea669ff65a1c9ad6/charm-glisten-4.4.1.jar!/com/gluonhq/charm/glisten/control/Roboto-Bold.ttf]
Jan 17, 2018 12:40:15 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
INFO: Could not load #font-face font [gls:file:/root/.gradle/caches/modules-2/files-2.1/com.gluonhq/charm-glisten/4.4.1/7bdb2fab385f250b2821c206ea669ff65a1c9ad6/charm-glisten-4.4.1.jar!/com/gluonhq/charm/glisten/control/Roboto-Medium.ttf]
I am building and running with a 32-bit Linux.

Related

Kotlin app using Admob and Firebase, but the app doesn't run, saying that there is a problem with the Firebase SDK

I made an app using Firebase and Admob, and the Kotlin app, which worked fine, doesn't work after wipe data from the emulator. The error code is as follows.
"The Google Mobile Ads SDK will not integrate with Firebase. Admob/Firebase integration requires the latest Firebase SDK jar, but Firebase SDK is either missing or out of date"
I've tried resetting firebase, but it still won't launch. What's wrong?
The build gradle and manifest are attached below.
build gradle(project)
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.gms:google-services:4.3.13'
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build gradle(module)
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.jym.qb"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
// implementation platform('com.google.firebase:firebase-bom:30.4.1')
implementation platform('com.google.firebase:firebase-bom:31.1.0')
implementation 'com.google.firebase:firebase-firestore-ktx'
implementation 'com.google.android.gms:play-services-ads:19.6.0'
implementation 'com.google.firebase:firebase-auth-ktx:21.1.0'
implementation 'com.google.android.gms:play-services-auth:20.4.0'
}
AndroidManifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.jym.qb">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/Theme.Qb"
android:name=".SharedValue"
>
<activity
android:name=".ManageQuestionActivity"
android:exported="false" />
<activity
android:name=".KeywardActivity"
android:exported="false" />
<activity
android:name=".UpdateActivity"
android:exported="false" />
<activity
android:name=".GetQuestionActivity"
android:exported="false" />
<activity
android:name=".WorkbookActivity"
android:exported="false" />
<activity
android:name=".PartActivity"
android:exported="false" />
<activity
android:name=".ExamActivity"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-xxxxxxxxxxx~xxxxxxxxxxx" />
<meta-data
android:name="preloaded_fonts"
android:resource="#array/preloaded_fonts" />
</application>
</manifest>
After taking a walk to cool off for an hour, the app works normally. Looking at the Google Admob documentation, I found the following:
"Key Point: New test devices typically start serving test ads in your app within 15 minutes, but it can also take up to 24 hours."
While initializing the data of the virtual emulator, it seems that Admob recognizes it as a new mobile phone and delays the time. Could it be that what I was thinking was correct?

com.google.android.material.R Cannot resolve symbol 'R' for BottomNavigationView

I use BottomNavigationView in my App, but I have a problem: in BottomNavigationView.java there is import com.google.android.material.R and R is red and write "Cannot resolve symbol 'R'".
The topics I saw couldn't help me.
What would you recommend for me?
The dependencies:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.yourspeakingclub"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
sourceSets {
main {
java.srcDirs = ['src/main/java', 'src/main/java/Models', 'src/main/java/com/salendor/yourspeakingclub/models']
}
}
buildToolsVersion = '28.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:support-compat'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
testImplementation 'junit:junit:4.13-beta-3'
androidTestImplementation 'androidx.test:runner:1.3.0-alpha02'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0-alpha02'
implementation 'com.google.android.material:material:1.1.0-beta01'
}
The layout:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="#+id/navigation_container_id"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingTop="?android:attr/actionBarSize">
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="#+id/navigation_element"
android:layout_width="wrap_content"
android:layout_height="56dp"
android:layout_gravity="start"
android:background="?android:attr/windowBackground"
app:itemTextColor="#000000"
app:labelVisibilityMode="unlabeled"
app:itemIconTint="#color/colorBlack"
app:menu="#menu/bottom_menu" />
</FrameLayout>
The class definition where is the problem with 'R' is available here: https://github.com/material-components/material-components-android/blob/master/lib/java/com/google/android/material/bottomnavigation/BottomNavigationView.java
Thanks
I experienced this problem when I updated Gradle to the latest version. When I returned to version 3.1.3 the error simply disappeared
change this in your build.graddle (project)
classpath 'com.android.tools.build:gradle:3.1.3'
The error should be resolved by doing Alt+Enter & adding the right import. But I'm guessing this issue came out of nowhere after you had already built & run the project at least once (as it once happened with me).
This could be because you're unable to reference the elements of the XML layout. In this case, try:
Build -> Clean project
.
This resolved my issue. Hopefully, it'll help you too :)
I had the same problem.
Simply updated this tool in build.graddle (project) file
classpath 'com.android.tools.build:gradle:4.1.0'
and it worked !!

Getting an error with an image URL in JavaFX

I saved my PNG folder in same folder which contains the main class
and used that PNG file in an image tag in sample.fxml and tried to display it, which worked fine.
But when I try to map it to a string in main, it shows an error.
I have uploaded the image to show my PNG folder on the left panel.
Sample.fxml
<ImageView fx:id="user1" fitHeight="150.0" fitWidth="100.0" pickOnBounds="true" preserveRatio="true" x="150.0" y="50.0">
<image>
<Image url="#PNG/AceClub.png"/>
</image>
</ImageView>
Main.java
for(int i=0;i<suit.length;i++) {
// ImageStore.cardimagedeck.put(rank[j]+suit[i],new Image("#PNG/"+rank[j]+suit[i]+".png"));
for(int j=0;j<rank.length;j++) {
javafx.scene.image.Image image=new Image("#PNG/AceClub.png");
ImageStore.cardimagedeck.put(rank[j] + suit[i], image);
}
}
Error:
Caused by: java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found
at javafx.graphics/javafx.scene.image.Image.validateUrl(Image.java:1107)
at javafx.graphics/javafx.scene.image.Image.<init>(Image.java:617)
at Card/sample.Main.loadimages(Main.java:35)
at Card/sample.Main.start(Main.java:18)
application screenshot

Firebase Ui auth version 3.2.2 xml errors

I am trying to connect a firebaseUI auth but I keep getting an error with an unknown xml file
Here is my build gradle files:
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 24
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.google.firebase.udacity.friendlychat"
minSdkVersion 16
targetSdkVersion 24
versionCode 1
versionName "1.0"
resConfigs "auto"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'junit:junit:4.12'
compile 'com.android.support:design:24.2.0'
compile 'com.android.support:appcompat-v7:24.2.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.google.firebase:firebase-database:11.8.0'
compile 'com.google.firebase:firebase-auth:11.8.0'
compile 'com.firebaseui:firebase-ui-auth:3.2.2'
}
apply plugin: 'com.google.gms.google-services'
and here is the xml file which appears:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Base.Theme.AppCompat" parent="Base.V26.Theme.AppCompat"/>
<style name="Base.Theme.AppCompat.Light" parent="Base.V26.Theme.AppCompat.Light"/>
<style name="Base.V26.Theme.AppCompat" parent="Base.V23.Theme.AppCompat">
<!-- We can use the platform styles on API 26+ -->
<item name="colorError">?android:attr/colorError</item>
</style>
<style name="Base.V26.Theme.AppCompat.Light" parent="Base.V23.Theme.AppCompat.Light">
<!-- We can use the platform styles on API 26+ -->
<item name="colorError">?android:attr/colorError</item>
</style>
<style name="Base.V26.Widget.AppCompat.Toolbar" parent="Base.V7.Widget.AppCompat.Toolbar">
<item name="android:touchscreenBlocksFocus">true</item>
<item name="android:keyboardNavigationCluster">true</item>
</style>
<style name="Base.Widget.AppCompat.Toolbar" parent="Base.V26.Widget.AppCompat.Toolbar"/>
</resources>
Here are the errors which appear from this:
[:app:generateDebugSources, :app:generateDebugAndroidTestSources, :app:mockableAndroidJar]
Error:(252, 5) error: resource android:attr/keyboardNavigationCluster not found.
Error:(252, 5) error: resource android:attr/fontStyle not found.
Error:(252, 5) error: resource android:attr/font not found.
Error:(252, 5) error: resource android:attr/fontWeight not found.
C:\and-nd-firebase-1.00-starting-point\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml
Error:(36) error: style attribute 'android:attr/autofillHints' not found.
Error:(7) resource android:attr/colorError not found.
Error:(11) resource android:attr/colorError not found.
Error:(15) style attribute 'android:attr/keyboardNavigationCluster' not found.
Error:(18) style attribute 'android:attr/keyboardNavigationCluster' not found.
Error:(24) style attribute 'android:attr/autofillHints' not found.
Error:(28) style attribute 'android:attr/autofillHints' not found.
Error:(32) style attribute 'android:attr/autofillHints' not found.
Error:(36) style attribute 'android:attr/autofillHints' not found.
C:\and-nd-firebase-1.00-starting-point\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml
Error:(250) resource android:attr/keyboardNavigationCluster not found.
Error:(468) resource android:attr/fontStyle not found.
Error:(468) resource android:attr/font not found.
details
Error:Execution failed for task ':app:processDebugResources'.
Failed to execute aapt
Information:BUILD FAILED in 8s
Information:29 errors
Information:0 warnings
Information:See complete output in console
Any help would be much appreciated.
Use version 27.0.2 of the Support libraries:
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
And change:
compileSdkVersion 27 // was 24
You may also want to use the latest version of Glide:
compile 'com.github.bumptech.glide:glide:4.3.1'

Qt Quick does not translate components loaded via Loader

Situation:
Writing a Qt Quick application for embedded Linux system, want to use Qt translation mechnanism. Application shall select language on command coming in via RS232, currently hardcoded to "de" on a system set up for english language. Application loads various masks on command from RS232.
Problem:
Qt Quick translates only the main page (main.qml), but not the pages loaded via the Qt Loader (DEMO.ui.qml). Texts from main.qml are displayed in german, texts from DEMO.ui.qml are displayed untranslated.
I've added a "XX" prefix to all english translations (qml.en.ts), that also does not appear on the screen. So neither english nor german translations are loaded for pages loaded via the Qt Loader.
Clean build after lupdate, lrelease does not help. rm -rf build-$appname-*, build does not help.
Code:
application.cpp:
xlat=new QTranslator();
if (xlat->load(QLocale("de"), "qml", ".", ":/qml/i18n/", ".qm")) {
qDebug()<<"load translator ok";
bool ok=installTranslator(xlat);
//...
} // else error message
// ...
viewer->setSource(QUrl("qrc:/qml/main.qml"));
viewer->showFullScreen();
// ...
main.qml:
import QtQuick 2.0
Rectangle {
Text {
id: loadingMsg
text: qsTr("Loading ...")
// ...
}
Loader {
// ...
source: ""
function loadMask(aMaskId) {
// ...
setSource(gui.urlForMask(aMaskId));
}
}
// ...
}
components/SimpleButton.qml:
import QtQuick 2.0
// ...
Rectangle {
Text {
id: label
text: ""
// ...
}
property alias text: label.text
}
masks/DEMO.ui.qml:
import QtQuick 2.0
import "../components"
//...
SimpleButton {
//...
text: qsTr("Vent.")
}
//...
qml.de.ts:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="de_DE">
<!-- ... -->
<context>
<name>DEMO</name>
<!-- ... --->
<message>
<source>Vent.</source>
<translation>Belüften</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<source>Loading ...</source>
<translation>Lade ...</translation>
</message>
<!-- ... -->
</context>
Renaming DEMO.ui.qml to DEMO.qml did the trick. I guess that the Linguist tools (lupdate, lrelease) and the Qt runtime environment have different ideas of how to convert a filename to a context name.

Resources