The android docs recommend you add the gcm library project located at $ANROID_HOME/extras/google/google_play_services/libproject/google-play-services_lib/, however I don't want to clutter my eclipse workspace with a useless project.
After checking the contents of the project I noticed that there is no real code, only a jar (google-play-services.jar) and a bunch of resource files.
My question is: If I'm only going to use GCM, is it possible to just put that jar in my maven repo as opposed to importing the Android library project?
I'm not sure if I get your question. To be able to use GCM, you just need to Add google-play-services.jar in your project path.
I successfully added the library by Project>Properties>Java Build Path > Libraries (tab) > Add External Jars and selected the library from C:\Program Files\Android\android-studio\sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs
Hope this helps/
Related
This is Not a duplicate
I've read each post, and at the flurry site as well...
I have read:
Add the FlurryAnalytics_x.y.z.jar to your classpath
If you're using Eclipse, modify your Java Build Path, and choose Add External JAR.
If you're using the SDK tools directly, drop it into your libs folder and the ant task will pick it up.
I am not using eclipse.
I am not using SDK tools (as best i know).
I AM using android studio...
I am not new to this, but i cant seem to get past the particularities of android studio .. so.
I already have the code added, so i dont need that.
What i need is a step by step on adding the jar file(s), and what "config/build" files that need to be modified....
BWT
if i have a TOP folder MyTestProject, and under that is MyTest, and under that there are build, and source, where Exactly do i put the libs dir ??
In newer versions of Android Studio, the projects it creates will pick up jars that are placed in the "libs" directory in the module. If you want to add it manually, do so through Project Structure > Modules > Dependencies.
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
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.
Are there any cons of build the facebook SDK library project into a JAR file(as ADT 16 does with library projects) and adding it to your project? I am not changing anything in the facebook SDK so don't need to have it added as a library project. So far it has been working fine for me and I am wondering whether this is a common practice used by developers using the facebook SDK? It speeds up the build process quite a bit because Eclipse doesn't have to resolve all of the resources in the library projects.
Yes! I just figured it out myself.
You need two jar files:
facebooksdk.jar
android-support-v4.jar
Option 1
The first can be found in the bin folder, the latter in the Android Dependencies folder. (Of the FacebookSDK project)
After adding them both as libraries to my project (Project --> properties --> Java Build Path --> Libraries) it actually worked.
Option 2
Another way is to copy paste the facebooksdk.jar and get the android-support-v4.jar via Right-click on project --> Android Tools --> Add Support Library.
Good luck =)
Kasgoku,
The code is provided as a project for easy viewing of the classes. Adding it as an included jar or just moving the source into your project also works. When I created an FB connected android app, I moved the files I needed into a package in my app.
It looks like maven has them cached.
http://search.maven.org/remotecontent?filepath=com/facebook/android/facebook-android-sdk/4.4.0/facebook-android-sdk-4.4.0-sources.jar
You can create a jar file :
Download Facebook Android SDK from github.
Extract it. (at any location).
In Eclipse create new project using create project from existing source option
Enter the project name as "com_facebook_android".
Set Location to "facebook" folder in extracted location.
Click Finish.
Select the "com_facebook_android" project in project explorer and right click
select export option.
In the export wizard select JAR file in Java folder.
Click next then browse the location for jar file and give the name as yor wish like "facebook-android.jar"
Click finish........ JAR file will be created in that location
Well guys you dont need to manually make a .jar file out of facebook-android-sdk. You can use easyfacebook.jar. It currently supports:
Oauth 2.0 authentication support
Use the access token
Pictures upload support
Supports all the features of Graph API
It can run any query FQL
Contains BEAN of all facebook objects
It's free. LGPL GNU license
Progress dialog
Logout function
Server/Request Error Management
Key hash/Geo Tagging
Login without facebook app
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.