- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 javafxports 从 javaFX 项目构建 Android 应用程序。目前,我在移动设备上安装并启动它时遇到问题,它抛出 ConfigurationException。 这是使用该文件的代码:
public class AppConfig extends XMLConfiguration {
/**
*
*/
private static final long serialVersionUID = 550015250032006413L;
private static AppConfig instance;
private static String configFile = "src/main/assets/config.xml";
// Singleton initialiser
static {
instance = new AppConfig(configFile);
}
/**
* Constructor
*
* @param fileName Configuration file name.
*/
private AppConfig(String fileName) {
init(fileName);
}
/**
* Initialize the class.
*
* @param fileName Configuration file name.
*/
private void init(String fileName) {
setFileName(fileName);
try {
load();
} catch (ConfigurationException configEx) {
configEx.printStackTrace();
}
}
这是 gradle 文件:
apply plugin: 'org.javafxports.jfxmobile'
buildscript {
repositories {
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases' }
}
dependencies {
classpath 'org.javafxports:jfxmobile-plugin:1.3.5'
}
}
repositories {
jcenter()
maven { url 'https://oss.sonatype.org/content/repositories/ksoap2-android-releases/' }
}
mainClassName = "com.example.amladzhov.irisandroid.sample.Client.StartApplication"
jfxmobile {
android {
packagingOptions {
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/notice.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/dependencies.txt'
exclude 'META-INF/LGPL2.1'
}
dependencies {
compile 'commons-configuration:commons-configuration:1.6'
compile 'org.apache.commons:commons-exec:1.3'
compile 'commons-discovery:commons-discovery:0.5'
compile 'org.apache.axis:axis:1.4'
compile 'javax.xml.rpc:javax.xml.rpc-api:1.1.1'
//compile 'wsdl4j:wsdl4j:1.6.2'
compile 'org.jdom:jdom:2.0.2'
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.1'
compile group: 'commons-beanutils', name: 'commons-beanutils', version: '1.9.3'
}
}
}
该文件位于
src/main/assets/config.xml
最佳答案
您不能期望 xml 文件会在运行时放置在 src
文件夹下。
但请注意,main
包下的 assets
文件夹不会导出到 Android,因此该文件将无法以任何方式使用。
虽然有一个 src/android/assets
文件夹可用于放置 Android 所需的资源,但需要 Android API 来读取它。
最好的选择是将 xml
文件放在 src/main/resources
下,然后像在 Java 中经常使用 getResources()< 一样加载该文件
.
因此,将该文件放在 src/main/resources/config.xml
下,并替换为:
private static String configFile = "src/main/assets/config.xml";
这样:
private static String configFile = AppConfig.class.getResources("/config.xml").toExternalForm();
关于java - 在 javafxports android 项目中查找配置文件时出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44845996/
我目前正在努力解决可能非常简单的问题:如何将一个 JavaFXPorts 特定项目用作另一个同类项目中的依赖项? 对于纯粹分离的项目,我不知道如何将它们组合起来(不得不承认,我对 Gradle 的了解
我的项目具有语言相关文本的属性文件,这些文本在 ISO-8859-1 中编码(默认从内容类型派生)。它们是使用ResourceBundle读取的。当我在 Android 上运行该应用程序时,我看到不可
请查看图像以获取代码引用: 如果运行上面的代码,TextArea 显示File Exists: false。 请注意:此代码有效:ImageView image = new ImageView(new
您好,我正在尝试开始使用 javafxports 为 Android 构建应用程序,我有 android sdk 和 gradle(尝试使用 2.3 和 2.2)从获取站点的起始页构建简单的应用程序,
我目前正在使用 GluonHQ 和 JavaFXPorts 使用 JavaFX 开发移动应用程序。我的其中一个屏幕包含一个 ListView ,您可以从下面的屏幕截图中看到,该屏幕截图是从我的 iPh
示例代码如下: package com.javafxportslistviewdemo; import com.gluonhq.charm.down.Platform; import com.gluo
我有一个基于 JavaFX 的界面,我正在尝试使用 JavaFXPorts 在多个平台上构建该界面。大多数代码是与平台无关的,但我有一些调用特定于平台的代码的实用程序,例如Android 与桌面上的文
我已经开始尝试获取有关此问题的一些信息(请参阅 here ),但这一次,我创建了一个示例应用程序来展示我的问题(希望以比上次更好的方式)。 在我开始之前,这里是应用程序存储库的链接: https://
我想用 JavaFXPorts 构建一个 JavaFX Android 应用程序和 Kotlin 代码。是否可以在 JavaFXPorts 项目中使用 Kotlin?这是我的示例 Gradle(版
我正在尝试使用 javafxports 从 javaFX 项目构建 Android 应用程序。目前,我在移动设备上安装并启动它时遇到问题,它抛出 ConfigurationException。 这是使
我在将 Javafx 应用程序构建到 Android 时遇到以下异常。 error: Error: No resource found that matches the given name (at
我将使用 sqlite 编写示例代码,它必须适用于 Android 和 IOS(和桌面) 这是我的build.gradle buildscript { repositories {
有没有办法访问 UIViewController,舞台正在运行?据我所知,在 RoboVM 和 Android 上有类似的东西,我们有 FXActivity 来完成这样的任务...... 感谢和问候,
我在使用 JavaFxPorts 在 Android 上保存文件时遇到问题。 我找到了那个链接 here ,但这对我不起作用。 它没有找到接口(interface),我无法使用它。 我的目标是使用 J
我使用 javafxports 和 gradle 在 netbeans 中编写了一个 javafx andoid 应用程序。我将依赖项添加到 gradel,但现在我不知道如何将 jars 添加到我的项
我在开发要移植到 Android 的 Javafx 应用程序时使用了 Netbeans 的 Gluon 插件,我想在 Android 的 Assets 文件夹中添加一些文件,但我找不到它?在哪里放置
我正在尝试使用 JavaFXPorts 和 RoboVM-cocoatouch 但我无法使用 RoboVM 中的原生内容,例如 UIButton。 我的 build.gradle 文件中有以下依赖项:
我想创建一个使用 MySqlDB 连接的应用程序/桌面应用程序。我在 Netbeans 中使用了 Gluon 插件。当我想编译桌面应用程序时,一切正常。但是当我想编译 Android 应用程序时 ->
在 Android 手机上启动我的应用程序时出现以下错误 FATAL EXCEPTION: main Process: ie.murphysoftware.games.magnatron, PID:
我正在尝试使用 javafxports 编写一个简单的 sqlite 代码。 build.gradle: buildscript { repositories { jc
我是一名优秀的程序员,十分优秀!