0

I've built a shared library named com.example.multiplecontacts. This library contains one activity named MultipleContacts. I'd like to use it in another application named com.example.test

I've added the following line to the Test Manifest

<uses-library android:name="com.example.multiplecontacts" android:required="true"/>

But the following error appears

Package com.example.test requires unavailable shared library com.example.multiplecontacts; failing!

I've checked Is Library checkbox in my library and added it as a reference to my application through Properties->Android->Add

What else should I do?

Islam Hassan
  • 1,736
  • 4
  • 26
  • 42

2 Answers2

0

Create a libs folder and put your library in there, then add that folder to the library path.

See this

Community
  • 1
  • 1
nullpotent
  • 9,162
  • 1
  • 31
  • 42
  • This links explains how add a JAR file to an Android project. My shared library is not a JAR file. As far as I know, you can't export an Android code as a JAR file. Review the accepted answer for this question http://stackoverflow.com/questions/8645442/android-class-not-found-from-imported-jar-file – Islam Hassan Sep 16 '12 at 16:28
  • Oh, I'm sorry - I overlooked. But you can export Android code as jar, it's just an archive of classes. Could you try that? – nullpotent Sep 16 '12 at 16:29
  • android.content.ActivityNotFoundException: Unable to find explicit activity class {com.example.test/com.example.multiplecontacts.MultipleContacts}; have you declared this activity in your AndroidManifest.xml? I think it requires me to include all my activities, layouts, and resources used in my library to the application manifest file. Is there any better way? – Islam Hassan Sep 16 '12 at 16:47
  • Copy/paste your library to your src folder directly (*.java files), resources to you know where. – nullpotent Sep 16 '12 at 16:52
  • The same problem. I need to add all my activities and layouts to the manifest manually. I need to import the library as a blackbox – Islam Hassan Sep 16 '12 at 17:11
0

Making this a separate answer so it doesn't get lost in the comments. But here's a more official description of how to create a shared library in Android: https://source.android.com/devices/architecture/java-library.

scorpiodawg
  • 5,612
  • 3
  • 42
  • 62