简体   繁体   English

Dalvikvm-无法解析静态字段[Noclassdeferror]-Android

[英]Dalvikvm - Unable to resolve static field [Noclassdeferror] - Android

I am currently trying to load a class from another project, but it gives me this error in run-time and not compile time: 我目前正在尝试从另一个项目中加载类,但是它在运行时而不是编译时给了我这个错误:

VFY: unable to resolve static field 840 (Read) in Lshared/TestingMode;

Caused by: java.lang.NoClassDefFoundError: shared.TestingMode

And this is the class : 这是课程:

public enum TestingMode {
Read,
Write}

I have imported the projects and fixed the Java Build Path so there are no compile errors. 我已经导入了项目并修复了Java Build Path,因此没有编译错误。

Instead creating enum, create a public class, its members are in public static final variables and access it from class name. 而是创建枚举,创建一个公共类,其成员位于公共静态最终变量中,并从类名访问它。

Refer this answer https://stackoverflow.com/a/4822906/603233 请参阅此答案https://stackoverflow.com/a/4822906/603233

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM