8

I'm a newbie for Android and I need help regarding this issue. I am developing a game using Eclipse. In my project, I added AndEngine and AndEngine Augmented Reality as libraries. I was testing the project out in my Android device, every time I tap the text which uses the class of AR, it force close. I was told to register AndEngine in my Android Manifest file. I have checked about it and used <uses-library />. Now, I placed these two lines in my manifest:

<uses-library android:name="org.andengine.extension.augmentedreality" 
           android:required="true"/> 
       <uses-library android:name="org.andengine" 
            android:required="true"/>

but I get this error message: Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY

when I comment out those <uses-library /> lines, I can run the app but it force close when tapping the text that directs to the class of AR. Anything wrong in using it? Or any better way in doing it? Please post all your advises in an easy-to-understand-for-newbies way. THANK YOU!

Monica Negapatan
  • 251
  • 1
  • 14
  • 29

3 Answers3

7

<uses-library> is not meant to include libraries in your application. It is used to restrict app availability in Google Play based on the availability of a library already on the device like maps. AndEngine is a library project so include it in your build via Ant, Maven or whatever IDE you use.

In case you aren't familiar with what a library project is here's a link:

https://www.vogella.com/tutorials/AndroidLibraryProjects/article.html

Tammen
  • 3,924
  • 2
  • 28
  • 27
JustinMorris
  • 7,259
  • 3
  • 30
  • 36
  • i have already added the libaries in the Properties > Android part. my problem is declaring it in the manifest. – Monica Negapatan Sep 30 '12 at 13:21
  • you don't declare libraries in your manifest.. you can declare any activities or services that may be in your libraries there but not the library themselves. check you project.properties file and see if you have a line like: android.library.reference.1=../AndEngine – JustinMorris Oct 01 '12 at 22:50
  • oh, i see. my teacher said that since I was using AndEngine, I should register it in the manifest. So, I was thinking there's a way to do it manually. in my project.properties file, i saw 2 lines containing the 2 libraries. thanks justin! – Monica Negapatan Oct 04 '12 at 17:25
  • my problem again is that when i tap the text that opens a new activity which uses the augmented reality, it force close. i copied the code from the AndEngine example of augmented reality. what could be the reason it force close? – Monica Negapatan Oct 04 '12 at 17:28
  • Be sure and always use LogCat so that you can see what is causing a crash. It will usually tell you what the error is and what line in your code it relates to. – JustinMorris Oct 04 '12 at 18:17
4

If this element is present and its android:required attribute is set to true, the PackageManager framework won't let the user install the application unless the library is present on the user's device.

<uses-library> - specifies a shared library that the application must be linked against. This element tells the system to include the library's code in the class loader for the package.

Jaydev
  • 1,794
  • 20
  • 37
2

creat a libs folder inside the res folder and put the AndEngine jars in it.set the class path of jar.

sanjay
  • 2,116
  • 3
  • 19
  • 25