Check-in Android project having dependencies to SVN - android

I have added google play services lib as a dependent library to my Android project as shown.
I need to checkin the code to SVN . Do i need to checkin the google play services project as well? Or Is there any way i can package the google play services project along with my Android project?
Any help will be appreciated.

The Google Play Services should be used as an Android Library Project. So you shouldn't pack it in any way. Usually I don't like committing external libraries in the versioning control system, and I prefer letting everybody clone and import the library projects locally. You could though add the library project into a different folder, and commit it to your source control if you find it more convenient.
Another alternative would be to use Maven for dependency management.

Related

Is it better to upload an android library to GitHub than keeping it inside the project?

I'm really new with android developing. But I know how to upload a library to GitHub and include it in an android project. Recently, I'm working on some android apps, and I realized that I need to use some layouts and classes for all the apps. So, I created an android library and kept that inside all the project files. Then I came to know that I can simply upload that library to GitHub and use it for all the projects. But I'm not sure if it's a good idea. Is there any advantage if I upload it to GitHub?
In general, using a source control (git or other ones) is always a good idea given that your local filesystem can crash or you may want to revisit certain revisions you made to your project. Github is very popular and hosts several highly used projects, so it is no doubt a good place to upload. However, you must know that if you don't have their paid account, the project will be public (at this time, free accounts don't have a way to create private projects). Are you developing as hobby and do you mind if others see / take the code and reuse (hopefully under the licensing terms you specify)? Or is that something you're doing for an employer? In that case you should consult with the employer if this is OK.
Now as for sharing this module across projects, I don't think github has a secret sauce here. You could always build your library once and drop it in as dependency into all your apps, without having to copy its source code into each project. You may also want to look into integration with maven / gradle build systems, which Android Studio uses. For example, third party libraries often are available as downloadable libraries from maven central, and you can add a couple of lines to your build.gradle to go fetch a specific version of your library from maven central, rather than manually adding that library jar to the project that is using it. If your library code is on github, there are ways to publish to maven central from github ( http://datumedge.blogspot.com/2012/05/publishing-from-github-to-maven-central.html ) but I don't have experience with that step.

How to add a specific Google play Services api to Eclipse android project

i simply need an OAuth 2.0 token to authorize requests with Google for REST APIs. so I need to import the google play service sdk.
specifically the:
Google Account Login com.google.android.gms:play-services-identity:8.1.0
I am using eclipse I only want to import the Google account login api, but there is no instructions on how to do so.
if there is no solution, how can I grab the Jar referenced in the dependencies for android studio projects https://developers.google.com/android/guides/setup
There is a solution I guess. Try this:
Go to "android_sdk\extras\google\m2repository\com\google\android\gms\play-services-identity\8.1.0\"
Copy "play-services-identity-8.1.0.aar" to your eclipse project's /libs directory.
Open "project.properties" file and add this line: android.libraries.reference.1=libs/play-services-identity-8.1.0/ and Run Application.
And if it didn't work, try setting up your project with com.google.android.gms:play-services-identity:8.1.0 in android studio and import/export gradle project in/for eclipse. It will most probably resolves the included dependencies automatically to work with eclipse.
Hope it helps.

should I check in the Google Play services library project to source version control for GCM support?

I already added the support for GCM at our android app, however one thing bothers me is about the Google Play services library project. Based on this link Set Up Google Play Services SDK, I should do the following at step 4:
Make a copy of the Google Play services library project.
If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
We are using eclipse. So to allow other developer to build our app project without doing any manual work, I checked in the Google Play services library project into our version control (SVN) and add that project as part of our app project.
However I am not sure whether I should check that project into our source version control or not. One thing I also found out that google-play-services_lib.jar file is modified today, however I didn't do anything to that jar and I don't have any idea how it got updated. Should I check in the new version of the jar file? Again this still goes back to whether I should check in the Google Play services library project in the first place.
Could someone with GCM experience shed some lights what's the best approach here?
Update 1 at Jan 16:
Per the answer below, we could add a Google play services jar file to our app project, however based on this link, Implementing GCM Client, it has the following:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK. The key point is that you must reference the library—simply adding a .jar file to your Eclipse project will not work. You must follow the directions for referencing a library, or your app won't be able to access the library's resources, and it won't run properly
So that would means that we could not just simple add the jar file.
Your library compiles first whenever you compile your application, as library projects create jar your Google Play Services jar will be updated on every run.
As the library incluse resources you cant create the jar and add them in to your java build path there two possible ways to get rid of this :
Move to Android Studio which uses .aar files which contains all your andorid resources in archive. Read more from refrence.
Prevent libray project to compile each and every time you run the app in eclipse. Click Here to know how to do that.

Google Play Services *with resources*

The guide to setting up GCM here: https://developer.android.com/google/gcm/client.html specifies:
Caution: When you add the Play Services library to your project, be sure to add it with resources, as described in Setup Google Play Services SDK.
Then the page it links to (https://developer.android.com/google/play-services/setup.html#Setup) never mentions the 'with resources' bit.
Does anyone know what this means, as I fear I've missed something when setting up my play services project.
With recources means as library project, not as JAR file.
Install the Google Play services from SDK manager.
After install it will be at /extras/google/google_play_services/libproject/google-play-services_lib/
So? you can copy this folder in you workspace? if you need.
If you are using Eclipse, import the library project into your workspace. Click File > Import, select Android > Existing Android Code into Workspace, and browse to the copy of the library project to import it.
Add Referense to Google Play services in your project. Example http://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
Does anyone know what this means
I suspect that it is a clumsy way of emphasizing that you need to attach the Play Services SDK Android library project to your app, rather than just copying over some JAR.

Android - Google Maps, Google Play Services library referencing

Is there any better way (easy) to reference the Google Play Services lib(.jar)
than, importing the Google Play Services project from Android SDK directory into Current project's Eclipse workspace?
P.s.:- Because this is bit confusing for a novice android developer!!!
Thanks for your advice in Advance!
You can find the .jar file inside the libs folder of imported library(...\android-sdk\extras\google\google_play_services\libproject\google-play-services_lib\libs).
But referencing only that jar file may be improper. I tried to do so for google maps, but didn't work. Suggested way is to import that library project to the workspace and refer the whole.

Categories

Resources