public class PropHolder {
public static Properties prop;
static {
//code for loading properties from file
}
}
// Referencing the class somewhere else:
Properties prop = PropHolder.prop;
propolder是我自己的一个类。类驻留在主类的同一个JAR文件中。所以这不应该,因为类路径中缺少任何JAR。
当我通过JAR tf myjarfile查看JAR文件时,我可以看到propolder .class列在那里。
顺便说一句:代码在我的本地机器上运行良好。但是当我将它与一些脚本一起部署到Linux服务器上时就无法工作了。所以我认为这不是代码的问题。
但出于某种原因。部署过程很难跟踪。
有什么问题吗?
我有同样的异常-但只是在调试模式下运行,
这就是我解决问题的方法(在3天之后):
在构建中。Gradle我有:
“multiDexEnabled true”设置在defaultConfig部分。
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 15
targetSdkVersion 28
versionCode 5123
versionName "5123"
// Enabling multidex support.
multiDexEnabled true
}
但显然这还不够。
但当我改变了:
public class MyAppClass extends Application
to:
public class MyAppClass extends MultiDexApplication
这就解决了问题。
希望这能帮助到一些人
我有同样的异常-但只是在调试模式下运行,
这就是我解决问题的方法(在3天之后):
在构建中。Gradle我有:
“multiDexEnabled true”设置在defaultConfig部分。
defaultConfig {
applicationId "com.xxx.yyy"
minSdkVersion 15
targetSdkVersion 28
versionCode 5123
versionName "5123"
// Enabling multidex support.
multiDexEnabled true
}
但显然这还不够。
但当我改变了:
public class MyAppClass extends Application
to:
public class MyAppClass extends MultiDexApplication
这就解决了问题。
希望这能帮助到一些人