Can't add project as library to my project - android

I'm trying to use ABS library in my project. I added library project to my workspace, checked this state ("Is Library" is true in project's settins), added this project to my one "Java Build Path" -> "Projects". But I can't mark this project as library ("Android"->"Libraries" in properties). I had added that, but when I opened it again, I saw that project hadn't been added. How can I fix it?

Undo this step:
added this project to my one "Java Build Path" -> "Projects".
You only need to add a library project project under the Android -> Libraries in properties

Check your files to see if they are read-only, especially build.properties.
If you use source control, they will tend to be set to read-only and Eclipse doesn't seem to provide any warnings when it needs to write to these files and can't -- you'll check the box, it looks good, then you exit and reload and it's unchecked!

Related

Adding a library to eclipse

I am new to Eclipse and I could not solve this problem.
How could I import this library to Eclipse using the default builder (not using Gradle)?
Without using Gradle/Maven and using Eclipse you need to manually add the library.
The library is in the jcenter repository, which means there is a jar file available. This jar file can be found here (I'm pretty sure you need the -sources.jar)
Download this library and save it in a logical place. Go to Eclipse, highlight the project and press Alt+Enter. Go to the Java Build Path page and click Add External JARs under the Libraries tab. Select the JAR file and it should be fine.
Keep in mind that the Eclipse ADT plugin is not the way Google wants you to do it. If you have no reason to use Eclipse other than that it's what you have set up now, you should probably move to Android Studio.
Create a new project and add github version project files to newly created project else download the entire project from github and add this project to your current project.
right click(current project) -> Build path -> Configure build path -> Java build path -> Projects (tab) -> click add
Just add this project there and build your project.

Having build path problems after importing AppCompat library

I'm trying to design a simple hello world application with material design using Appcompat. I imported the v7 libraries into the workspace (I use eclipse btw) but after this, my other projects and also this one started showing this red exclamation mark indicating build path problems. when I checked it, the android dependencies in project>properties>Java build path was showing an error. Removing android dependencies would temporarily remove the exclamation but android dependencies would rebuild and bring the errors all over again. when i run my material application, i get the following error "
java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$styleable" i tried rebuilding the library but got the same problems. what am i doing wrong? Any help is appreciated.
You delete support v7 lib on current workspace
Project -> properties -> remove inclused v7 lib
Clean project
reimport v7 lib from SDK-DIRECTORY/extras/android/support/v7/combat
click "v7 on your workspace" -> Properties -> click to choose "is Library" if it not be checked.
Android Project -> properties -> add lib -> choose "v7 on your workspace"
Reclean project.
-> Wait -> OK
Ok i found the answer myself (eclipse did it btw). it was that i had to rename all the jars of the support libraries in their bin folders to match what it said it should be in project->properties->java build path->android dependencies. like my support library for appcompat was named something similar to appcompat-v7-support and its jar held the same name. eclipse said that appcompat-v7.jar was missing from the bin folder so all i had to do was rename my jar. Fairly simple yet annoying. i leave this post for others to refer.

Problems including library project into build path

I am trying to follow the steps of setting up a v7 support library as they are listed on the android development website.
Create a library project and ensure the required JAR files are included in the project's build path
I get stuck on step 5 where I am supposed to right click the JAR files and choose "Build Path". This option is missing. I have checked other questions related to this such as this one>>> Question
but none of the listed solutions seem to work for me. Either that or I do not see the options that the posters are referring to on the menus. Has anyone had this problem? Where did I go wrong?
I need this for an android project.
If you are doing in eclipse, then you can go to ProjectName -> Right click on it -> Goto Properties -> Goto Java Build Path -> Go to Library -> Choose Add Jars option if jar is in same project or choose Add External JARs if jar is outside the project folder.
If you have already copied the JAR file to libs/ directory of your project then choose the option of Add JARs and browse to the libs folder where you've copied the jar. Select it and press okay. It should get included in your project. Hope this helps else please comment.

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.

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

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 )

Categories

Resources