Add as an library to main project - android

Basically I want to add one of my project as an library to my main project.
Because my main project refer some classes of other project.
But as normal way I can't able to do that. So I am giving here details regarding that.
My motto is to use classes of other project. That's it.
Here in image, BaseGameUtils is my library project and Smove-android is my main game project.
But when I try to add it into actual project, I can't able to see in library section.
Now please give me some suggestion in this. I want to use classes of library project.
EDIT : Library project build.gradle file.

right click the library you want to add->properties->
under "Android" section check "Is Library" checkbox.
apply and save.
then follow how you normally add a library project to your app.

Related

Issue with support library setup as per android developer guide using Eclipse

I've been through all of the subjects and all over Internet to try solving this problem, but can't seem to find any solution.
Basically I've followed every step here Support Library Setup - Adding libraries with resources, but can't figure out the last one.
Add the library to your application project:
In the Project Explorer, right-click your project and select Properties.
In the Library pane, click Add.
Select the library project and click OK. For example, the appcompat project should be listed as android-support-v7-appcompat.
In the properties window, click OK.
Now the problem is in library pane I see multiple add options (Add JARs, Add External JARs, Add Variable, Add Library Add Class Folder and Add External Class Folder)
Can anyone give me a bit more detailed explanation what I actually need to add?
The only place I see only Add option is "Projects" pane.
Cheers,
DP
This is to add a library that u got to your android application. So you can publish your app with the library to use it.
Like Actionbar sherlock, angEngine, admob or any other library.
To let your application support it, you should add it to it's project first.
And best way is to choose Add External JARS, or anything you would like.
First import the library into your workspace (where your androi project is). Import the library to eclipse. It is found under /sdk/extras/android/support/v7/appcompact.
Right click on your android project. Goto properties. Choose android. Click Add browse and add reference the same in your android project
Click add browse and add the library project
When you add it looks like below
Do it the easy way : right click your project folder in the Package Explorer or Navigator, then look for Android Tools > Add Support Library. A dialog with open to ask you to accept the license. Accept, click Install, and you're good to go ;-)

How can I use a project source code as a library for an another project?

I am a beginer in android.My client gave me a project source code(using native libraries) as a refference.Is there any possibilities to use these source code as library for my android project? If it is possible,how can I access methods of these library file? any one please help me..
Import the project into work space. Right click on the project in eclipse. Goto properties. Choose Android. Check if Is Library chexk box is ticked. If not tick the same. This is a library project now.
To refer the library project in your android project.
Right click on the project in eclipse. Goto properties. Choose Android. Click add. Browse the library project and add the same.
Clean and build.
For more information check the link
http://developer.android.com/tools/projects/projects-eclipse.html
Information regarding library project
http://developer.android.com/tools/projects/index.html
If the Android development tools build a project which uses a library project, it also builds the components of the library and adds them to the .apk file of the compiled application.
Therefore a library project can be considered to be a compile-time artifact. A Android library project can contain Java classes, Android components and resources. Only assets are not supported.
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
To use such a library, select the generated project, right-click on it and select properties. On the Android tab add the library project to it.
The library project must declare all its components, e.g. activities, service, etc. via the AndroidManifest.xml file. The application which uses the library must also declare all the used components via the AndroidManifest.xml file.
Other projects can now use this library project. This can also be set via the properties of the corresponding project.
Please check this
To create a library project, set the Mark this project as library flag in the Android project generation wizard.
http://www.vogella.com/articles/AndroidLibraryProjects/article.html

How to merge an Android application with a library

My question is: How can I merge an Android app with a library? I have only one application left which refers to this library so I want to combine them and get rid of that library.
Are there any "tools" which I could use? Or is possible to merge them "manually" anyway?
The Android Developers Site and Google couldn't help me and my various attempts to fix it by hand failed as well so I'm thankful for any advice or hint.
Create a jar of this library and put it inside the libs/ folder of your application
see if u want create library right click that project->properties->android and tick is library and click apply button. then in your main android app right click project=>properties->android->add and select that library project and goto java build path goto projects and add library project->ok. Now library project is merged with your project.
Right click on project.Select properties->Android.In that go to "Library" section and click on "Add".It will show you the list of libraries available.Select the one you want to merge.

Android app with eclipse project dependency

I have an Android app which uses a jar library generated from another Eclipse project.
But is it possible to directly reference this project instead of using an intermediate jar ?
When I do that, the build succeeds but I get VerifyErrors at runtime saying the classes of my external project can't be found...
Yes, you can directly reference this project by setting it as library. To do so:
Right click on your desired library project, choose properties and mark checkbox 'isLibrary'
Then just simply right click on you project, go to properties and add those library project
Yes, ADT supports libraries in form of shareable source code and resources, not just .jar. Please see Android Developer website, especially Managing Projects -> Library Projects article.

How to add an android project as a JAR file in another android project

I have an android project containing only login module. I want to integrate this into another android project. I searched and got the answer that make JAR file of login module project or make that as a library project. At login button click i have to call activity of other project. How can i do this? Please provide best solution to do this integration.
Thanks in advance.
Please Help.
If you have some library module you like to reuse, best way would be to make plain jar project out of it. You can see example here:
https://github.com/ko5tik/jsonserializer
This project depends on android libraries and one built and put into repository (thisw is in deed on maven central) it can be referenced by your android project. ( either in IDE settings, or as maven dependency )
You have to be more specific your build environment.
You can create your own jar file from your classes and you can add it in your android project. See link below for more information, it may help you.
JAR files and Android Project

Categories

Resources