如何在没有Google Play服务的情况下设置Android模拟器

Joh*_*oll 4 android intellij-idea

一位客户要求我制作我的应用程序的版本,使其可以在没有Google Play服务的设备上运行。

有没有办法告诉Android模拟器在不使用GPS的情况下运行该应用程序?

然后,我可以测试代码以确保它可以在客户端设备上运行。

小智 5

使用不包含google API的系统映像。

您会在照片中看到两种类型的图像。

包含它的文件将被命名为Google Api系统映像,或者您可以使用genymotion它默认情况下未安装google api。

另外,请确保您可以使用此方法检查是否安装了Google Play服务

    private boolean checkPlayServices() {

    int resultCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    if (resultCode != ConnectionResult.SUCCESS) {
        if (GooglePlayServicesUtil.isUserRecoverableError(resultCode)) {
            GooglePlayServicesUtil.getErrorDialog(resultCode, this,
                    PLAY_SERVICES_RESOLUTION_REQUEST).show();
        } else {
            Log.i("MY TAG GCM", "This device is not supported.");
            finish();
        }
        return false;
    }
    return true;
}
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明