2

私は、google-play-services を使用して Geofences API を利用する Android Studio で android-library プロジェクトを開発しています。

Play Services を含めるには、Android の公式ドキュメント ( http://developer.android.com/google/play-services/setup.html#Setup )とまったく同じように maven (gradle.build ファイルのビルド ルール) を使用します。この android-library ではGooglePlayServicesUtil.isGooglePlayServicesAvailableLocationClient.

Log.d(TAG, "Registering geofences");
try{
    if(GooglePlayServicesUtil.isGooglePlayServicesAvailable(this) != ConnectionResult.SUCCESS){
        Log.e(TAG, "Google Play Services unavailable");
        return;
    }else
        Log.d(TAG, "Google Play Services are available");
    Log.d(TAG, "creating LocationClient");
    locationClient = new LocationClient(context, this, this);
    Log.d(TAG, "connecting LocationClient");
    locationClient.connect();
} catch (Exception e) {
    e.printStackTrace();
}

Logcat から取得したログは次のとおりです。

04-11 09:45:27.331  23741-23781/foo.bar.myoldapp D/AWRLocationService﹕ Registering geofences
04-11 09:45:27.331  23741-23781/foo.bar.myoldapp W/dalvikvm﹕ VFY: unable to resolve static field 3086 (common_google_play_services_install_title) in Lcom/google/android/gms/R$string;
04-11 09:45:27.331  23741-23781/foo.bar.myoldapp D/dalvikvm﹕ VFY: replacing opcode 0x60 at 0x004b
{... and around 20 similar lines ...}
04-11 09:45:27.341  23741-23781/foo.bar.myoldapp E/GooglePlayServicesUtil﹕ The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
04-11 09:45:27.351  23741-23781/foo.bar.myoldapp D/AWRLocationService﹕ Google Play Services are available
04-11 09:45:27.351  23741-23781/foo.bar.myoldapp D/AWRGeofencesReceiver﹕ creating LocationClient
04-11 09:45:27.351  23741-23781/foo.bar.myoldapp W/dalvikvm﹕ VFY: unable to resolve static field 3100 (location_client_powered_by_google) in Lcom/google/android/gms/R$string;
04-11 09:45:27.351  23741-23781/foo.bar.myoldapp D/dalvikvm﹕ VFY: replacing opcode 0x60 at 0x0019
04-11 09:45:30.731  23741-23741/foo.bar.myoldapp D/AWRWifiScanResultBroadcastReceiver﹕ onReceive

ご覧のとおり、Google Play サービスは、私にはわからない理由で完全には含まれていないようです (Google が私に求めた方法でそれらを含めているため)。しかし、GooglePlayServicesUtil.isGooglePlayServicesAvailabletrue を返すので、それらは存在しているように見えます。次に、LocationClient をインスタンス化しますが、何も起こりません。例外はスローされず、エラー ログも表示されません。私は何を間違えましたか?

4

0 に答える 0