[英]NullPointerException when startActivity from JAR file
I have a child project that must be included in parent project. 我有一个子项目,必须包含在父项目中。 What I did:
我做了什么:
After running parent project it crashes. 运行父项目后,它崩溃。 Callstack says that is NullPointerException on:
调用堆栈说这是NullPointerException在:
final LinearLayout layout = (LinearLayout)findViewById(R.id.layout);
layout .setOnClickListener(this);
This means that layout is null. 这意味着布局为空。
I should mention that running a child project as a single project works perfectly. 我应该提到将子项目作为单个项目运行是完美的。
What did I do wrong? 我做错了什么?
You can not use a .jar file if you "child" project depends on resources files. 如果“子”项目取决于资源文件,则不能使用.jar文件。 You need to import your project as a library (with source code) instead.
您需要将您的项目导入为一个库(带有源代码)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.