我正在使用以下代码启动地方选择器API。
try {
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
startActivityForResult(builder.build(getActivity()), PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e) {
} catch (GooglePlayServicesNotAvailableException e) {
}
manifest.xml
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/places_api_key"/>
设备:coolpad Y91-100 Android版本:6.0.1 我还在aosp项目中提出了一个问题。发行编号:228328 即使我尝试从github项目运行google placepicker示例应用程序,我也遇到了同样的崩溃。链接到它的github项目 https://github.com/googlesamples/android-play-places
Following are the crash logs:
Process: com.google.android.gms.ui, PID: 19319
11-21 20:02:00.255 19319 19319 E AndroidRuntime: java.lang.RuntimeException: Unable to resume activity {com.google.android.gms/com.google.android.location.places.ui.placepicker.PlacePickerActivity}: java.lang.NullPointerException: Attempt to invoke interface method 'void maps.ad.y.o()' on a null object reference
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3103)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3134)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread.access$900(ActivityThread.java:150)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:102)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.os.Looper.loop(Looper.java:148)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:5417)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: Caused by: java.lang.NullPointerException: Attempt to invoke interface method 'void maps.ad.y.o()' on a null object reference
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at maps.ad.R.b(Unknown Source)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at xx.onTransact(:com.google.android.gms.DynamiteModulesB:73)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.os.Binder.transact(Binder.java:387)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at tsc.b(:com.google.android.gms:233)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at tps.a(:com.google.android.gms:124)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at oau.b(:com.google.android.gms:340)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at oaq.a(:com.google.android.gms:143)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.gms.maps.MapView.a(:com.google.android.gms:7332)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at almv.onResume(:com.google.android.gms:92)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.FragmentProxy.onResume(:com.google.android.gms:432)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.a(:com.google.android.gms:12120)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.a(:com.google.android.gms:1286)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.a(:com.google.android.gms:1268)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.p(:com.google.android.gms:2153)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.a(:com.google.android.gms:12126)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.a(:com.google.android.gms:1286)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.a(:com.google.android.gms:1268)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gm.p(:com.google.android.gms:2153)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gc.onResumeFragments(:com.google.android.gms:11223)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.container.ActivityProxy.superOnResumeFragments(:com.google.android.gms:2418)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.Activity.onResumeFragments(:com.google.android.gms:372)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.Activity.publicOnResumeFragments(:com.google.android.gms:377)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.container.ActivityProxy.onResumeFragments(:com.google.android.gms:471)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at gc.onPostResume(:com.google.android.gms:511)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.container.ActivityProxy.superOnPostResume(:com.google.android.gms:2413)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.Activity.onPostResume(:com.google.android.gms:363)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.appcompat.AppCompatActivity.onPostResume(:com.google.android.gms:183)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.Activity.publicOnPostResume(:com.google.android.gms:368)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at com.google.android.chimera.container.ActivityProxy.onPostResume(:com.google.android.gms:462)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.Activity.performResume(Activity.java:6385)
11-21 20:02:00.255 19319 19319 E AndroidRuntime: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3092)