can i provide a project contents as jar files to another projects? - android

Hi i have the project developed in eclipse environment is working fine, and i want to use that project as resource or add as jar file to another project.if possible can please let me know how to do this one. will help lot for me.

You can do it via Android Library project.
Refer this LINK.
Describes how to set up a project as a library project. Quoted from its content
================= quoted =================== Next, set the project's Properties to indicate that it is a library project:
1) In the Package Explorer, right-click the library project and select Properties.
2) In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
3) Select the "is Library" checkbox and click Apply.
4) Click OK to close the Properties window.
=============== unquoted =============================
So, you open your project properties and "unselect" "is Library" checkbox and click Apply to make your project a normal Android project (not a library project).

In theory you can as #Agarwal described.
however the adt-tools are not ready to do it yet
My last failed try was adt-tools version R17 documented at how-to-consume-reusable-gui-element-widget-with-resources-in-android
According to user #CommonsWare R18 and R19 still cannot do it (see comment in replace-android-library-project-by-jar-library )

Related

Adding google-play-service source to my android application

I want to add Google-map to my android application and I followed this tutorial: https://developers.google.com/maps/documentation/android/start#overview
but it shows me an error. which is: error: Error: No resource found that matches the given name (at 'value' with value '#integer/google_play_services_version').
when I searched in Google trying to solve the problem, I found that I have to do these steps:
In the Package Explorer, right-click the dependent project and select Properties.
In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
Click Add to open the Project Selection dialog.
From the list of available library projects, select a project and click OK.
When the dialog closes, click Apply in the Properties window.
Click OK to close the Properties window.
But when I Click Add to open the Project Selection dialog which is step number 3, I could not choose any library project. i.e the list is empty.
I don't know if I should add #integer.xml file? If so, how to do that? I am sorry but I am really new to eclipse.
So, could anyone help me please:(
Thanks..
First, make sure you have the Play Services project in your workspace, as explained here: http://developer.android.com/google/play-services/setup.html
Now make sure that it is a Library Project. Right-click the play-services project -> Properties -> Android and make sure you check Is Library after the list of build targets.
After that, redo the steps you listed. In Step 4 Play Services will be in the list.

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 ;-)

Can’t link Android projects in Eclipse

I can’t link Android projects in Eclipse.
I get a VerifyError, and some can’t find class warnings, which I assume means that it’s not getting the library.
I’m using project properties > Java Build Path > Projects.
I can get it to work by referencing the other projects jar. Then setting the source attach so that I can step through the code, but this is a much uglier way of setting the projects up because linking to source and linking to the jar doesn’t allow the use of path variables. So the next person to pick up this project is going to be really confused when the project doesn’t work for them.
Is it possible to directly link projects?
Is it possible to use path variables to reference jars and source
attachments?
It’s so easy to do in Flash Builder…
Also, when I change anything in properties > Android then hit okay, when I open properties > Android the changes have been reverted, what's that about?
If you are asking if an android project can reference a "library" project, the answer is yes; open the properties for the main android project and select Android menu and then at the bottom half of the screen, you can Add your library project to your main project. Note that the "library" project should be set as a library project (same UI allows you to set a project as library)
HTH,
Ali.
assuming you're talking about a library project that you have in your eclipse workspace.
go to properties -> Android
on the bottom half of the screen you should see a "Library" pane.
click add and point it to your library that's in your workspace that you want to add.
click apply afterwards.
i'd remove what you added in that library pane that you're talking about. that's for jar libraries that you've added to your project's libs folder.

ActionbarSherlock not working

I am having problems getting start with the ActionBarSherlock. I downloaded the 4.1.0 version and followed the following tutorial for installing it.
http://www.youtube.com/watch?v=4GJ6yY1lNNY
The Problem I am facing is whenever I make a new project and add the library project of ActionbarSherlock to it. I get the following error.
Description Resource Path Location Type
The container 'Android Dependencies' references non existing library 'C:\Work\JakeWharton-ActionBarSherlock-4.1.0-0-g9598f2b\JakeWharton-ActionBarSherlock-88fc341\library\bin\com_actionbarsherlock.jar' myapp Build path Build Path Problem
Please anybody help me with it.
I just had the same problem: A .jar file is requested, but non-existing. Also, it is okay that the file doesn't exist, because we want to use a Android-Library Project and not an included jar-library.
The steps described by Aqif Hamid are perfectly fine, if the missing import (.jar or library project) would be the root of the problem. But i figured out that the reason for this error is that you have to set both projects (AndroidBar Sherlock and your own Android project) to Java Compliance Level 1.6
To do so go into Project Properties => Java Compiler and set the level to 1.6
Of course, you have to install JDK 1.6 on your computer...
Hope this helps you too!
The only thing that it works for me was selecting at Properties at Java Compiler Tab Compilance Level --> 1.7 (It was 1.6).
After that Android Tools, Fix Project Properties
DO the followings:
just like you have bin, res folders. right click on your project and
add a folder named 'libs' (if libs folder is not already there).
Then copy paste your com_actionbarsherlock.jar file in this libs folder.
Right-click on your com_actionbarsherlock.jar file and click Add to Build Path.
Now clean and build your project. You should be good to go.
Edit:
To add project as a library do this:
Make sure you have your library project in your projects list and it
is open.
Right click on your project in which you want to add your library
project and select Porperties.
Click Android in properties windows, now scroll down, you will see
library section at the bottom. There press Add button.
Now a window will open in which you will see list of library
porjects. Select your required project and press Ok. Now that library
project must be there with a green tick mark.
Press Apply and Ok button.
You should be good to go now.
regards,
Aqif Hamid
I am of the understanding that you cannot include ActionBarSherlock into your project by adding a jar to your lib directory (or just including the jar at all). You will have to create an android project for ActionBarSherlock then link to it as a library:
Create ActionBarSherlock project in Eclipse
Right-click your project and go to Properties
Select Android in the left pane
Then in the right pane, towards the bottom you can Add... the ActionBarSherlock project you created in step 1.
If you are curious why the jar approach doesn't work, I give you Jake's reply in this thread
(although that's a month and a half old at this point).
1 - create a libs folder (parallel to manifest) and put the jar in that
Your Project -> right click -> Properties -> Java Build Path -> Libraries -> Add Jar ->
yourjar.jar
This video might be useful in case you are having some issues.
http://mobile.tutsplus.com/tutorials/android/jar-for-android/
Clean your actionbarsherlock project. It will generate the .jar file for you when it re-builds.
Using the Android Tools option to Add compatible libraries fixed the problem for me.

"Android library projects cannot be launched"?

Now I am totally confused by this error message: Android library projects cannot be launched.
I carefully checked the build path and library, everything seems "OK", and there is no error on Problems view, however, when I tried to run my application as an Android project, it failed and showed that message.
Any explanation for why it's happening is appreciated!
From Android's Developer Documentation on Managing Projects from Eclipse with ADT:
Setting up a Library Project
Next, set the project's Properties to indicate that it is a library project:
In the Package Explorer, right-click the library project and select Properties.
In the Properties window, select the "Android" properties group at left and locate the Library properties at right.
Select the "is Library" checkbox and click Apply.
Click OK to close the Properties window.
So, open your project properties, un-select the "Is Library" checkbox, and click Apply to make your project a normal Android project (not a library project).
Through the this steps you can .
In Eclipse , Right Click on Project from Package Explorer.
Select Properties,.
Select Android from Properties pop up window,
See "Is Library" check box,
If it is checked then Unchecked "Is Library" check box.
Click Apply and than OK.
With Me I had the library ticked under Eclipse>Project Properties>Android what I just did was uncheck the ticked library.
It says “Android library projects cannot be launched” because Android library projects cannot be launched. That simple. You cannot run a library. If you want to test a library, create an Android project that uses the library, and execute it.
In Eclipse Project -> Clean
Modify project.properties like this :
target=android-10
android.library.reference.1=F:/svn/WiEngine_library
Through the following steps you can do it .
In Eclipse window , Right Click on your Project from Package Explorer.
1. Select Properties,
2. Select Android from Properties,
3. Check "Is Library" check box,
4. If it is checked then Unchecked "Is Library" check box.
5. Click Apply and than OK.
right-click in your project and select Properties. In the Properties window -> "Android" -> uncheck the option "is Library" and apply -> Click "ok" to close the properties window.
This is the best answer to solve the problem

Categories

Resources