[英]referring Android project to another android project
I have a Android project A which is not a library project. 我有一个不是库项目的Android项目A。 I have another Android Project Main with refers project A (by:Project properties -> Java build path -> projects tab -> Add).
我有另一个Android Project Main,其中包含了引用项目A(作者:项目属性-> Java构建路径->项目标签->添加)。 So I can access all the classes (Fragments, Activity) of Project A from Main Project.
因此,我可以从主项目访问项目A的所有类(片段,活动)。 However while running the project Main it throws an run time exception of
java.lang.noclassdeffounderror
. 但是,在运行项目Main时,它将引发
java.lang.noclassdeffounderror
的运行时异常。 Is there any way to resolve the issue without making the Project A as library project. 有没有解决方法,而无需将Project A作为库项目解决。
I am using roboguice
in both of my project. 我在两个项目中都使用了
roboguice
。 So If I will make project A as library, all the resources created inside R.java
file in project A will become non-final and they will not be constants any more. 因此,如果我将项目A设为库,那么在项目A的
R.java
文件内部创建的所有资源将变为非最终资源,它们将不再是常量。 Moreover I am using Roboguice
in both of my projects.So declaring @InjectView(R.id.view_di)
will give compile error in this case as it needs constants. 而且我在两个项目中都使用了
Roboguice
,所以在这种情况下声明@InjectView(R.id.view_di)
会产生编译错误,因为它需要常量。 On top of this we have one annotation interface which sets the header name and header background in each fragments which takes only constants as parameter. 最重要的是,我们有一个注释接口,该接口在每个片段中设置标头名称和标头背景,仅使用常量作为参数。
If we want to add library project or sub projects in Android studio project, we have to follow these steps, 如果要在Android Studio项目中添加库项目或子项目,则必须执行以下步骤,
So that we can add library project to main project. 这样我们就可以将库项目添加到主项目中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.