I have created a new android project. I want to have a action bar at the top so I downloaded the Action Bar for Android Library because I want to support devices from android 2.1.
The description says
The action bar component is an Library Project. This means that there's no need to
copy-paste resources into your own project, simply
add the action bar component as a reference to any project.
I am new to android so what does this mean? How can I add the library to my existing project?
Import the library into your eclipse workspace:
File->Import->General->Existing Projects into Workspace, Next
Select root directory: /path/to/project
Projects->Select All
At this point it fails because there is nothing to select and the next button is deactivated.
Any ideas?
File->New->Other
Select Android Project
Select "Create Project from existing source"
Click "Browse..." button and navigate to johannilsson-android-actionbar\actionbar
Finish (Now action bar project in your workspace)
Right-click on your project -> Properties
In Android->Library section click Add
select recently added project -> Ok
that's it!
Now you can use it
Checkout this documentation on how to reference a library project in eclipse.
From the link above:
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.
Plus to the "best answer", at step 8, if you don't see the project, go to the project what you would like to add as a library and
open 'project.properties'
add 'android.library=true'
and you can again follow the instruction and you should see the desirable project.
Related
https://github.com/ankushsachdeva/emojicon
How do I add this library into Android Studio so that I can use it in my project.
Usually I add a line into my build.gradle file?
I had faced same problem recently. I know it is too late to answer this. However, I am still sharing my findings in case if someone finds it useful in future:
Download 'emojicon':
Download source from here. Lets say you've downloaded it in D:\Emojicon
Import library D:\Emojicon\lib to your project:
In Android Studio go to File->Project Structure then click on '+' symbol. From the dialog box pops up choose appropriate option to import library.
(For e.g. on my system I have Android Studio 2.1.2, it shows me "Create New Module" dialog then I choose "Import Eclipse EDT Project")
Then select D:\emojicon\lib to import emojion library to your project. It will copy emojicon project to your project.
Set dependency:
Then click on Dependencies tab (in dialog options box from File->Project Structure). From the list that appears on left side, click on your project under modules.
You will see all your project dependencies. Now click on '+' symbol from top right corner and select "Module dependency". The dialog next will show "lib" as module. Just select that and click OK to close dialog. Close Project Structure dialog also. That's it! You have successfully imported emojicon library and have set its dependency.
Implement:
Now refer example project to see how to use emojicon in your project (Its basically using EmojiconEditText and EmojiconEditView instead of EditText and TextView)
Trying to migrate to Android Studio 1.3 from good ol' Eclipse but it's frustrating.
How does one add an external library jar to 'External Libraries' section of the project?
Reading SO posts including here, I went to File|Project Structure|Modules
selected app and Dependencies tab.
Clicked '+'
It brings up the Select Path below
How do I add a jar file from D:\mylibs when the Home icon is disabled in the screenshot below?
I tried to copy the jars, and then right-click 'External Libraries'
and Paste but it did not work.
There is something wrong with the AS 1.3 dialogue where you add the .jar file. There are no buttons to navigate up the directory tree or change drives. Instead, to add the library, select the .jar file in Explorer (Windows), right click on it, select Copy, go to Android Studio, select Project->[NameOfYourApp]->app->libs and right click on libs and Paste file into it, click Ok on the confirmation box. Then, right click on the .jar file, go toward the bottom of the menu and select Add As Library. Then in the Create Library box confirm that it is adding to app and click Ok. Gradle will then automatically add it to the build dependencies. You can then check the build.gradle file to make sure you see this line: compile files('libs/[filename].jar') under the dependencies section.
Click on your project name on the project explorer, press "F4" or right-click on the name and select "Open Module Settings". Then click on "Dependencies" tab, and click the green "+" button on the right side, then select "File Dependency", this will bring up a Browse Window, use it to open the ".jar" or the ".aar" file.
Follow the next process and you should get it:
I followed every steps in Android - ActionBar to add action bar.
I extend the activity from ActionBarActivity:
public class MainActivity extends ActionBarActivity
I need to add appcompat v7 support library as in here: In "Adding libraries with resources", eclipse section. The last steps:
"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. "
Step 2 is where I can't find the Library pane. How can I add the library to my project?
A picture is worth a thousand words:
Following are the steps:
Paste the android-support-v7-appcompat.jar that you have downloaded in libs folder of your project.
Right click on your project, select Build Path -> Configure build path.
Select Library Tab then Add Jar option and browse your recently added v7 jar and click OK
that's it :)
This is what worked for me:
Eclipse -> Import -> Existing Android Code into workspace.
Add ~/android/adt-bundle-mac-x86_64/sdk/extras/android/support/v7/appcompat to your Eclipse workspace.
Right click on the project in Eclipse and select properties.
Select Android -> Library -> Add.
Select appcompatv7 project and Save.
Use import android.support.v7.app.ActionBar to import Action bar in activities and fragments.
The library pane shows up if you select android first in the left hand list. It should then be at the bottom of the right hand section of the properties window, underneath the Project Build Target section.
This is the the solution I've used to solve that problem.
Make sure that you've installed already the following libraries Android Support Library, Android Support Repository and Google Repository by checking in the Extra folder by openning the Android SDK Manager in eclipse.
Create an Android Sample Project then choose the appcompact_v7 library.
Close the project you've just created, restart Eclipse and create now a new Android Application project.
Hope that it will help you.
In may case this works:
In "android-support-v7-appcompat" project:
-Delete “android-support-v7-appcompat” from Package explorer.
-Import again and check “Copy into workspace”
-In Properties -> Android -> in Project build target, uncheck Android 2.2 and check Android 4.1.2
-In Java build path, uncheck if you have any .jar library, and uncheck the Dependence
In other hand, the project that uses “android-support-v7-appcompat”
in Properties -> Android add the library, but uncheck "IsLibrary”.
-In Android -> Project build target check Android 4.0.
-In "Java Build Path" -> Order and Export -> Unchecked the .jar library
-Finally do a “Project -> Clean” both projects
following the latest(2014/5/19) document, the second step is:
In the category panel on the left side of the dialog, select Android.
then, you will see the library pane on the right side of the dialog.
Try this
Open SDK Manager
Install Android support Repository
Go to F:--\Android Setup\android-sdk-21 version\extras\android\support\v7\appcompat\libs
Copy android-support-v7-appcompat.jar
Paste this .jar in Your's Project Lib Folder
Set and change AndroidManifest.xml
<uses-sdk
android:minSdkVersion="9"
android:targetSdkVersion="23" />
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 )
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