获取错误“;Google Play服务不可用。此应用程序将关闭";在Android设备上安装Android版本4.1.2

获取错误“;Google Play服务不可用。此应用程序将关闭";在Android设备上安装Android版本4.1.2,android,android-studio,Android,Android Studio,我是Android编程世界的新手。 我正在尝试使用上的文档创建一个G+登录。 (我是用安卓工作室做的) 我成功地登录和注销了我的Moto-G(Android版本5.0.2)。然而,我不能对三星Galaxy Trend(Android版本4.1.2)做同样的事情。我在这里遇到的错误是:“Google Play服务不可用。此应用程序将关闭。” 除了文档中提到的以外,我没有做任何事情。 有人能告诉我这里出了什么问题吗 谢谢 当我的android没有更新时,我就遇到了这种情况。这是我2年前使用的检查代码

我是Android编程世界的新手。 我正在尝试使用上的文档创建一个G+登录。 (我是用安卓工作室做的)

我成功地登录和注销了我的Moto-G(Android版本5.0.2)。然而,我不能对三星Galaxy Trend(Android版本4.1.2)做同样的事情。我在这里遇到的错误是:“Google Play服务不可用。此应用程序将关闭。

除了文档中提到的以外,我没有做任何事情。 有人能告诉我这里出了什么问题吗


谢谢

当我的android没有更新时,我就遇到了这种情况。这是我2年前使用的检查代码

**
     * Verify that Google Play services is available before making a request.
     *
     * @return true if Google Play services is available, otherwise false
     */
    private boolean servicesConnected() {

        // Check that Google Play services is available
        int resultCode =
                GooglePlayServicesUtil.isGooglePlayServicesAvailable(getActivity());

        // If Google Play services is available
        if (ConnectionResult.SUCCESS == resultCode) {
            // In debug mode, log the status
            //Log.d(LocationUtils.APPTAG, getString(R.string.play_services_available));

            // Continue
            return true;
            // Google Play services was not available for some reason
        } else {
            // Display an error dialog
            Dialog dialog = GooglePlayServicesUtil.getErrorDialog(resultCode, getActivity(), 0);
            if (dialog != null) {
                ErrorDialogFragment errorFragment = new ErrorDialogFragment();
                errorFragment.setDialog(dialog);
                errorFragment.show(getFragmentManager(), "Baja Wanted");
            }
            return false;
        }
    }

    /**
     * Show a dialog returned by Google Play services for the
     * connection error code
     *
     * @param errorCode An error code returned from onConnectionFailed
     */
    private void showErrorDialog(int errorCode) {

        // Get the error dialog from Google Play services
        Dialog errorDialog = GooglePlayServicesUtil.getErrorDialog(
                errorCode,
                getActivity(),
                CONNECTION_FAILURE_RESOLUTION_REQUEST);

        // If Google Play services can provide an error dialog
        if (errorDialog != null) {

            // Create a new DialogFragment in which to show the error dialog
            ErrorDialogFragment errorFragment = new ErrorDialogFragment();

            // Set the dialog in the DialogFragment
            errorFragment.setDialog(errorDialog);

            // Show the error dialog in the DialogFragment
            errorFragment.show(getFragmentManager(), "Baja Wanted");
        }
    }
}

/**
 * Define a DialogFragment to display the error dialog generated in
 * showErrorDialog.
 */
public static class ErrorDialogFragment extends DialogFragment {

    // Global field to contain the error dialog
    private Dialog mDialog;

    /**
     * Default constructor. Sets the dialog field to null
     */
    public ErrorDialogFragment() {
        super();
        mDialog = null;
    }

    /**
     * Set the dialog to display
     *
     * @param dialog An error dialog
     */
    public void setDialog(Dialog dialog) {
        mDialog = dialog;
    }

    /*
     * This method must return a Dialog to the DialogFragment.
     */
    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        return mDialog;
    }
}
}

谷歌播放服务