このようなコードで、elseに入ってしまうのですが、
java
1 Location currentLocation = fusedLocationProviderApi.getLastLocation(mGoogleApiClient); 2 3 if (currentLocation != null && currentLocation.getTime() > 20000) { 4 location = currentLocation; 5 6 textLog += "---------- onConnected \n"; 7 textLog += "Latitude=" + String.valueOf(location.getLatitude()) + "\n"; 8 textLog += "Longitude=" + String.valueOf(location.getLongitude()) + "\n"; 9 textLog += "Accuracy=" + String.valueOf(location.getAccuracy()) + "\n"; 10 textLog += "Altitude=" + String.valueOf(location.getAltitude()) + "\n"; 11 textLog += "Time=" + String.valueOf(location.getTime()) + "\n"; 12 textLog += "Speed=" + String.valueOf(location.getSpeed()) + "\n"; 13 textLog += "Bearing=" + String.valueOf(location.getBearing()) + "\n"; 14 textView.setText(textLog); 15 16 Log.d("debug", textLog); 17 18 } else { 19 // バックグラウンドから戻ってしまうと例外が発生する場合がある 20 try { 21 // 22 fusedLocationProviderApi.requestLocationUpdates(mGoogleApiClient, locationRequest, this); 23 // Schedule a Thread to unregister location listeners 24 Executors.newScheduledThreadPool(1).schedule(new Runnable() { 25 @Override 26 public void run() { 27 fusedLocationProviderApi.removeLocationUpdates(mGoogleApiClient, LocationActivity.this); 28 } 29 }, 60000, TimeUnit.MILLISECONDS); 30 31 textLog += "onConnected(), requestLocationUpdates \n"; 32 textView.setText(textLog); 33 34 } catch (Exception e) { 35 e.printStackTrace(); 36 Toast toast = Toast.makeText(this, "例外が発生、位置情報のPermissionを許可していますか?", Toast.LENGTH_SHORT); 37 toast.show(); 38 39 //MainActivityに戻す 40 finish(); 41 } 42 }
androidタブレットは23のため、サポートライブラリを23に合わせました。そしたら、
このサポートライブラリは、compileSdkVersion(25)以下のバージョン(23)を使用しないでください...(⌘F1)
互換性がない、またはバグにつながるライブラリやツールやライブラリの組み合わせがいくつかあります。このような非互換性の1つは、Androidサポートライブラリの最新バージョン(または特にtargetSdkVersionよりも低いバージョン)ではないバージョンでコンパイルされています。
このようなエラーが出ました。
25.0.1に直したのですが、どうすれば、上記のif文の中に入れるでしょうか?
アドバイスをお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。