我正在尝试在我的 android 中从 Google 地图中查找位置,我的代码是
PlaceAutocompleteFragment autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
// TODO: Get info about the selected place.
Log.i(TAG, "Place: " + place.getName());
String placeDetailsStr = place.getName() + "\n"
+ place.getId() + "\n"
+ place.getLatLng().toString() + "\n"
+ place.getAddress() + "\n"
+ place.getAttributions();
}
@Override
public void onError(Status status) {
// TODO: Handle the error.
Log.i(TAG, "An error occurred: " + status);
}
});
但是当我尝试输入某些内容时,它会因错误而崩溃
FATAL EXCEPTION: main Process: com.example.asset.lab13_bonus, PID: 1192
java.lang.NoSuchMethodError: No virtual method zzbo(Landroid/content/Context;)V in class Lcom/google/android/gms/common/GoogleApiAvailability; or its super classes (declaration of 'com.google.android.gms.common.GoogleApiAvailability' appears in /data/app/com.example.asset.lab13_bonus-bAk1S6P8t8HToIo1FR8JeA==/split_lib_dependencies_apk.apk:classes12.dex)
at com.google.android.gms.location.places.ui.zza$zza.build(Unknown Source:79)
at com.google.android.gms.location.places.ui.PlaceAutocomplete$IntentBuilder.build(Unknown Source:0)
at com.google.android.gms.location.places.ui.PlaceAutocompleteFragment.zzboi(Unknown Source:42)
at com.google.android.gms.location.places.ui.PlaceAutocompleteFragment.zza(Unknown Source:0)
at com.google.android.gms.location.places.ui.PlaceAutocompleteFragment$1.onClick(Unknown Source:2)
at android.view.View.performClick(View.java:6256)
at android.view.View$PerformClick.run(View.java:24697)
at android.os.Handler.handleCallback(Handler.java:789)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
摇篮依赖:
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.google.android.gms:play-services-places:9.4.0'
compile "com.google.android.gms:play-services-base:9.4.0"
这是什么意思 ?有人能帮我吗?可能是因为设备的原因它不起作用?