Where can I find android-v7 support library jar - android

I want to use the new ActionBarActivitiy class from the v7 support library but I cannot find the support JAR anywhere. I have a v7 folder in my extras directory but it contains 3 directories and not a jar

In Eclipse right click on on your Project -> Android Tools -> Add Support Library... and follow the instructions. As the result, required jar-file gets copied into your project's libs folder. Or you can add libraries manually how it is described in Android documentation.
Update 1: Android Tools team has made some changes to the way support library is integrated.
Android updates do this a bit different. There is still Android Tools -> Support Library option, but now it behaves a bit different. Once activated, Eclipse will silently create a new project called appcompat_v7 or similar. The name might change in the next versions of ADT. You must be able to find this project in your workspace. This project contains android-support-*.jar file. This is a new library project. In turn, your project receives a dependency on that library project.
You can stay with the updated configuration "as is" and start using compatibility API. Or alternatively, you can copy android-support-*.jar files into your project's lib folder and remove dependency on appcompat_v7 library project. Both options will work just fine.
Update 2: They change this behavior quite often. Try Project -> Android Tools -> Add Support Library... first. If it doesn't work, please check out official documentation for more recent information.
Update 3: It is really worth to migrate to Android Studio to avoid multiple issues with ATD nowadays.

ActionBarActivity is in an Android library project, not a JAR. There are instructions in the Android developer documentation for how to add an Android library project to your environment and attach it to your application project.

You have to update your Support Library through your SDK and then navigate to the folder where your SDK is located! Then go to : Extras->Google and you will find the Project and the jar included!

Related

I can't access Crouton library in Eclipse

I followed all the steps for using the crouton library with Eclipse, but I still have not been able to use it.
Here are the steps I followed:
Clone the Crouton library from GitHub.
Unzipped the file and copied out the library folder.
Open eclipse and import the library into the workspace (The name changes to 'main').
Right-click on 'main' and select Add Support Library in the android tools option.
Open project properties set build target to 4.4.2, and tick 'is library'.
In the project which I want to use crouton, I add it as a library from the property option.
After all these steps when I try to create a crouton. For example:
Crouton.showText(
this,
getString(R.string.crouton_message2),
Style.CONFIRM);
Eclipse says Crouton cannot be resolved to a variable. When I to try import it, I can't find it.
These are the same steps followed in all my research, here's what I found, a post from Grokking android and a YouTube video
This is not the first time I am using a library. I have been using the android appcompat library for a while now with out any problems. And the steps i used in setting it up are pretty much the same with is, except that in the appcompat library after all the above steps, I had to copy the jar file and put it in the lib. folder of the project that needs it.
I'm I missing anything?
Thank you for your help.
Crouton is being built using gradle.
This means that the source directories are different to the default Eclipse source paths.
I discourage building without a proper build system.
Nonetheless, using version 1.8.2 of Crouton within Eclipse is possible.
To do so, simply download the jar from maven central and put it in your libs folder.
Since the current version of Crouton does not rely on resources, adding it as a library is not necessary.

Eclipse -> Android Studio migration: how to include v4 support library (also including the ant build script)

I have a setup of android project on eclipse and I want to migrate to Android Studio. So, I have android-support-v4.jar that I use for my main project and my Facebook lib-project.
I guess I have to exclude lib-projects as a folder in my main module (lets call the main module Jack). Jack has dependancy on the facebook lib-project.
How should I define the android-support-v4.jar as a separate library and use it in both projects? Or should I just use directly the jar files and leave them in both Jack's libs folder and Facebook libs folder?
If the first option should be done, will ant clean release still work (with the build.xml android generated file)?
In Android Studio, builds are done with Gradle now. Gradle is different. With gradle, you tell your project which jar's you need, and it will connect to a server and download them if it doesn't already have them when you compile your apk.
A few things to note:
When you install Android Studio, it has it's own Android sdk directory. You have to download everything from the sdk downloader (from inside the Android Studio App) again. Don't bother trying to switch the sdk download path to your current one. You will only encounter bugs (Or at least I did).
So your question is worded very confusingly. It sounds like you have a main module, and then you have a library module, and the library module uses the support library.
You'll need to set it up so the main module has a dependency on your library module. From there, you'll need to go into your library module's gradle file and tell it that you want to include the android support library
dependencies {
compile 'com.android.support:appcompat-v7:19.0.0'
}
The support library is a little weird in gradle. Gradle normally would download the dependencies you need. However, android studio requires that you have the support library installed through their sdk downloader (top-right group of icons in android studio. The download icon).
After you get all your dependencies entered into your gradle file, you'll then need to go to Tools -> Android -> Sync gradle files with project. From there compile errors should go away, and you should be able to run the project.
Best of luck. By the way, Here is the documentation on Gradle on the android website. I find myself having to go to it A LOT, especially when I made the switch from Eclipse to Android Studio. This + Various tutorials I found as needed via google. http://tools.android.com/tech-docs/new-build-system/user-guide
EDIT: This link might also be helpful. Google has some steps for switching from eclipse to Android Studio: http://developer.android.com/sdk/installing/migrate.html That with some of the stuff above may prove helpful.
While I haven't tried this myself, I suggest you use the recommended migration steps provided by Google in this article.
Before you do that, though, make sure that you either:
Check that both support libraries on the main project and dependencies have the same version (Eclipse will complain about it during build time, and will likely cause problems during conversion to Gradle script.); OR,
Uncheck the "Android Private Libraries" entry on the Order and Export tab of the dependency project's build settings.
If the migration process described doesn't work smoothly for you, you can always call the Ant build script from within the Gradle script, as described here.
The Android Studio uses only Gradle, but you can export Android ant project from eclipse.
To do that go to File -> import project usually next, next, next... works.
If not go to project setting Shift + Ctrl + Alt + S and under modules -> PROJECT_NAME -> Dependencies you can add your support library.
To add a Facebook library you must add it as another module to your project.
If you still want to use Ant there is another option: Use Intellij IDEA which support Ant.

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 add external libraries to my application in android

I have an application that I have to look at as a training exercise. It has used few external libraries such as SlidingMenu, ImageViewZoom and ActionbarSherlock.
I have downloaded and extracted those libraries but I have no idea how to add them to my existing project.
For those that are distributed as a simple JAR, do what Emil Adz indicates, and copy that JAR into your project's libs/ directory.
For those, like ActionBarSherlock, that are distribute as Android library projects, you will need to do a bit more work. In the case of Eclipse, you will need to import the library project into your workspace, then go into Project > Properties > Android for your application project and click the [Add] button to add the library project to the application project. For a command-line build, use android update lib-project to link the application and library project together.
You can read more about referencing an Android library project from Eclipse or the command line in the documentation.
You need to import those libraries as Android Project from existing source and mark them as "Is Library" by going into their properties.
Once you marked it as "Is Library" add it to your
project by going into Properties->Android->Library->Add (it will show the list of library you imported).
The Right Way:
What you need to do is to copy the external library (JAR file) to the /libs folder of your project.
That way those libraries will compile with your project and could be use on real device when you deploy your application.
Some times you will need to add a project to your workspace ( For example the Google Map library)
and then add the library reference using the properites -> Android window at the bottom.
You can get an idea of how it's done by reading the first 3 step of this Google Map API V2 guide I wrote. there I reference the android library project:
Google Map API V2 Guide
The Wrong Way:
any other way, like for example adding the files using the properties - > Java build path screen may result in a missing library when you run the project on a real device.
if they are jars the make a libs folder then paste the jar in it and then go to your project buildpath->configure build path->Add Jars-> ok and if it is a library project then go to your project Property->Android->Add(Your Lib Project)->Ok->Apply

Android Library Projects in Eclipse - Jar files doesn't show up in the r14 sdk tools

I have updated my SDK tools to r14. In this link it is told that the library projects will show up as jar files in the projects which uses the library project. But the jar files are not showing up and the <libraryproject>_src folder is still visible. While migrating to r14 from previous version is there any specific step/settings that I need to follow/change so that the library projects are included as jar files? Should I first export the library project as jar file and then include it? I would like to know if anyone has done this and how they have done it?
I got this to work.
I rebuilt the library project and a <libraryproject>.jar appeared in the bin folder. Then I removed the reference from the project which uses the <libraryproject> and added it in the same way as before.
Project properties -> Android -> in the Library section I added the reference to the <libraryproject> and it created a Library Projects in the current project containing the <libraryproject>.jar file.
Fortunately, there was no switch case statements involving the resouce IDs in my entire library projects. For those of you who is not able to get it to work right away, I would suggest them to go through the link I have posted in the Question.

Categories

Resources