迁移到新的 Places SDK 客户端 | E/SchedPolicy: set_timerslack_ns 写入失败:不允许操作

Migrating to the New Places SDK Client | E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted

迁移到新的 Places SDK 客户端 https://developers.google.com/places/android-sdk/client-migration

我正在尝试使用 Embed an AutocompleteFragment 进行迁移,显然它可以正常工作,直到收到 select 的 return ed位置,因为下面的代码允许打开片段,输入位置并在列表中select它,但之后,出现下面报告的错误并且不执行onPlaceSelected()onError()例程.

代码布局如下:

<fragment
    android:id="@+id/autocomplete_fragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone"
    android:name="com.google.android.libraries.places.widget.AutocompleteSupportFragment" />

以下代码函数:

public void mostraPesquisa(boolean set) {
    if (MainActivity.this.isDestroyed()) return;
    if (!Places.isInitialized()) { Places.initialize(MainActivity.this, getResources().getString(R.string.google_maps_key)); }

    // Initialize the AutocompleteSupportFragment.
    AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment) getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
    autocompleteFragment.getView().setVisibility(set ? VISIBLE : GONE);
    autocompleteFragment.setPlaceFields(Arrays.asList(Place.Field.ID, Place.Field.NAME));
    autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
        @Override
        public void onPlaceSelected(@NonNull Place place) {
            Log.w(TAG, "Place: " + place.getName() + ", " + place.getId());
        }

        @Override
        public void onError(@NonNull Status status) {
            Log.e(TAG, "AutocompleteSupportFragment - Ocorreu um erro: " + status);
        }
    });
}

正在关注 logcat:

W/IInputConnectionWrapper: getExtractedText on inactive InputConnection
W/libEGL: EGLNativeWindowType 0x6f97da4010 disconnect failed
E/SchedPolicy: set_timerslack_ns write failed: Operation not permitted
W/MainActivity: onActivityResult(95957,-1,Intent { (has extras) })
W/libEGL: EGLNativeWindowType 0x6f753f4010 disconnect failed
W/System.err: java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference
W/System.err:     at android.view.ViewRootImpl.getHostVisibility(ViewRootImpl.java:1786)
W/System.err:     at android.view.ViewRootImpl.handleAppVisibility(ViewRootImpl.java:1422)
W/System.err:     at android.view.ViewRootImpl$ViewRootHandler.handleMessage(ViewRootImpl.java:4818)
W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:106)
W/System.err:     at android.os.Looper.loop(Looper.java:214)
W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:7073)
W/System.err:     at java.lang.reflect.Method.invoke(Native Method)
W/System.err:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:964)

我在 logcat 中注意到这个函数是 returning:

W / MainActivity: onActivityResult (358101, -1, Intent {(has extras)})

在那之后,我创建了一个新的干净项目来测试这个资源并使用相同的代码和函数 returned:

W / MapsActivity: Place: Curitiba, ChIJ3bPNUVPj3JQRCejLuqVrL20 (rigth return in onPlaceSelected)

我认为新的 AutocompleteSupportFragment 中存在错误,因为 return 调用 onPlaceSelected,在onActivityResult中returning .

相同的错误 (W/System.err:) 在这两种情况下仍然存在,但总是在上述 returns 之后。

知道这个问题的原因吗?

我也通过调用

解决了这个问题
super.onActivityResult(requestCode, resultCode, data);

错误继续出现在日志中,但现在至少响应返回到 onPlaceSelected 而不是 onActivityResult