I am trying to call an activity which is located in an external android library.
I have two projects in my eclipse :
-SuperApp (contains MainActivity which has a “Start Calculator Activity” button)
-AdditionLibrary (contains a CalculatorActivity which has a “This is the calculator activity” TextView)
Here are the source code for the activities : https://gist.github.com/poiuytrez/4714770
If I reference the application from the SuperApp using the project properties->Android->Library
http://tinypic.com/r/2v31s8z/6
The app works fine.
If I export the jar of AdditionLibrary (http://tinypic.com/r/30m9wld/6) to add it in the libs folder of SuperApp, and then add the jar in the Java Build Path (http://tinypic.com/r/2efksk0/6), when I launch the app I have the following issue :
"android.content.res.Resources$NotFoundException".
http://tinypic.com/r/2hnbb6q/6
I have looked everywhere but I do not find the root cause of the issue.
Answer
If you are adding jar file into your project, then you need to all the resources used in the library project.
Including menu, drawable, layout etc..
For Example :
This is used in your CalculatorActivity.java
file :
getMenuInflater().inflate(R.menu.activity_calculator, menu);
so, you need to add menu file called activity_calculator.xml
to your SuperApp
Application.