Sunday, February 23, 2014

integrating google_play_service with phone gap android application

It was even very painful foe me while integrating the Google Admobs which requires google_play_services to be integrated ! here is my share of tricks how I solved the play services Build problem.

When you try to publish an app you have to create a release build for which either you have to create release build with below command

  • ant release
  • cordova build --release

If you have not built anytime the play service with ant
You get the following error !

D:\workspace\HTML5\Wordizy>ant debug/release
Buildfile: build.xml does not exist!
Build failed

to fix this (ant must have been setup)
copy the whole google-play-services_lib folder from ANDROID_SDK_PATH\extras\google\google_play_services\libproject\to your project root directory.
copy
build.xml
local.properties
project.properties
files from root folder/Cordova lib folder to google-play-services_lib folder

Change the project.properties file's project target to the right target (very important)

split.density=false
# Project target.
target=android-19 (important)
android.library=true

change android.library.reference.2=google-play-services_lib in your root/project project.properties file

Stand on the google-play-services-lib and in the cmd editor supply
android update project -p . (dot=current folder) you should not be getting any error
then supply the command
ant debug success
ant release success

Now you are done !

You can also call cordova build --release command at the root folder of the application and it should create a unsigned-release.apk file.

No comments:

Post a Comment