0

I have a Android project A which is not a library project. I have another Android Project Main with refers project A (by:Project properties -> Java build path -> projects tab -> Add). So I can access all the classes (Fragments, Activity) of Project A from Main Project. However while running the project Main it throws an run time exception of java.lang.noclassdeffounderror. Is there any way to resolve the issue without making the Project A as library project.

I am using roboguice in both of my project. 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. 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. 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.

TDG
  • 5,909
  • 3
  • 30
  • 51

1 Answers1

0

If we want to add library project or sub projects in Android studio project, we have to follow these steps,

  1. File - Project structure
  2. Click green color plus button at top left corner to add new module to project.
  3. We have to select import existing project, so that other project is added as separate module. If you need to add as library project,
  4. Select Dependencies - Click green color plus button at top right corner - Select module dependency from drop dox.

So that we can add library project to main project.

Jayaprakash
  • 101
  • 5
  • Actually I am using Eclipse as IDE not Android studio – AmritLalSahu Aug 09 '15 at 13:08
  • For Eclipse, Go to properties --> Java Build path --> Select project tab -- > Click Add at right side of dialog. After that click the check box of project. As usual build & clean both projects. You can try it out, if you find any queries please let me know.. – Jayaprakash Aug 10 '15 at 05:07