Android library problems - android

I am looking to use the android sample project 'Bluetooth chat' as a library so that I can use it inside another application.
I have marked the project as a library in its properties and I have referenced the project in my application. I understand I need to update my applications manifest file, however I am totally lost as to what needs to be added/changed(I am a total beginner).
I am just looking to launch the sample from the click of a button within my application.
I have read the documentation about referencing but I am still pretty confused. Any guidance would be much appreciated!

if you access your project you enter your manifest file for entry lie that
<activity
android:name="<Package name>.<java file name>"
/>
Make Sure your lib and your project in same folder.

Related

Uploaded Android APK marked as Android Auto when not set in manifest

I've looked through my whole project directory, and for the life of me, I cannot find where it would think it is an Android Auto. Going through this page:
https://developer.android.com/training/auto/start/index.html#auto-metadata
Nowhere in my Android manifest, do I set an automotive.
Could a library add to the manifest to make it an Automotive app?
Are there other things in the manifest I can check?
Please cross check in your res/xml file and see if you have any media or notification
under - uses element.
You can also check in your manifest file if you have added Car GMS package in the meta-data element.
<meta-data
android:name="com.google.android.gms.car.application"
android:resource="#xml/your_auto_xml_file"
/>
If the library you are importing in happens to be from the merchant who builds up the customized DHU, then these lib can infuse those properties in your project. One easy way would be to remove the library and see if it resolves the issue.

How to convert a project into a library project - and then use it

I have had a fully working app on google play for many months now.
I have been making lots of different versions by editing/un-editing it, but understand that the proper way to do this is convert your app into a library project and then have a variety of different projects / manifest files which then include the library.
I know I can go to properties/android and click "is library" to make my existing project into a library, but then what would my new "wrapper" project look like? Is there a nice online article describing this process?
EDIT: Just to be clear, my question isn't "how do I make a library project" (I think I've got that sorted), my question is "what does a project that does nothing other than execute the library look like?"... would it contain any .java files at all?
This artical shows basics of how to create library project with a good tutorial AndroidLibraryProjects
and We have the Android docs , which mention what constrains you should keep in mind while creating Library project here is the link Android Library Project doc
With a combination of guesswork and experimentation, I ended up with the following recipe...
Step one, clear the guts form the original projects manifest, so that it ends up simply as:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.mylibraryname"
android:versionCode="1"
android:versionName="1.00" >
</manifest>
Then in properties-android, tick "Is Library", then build the new library project.
Step 2, Ask eclipse to make a new android application project, but uncheck create activity.
Step 3. In the new project go to properties - android and in the Library box, select add, and you should now be able to select the original project as a library.
Step 4. Now paste the guts of the manifest that you took from the original project and paste them into the body of the new manifest.
Now just click run - nothing else to add.
Things to watch out for. If the original project had assets (like fonts), then copy these to the new project as they don't seem to get accessed from a library.
Your library's references to resource ID's are no longer simply constants, so they are not allowed in switch-case statements (convert to if-then-else).
If you have references in the manifest like: android:name=".my_class", then these will need to be changed to their full names like so android:name="com.company.mylibraryname.my_class".

INSTALL_FAILED_MISSING_SHARED_LIBRARY Using NDK

I am using a a project of Combination of NDK and android that is related to augmented Reality
I want to and this project in another project.
I have read posts on different Question regarding this issue but they all are explicitly related to google map api.
I've made the other project as a library and now using it in my new project.
I've added permission in Manifest file.
Here are is the specific part of it.
<uses-library android:required="true" android:name="com.qualcomm.QCARSamples.VirtualButtons" />
<activity android:name="com.qualcomm.QCARSamples.VirtualButtons.VirtualButtons"
android:label="#string/title_activity_putit_out_demos" />
so if any body can guide me where i am wrong
The only thing suspicious I see is the uses-library tag, do you have the lib in your device/emulator? If yes then you should have the following files in it,
/system/etc/permissions/com.qualcomm.QCARSamples.VirtualButtons.xml
/system/framework/com.qualcomm.QCARSamples.VirtualButtons.jar
Without the lib the apk installation will fail with INSTALL_FAILED_MISSING_SHARED_LIBRARY error.
i have figured it out with one simple way
follow the steps to get rid off this thing
right click on the Project you want to make library
go to
Properties->Android-> check is Library option (in right lower area)
click apply and then Ok
and go to main project in which you want to add it as library
right click on it go to properties-> android click on add button (right lower area) add the project
click apply and then ok
and in Manifest file
and the main class of the library project to triger its functionality
`<activity>your activity goes here </activity>`
No need to Add <uses-library> permission in manifest file

<uses-library /> in Android Manifest

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!
<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
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.
creat a libs folder inside the res folder and put the AndEngine jars in it.set the class path of jar.

How can I create test for Activity which is located in the library

The task is very simple but I can't find any solution.
I have an application which is based on my Android Library Project.
Activities are not defined in my main app but in the library project.
Eclipse doesn't allow me reference my library project from the test project targeted to main app.
Is there a working example to see how it is done?
If you want to use activity from Library Project, and you already attached it as library to build path, than you need also to put targeted activity in android manifest.
<activity android:name="com.packageInWhichActivityIs.activityName"></activity>
I`m assuming that you are getting class not found exception. Next time please provide more specific information.

Categories

Resources