AndroidStudioでGoogle Play Service APIs を利用できるように設定する
Google Places API for Androidを利用したかったので、AndroidアプリでGoogle Play Service APIs を利用する方法について調べたのでメモしておきます。
Eclipseについては下記のgoogle公式ページ内の"ECLIPSE WITH ADT"を参考にしてください。
参考ページ Setting Up Google Play Services
AndroidStudioのプロジェクト内にあるbuild.gradleに以下の記述を追加
dependencies { compile 'com.google.android.gms:play-services:7.5.0' }
以上で、Google Play Services APIsを利用できるようになります。
エラーについて
実行時に以下のようなエラーが出ることがあります。
Google Play services out of date. Requires xxxxxxx but found xxxxxxxx
これは端末にインストールされている、「Google Play開発者サービス」アプリケーションの
バージョンが古いことが原因です。
google Play store からアプリをアップデートすれば、解決されます。
google store で検索しても出てこない? ので、URLを記載しておきます。
Google Play開発者サービス - Google Play の Android アプリ
gradleはライブラリの依存関係が大分簡単になるので、とても便利だなと思います。