我的应用程序在没有安卓工作室的Google Play服务的情况下无法运行?

时间:2017-05-28 14:16:30

标签: java android google-play-services

我要创建谷歌地图示例应用程序,但我在模拟器上运行应用程序时出现问题,此消息显示:我的应用程序无法在没有您支持的Google Play服务的情况下运行设备 ,看看这些图片:enter image description here

//log cat errror 


 05-28 08:14:19.593 660-674/system_process E/ActivityManager: ANR in com.android.systemui
                                                             PID: 748
                                                             Reason: executing service com.android.systemui/.SystemUIService
                                                             Load: 5.34 / 1.87 / 0.67
                                                             CPU usage from 0ms to 13211ms later:
                                                               87% 660/system_server: 12% user + 75% kernel / faults: 5065 minor 14 major
                                                               51% 370/surfaceflinger: 2.6% user + 48% kernel / faults: 18 minor 1 major
                                                               37% 748/com.android.systemui: 4.7% user + 32% kernel / faults: 5005 minor 16 major
                                                               24% 8/rcu_preempt: 0% user + 24% kernel
                                                               15% 102/debuggerd: 1.3% user + 14% kernel / faults: 2346 minor
                                                               20% 290/local_opengl: 0.3% user + 20% kernel / faults: 8 minor
                                                               11% 54/kworker/0:1: 0% user + 11% kernel
                                                               12% 20/ksoftirqd/3: 0% user + 12% kernel
                                                               12% 114/adbd: 0.3% user + 12% kernel / faults: 80 minor
                                                               9.8% 326/mediaserver: 1.5% user + 8.3% kernel / faults: 105 minor 3 major
                                                               5.7% 16/ksoftirqd/2: 0% user + 5.7% kernel
                                                               5.7% 394/bootanimation: 0.4% user + 5.2% kernel
                                                               3.9% 3/ksoftirqd/0: 0% user + 3.9% kernel
                                                               3.1% 284/healthd: 0.1% user + 2.9% kernel
                                                               2.9% 938/zygote: 0.5% user + 2.4% kernel / faults: 335 minor
                                                               1% 59/kworker/3:1: 0% user + 1% kernel
                                                               0.3% 15/migration/2: 0% user + 0.3% kernel
                                                               0.2% 11/migration/1: 0% user + 0.2% kernel
                                                               0.1% 7/migration/0: 0% user + 0.1% kernel
                                                               0.8% 19/migration/3: 0% user + 0.8% kernel
                                                               0.5% 12/ksoftirqd/1: 0% user + 0.5% kernel
                                                               0.3% 1//init: 0% user + 0.3% kernel
                                                               0.3% 79/logd: 0% user + 0.3% kernel / faults: 3 minor
                                                               0.3% 177/logcat: 0% user + 0.3% kernel
                                                               0.3% 286/servicemanager: 0% user + 0.3% kernel
                                                               0.1% 58/kworker/2:1H: 0% user + 0.1% kernel
                                                               0.2% 324/netd: 0% user + 0.2% kernel / faults: 17 minor
                                                               0.1% 56/kworker/2:1: 0% user + 0.1% kernel
                                                               0% 30/kworker/1:1: 0% user + 0% kernel
                                                               0% 77/jbd2/sdb3-8: 0% user + 0% kernel
                                                               0% 98/genyd: 0% user + 0% kernel
                                                               0% 291/local_gps: 0% user + 0% kernel / faults: 5 minor
                                                               0% 723/wpa_supplicant: 0% user + 0% kernel
                                                               0% 732/sdcard: 0% user + 0% kernel / faults: 20 minor
                                                              +0% 1008/kworker/1:2: 0% user + 0% kernel
                                                             62% TOTAL: 4.1% user + 49% kernel + 2.3% iowait + 7.1% softirq
                                                             CPU usage from 12446ms to 13050ms later:
                                                               107% 660/system_server: 16% user + 91% kernel / faults: 272 minor
                                                                 41% 664/Signal Catcher: 6.7% user + 34% kernel
                                                                 17% 672/Binder_2: 2.6% user + 14% kernel
                                                                 12% 671/Binder_1: 2.6% user + 9.3% kernel
                                                                 12% 674/ActivityManager: 0% user + 12% kernel
                                                                 8% 984/RenderThread: 1.3% user + 6.7% kernel
                                                                 5.3% 802/Thread-74: 1.3% user + 4% kernel
                                                                 5.3% 992/Binder_5: 0% user + 5.3% kernel
                                                                 4% 673/android.bg: 1.3% user + 2.6% kernel
                                                                 2.6% 686/SensorService: 0% user + 2.6% kernel
                                                               88% 370/surfaceflinger: 0% user + 88% kernel / faults: 1 minor
                                                                 32% 370/surfaceflinger: 0% user + 32% kernel
                                                                 17% 1012/Binder_4: 0% user + 17% kernel
                                                                 12% 390/POSIX timer 1: 0% user + 12% kernel
                                                                 9.3% 377/Binder_2: 0% user + 9.3% kernel
                                                                 6.6% 376/DispSync: 0% user + 6.6% kernel
                                                                 6.6% 391/EventThread: 1.3% user + 5.3% kernel
                                                                 4% 392/EventControl: 0% user + 4% kernel
                                                                 2.6% 382/VSyncThread: 0% user + 2.6% kernel
                                                                 1.3% 624/Binder_3: 0% user + 1.3% kernel
                                                               25% 394/bootanimation: 0% user + 25% kernel
                                                                 18% 403/BootAnimation: 1.3% user + 17% kernel
                                                                 8% 400/Binder_1: 0% user + 8% kernel
                                                               18% 290/local_opengl: 0% user + 18% kernel / faults: 6 minor
                                                                 14% 379/local_opengl: 0% user + 14% kernel
                                                                +0% 1014/local_opengl: 0% user + 0% kernel
                                                               19% 748/com.android.systemui: 0% user + 19% kernel / faults: 105 minor 4 major
                                                                 17% 748/ndroid.systemui: 0% user + 17% kernel
                                                               6.6% 8/rcu_preempt: 0% user + 6.6% kernel
                                                               3.3% 3/ksoftirqd/0: 0% user + 3.3% kernel
                                                               1.2% 114/adbd: 0% user + 1.2% kernel / faults: 7 minor
                                                                 1.8% 114/adbd: 0% user + 1.8% kernel
                                                                 0.6% 170/adbd: 0% user + 0.6% kernel
                                                                 0.6% 171/adbd: 0% user + 0.6% kernel
                                                               0.5% 59/kworker/3:1: 0% user + 0.5% kernel
                                                               0.6% 723/wpa_supplicant: 0.6% user + 0% kernel
                                                             62% TOTAL: 7.9% user + 48% kernel + 0.7% iowait + 5.5% softirq
05-28 08:14:19.612 660-674/system_process I/ActivityManager: Killing 74


    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hamoda.g_maps">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.INTERNET" />
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <!--
        -->
        <meta-data
            android:name="com.google.android.geo.API_KEY"
            android:value="AIzaSyAXhBdyKxUo_cb-EkSgWJQTdqR0QjLcqes" />
        <activity
            android:name=".MapsActivity"
            android:label="@string/title_activity_maps">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>


    package com.example.hamoda.g_maps;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.OnMapReadyCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;


public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

    private GoogleMap mMap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_maps);
        // Obtain the SupportMapFragment and get notified when the map is ready to be used.
        SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                .findFragmentById(R.id.map);
        mapFragment.getMapAsync(this);
    }

    /**
     * Manipulates the map once available.
     * This callback is triggered when the map is ready to be used.
     * This is where we can add markers or lines, add listeners or move the camera.
     * In this case, we just add a marker near Sydney, Australia.
     * If Google Play services is not installed on the device.
     * This method will only be triggered once the user has installed
     Google Play services and returned to the app.
     */

    @Override
    public void onMapReady(GoogleMap googleMap) {
        mMap = googleMap;
        // Add a marker in Sydney and move the camera
        LatLng TutorialsPoint = new LatLng(21, 57);
        mMap.addMarker(new
                MarkerOptions().position(TutorialsPoint).title("Tutorialspoint.com"));
        mMap.moveCamera(CameraUpdateFactory.newLatLng(TutorialsPoint));
    }
}



    <resources>
    <!--
    TODO: Before you run your application, you need a Google Maps API key.
    To get one, follow this link, follow the directions and press "Create" at the end:
    https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=54:0A:E2:07:DA:48:7C:25:5A:3D:84:1F:93:22:55:AE:35:0C:0A:AC%3Bcom.example.hamoda.g_maps
    You can also add your credentials to an existing key, using these values:
    Package name:
    54:0A:E2:07:DA:48:7C:25:5A:3D:84:1F:93:22:55:AE:35:0C:0A:AC
    SHA-1 certificate fingerprint:
    54:0A:E2:07:DA:48:7C:25:5A:3D:84:1F:93:22:55:AE:35:0C:0A:AC
    Alternatively, follow the directions here:
    https://developers.google.com/maps/documentation/android/start#get-key
    Once you have your key (it starts with "AIza"), replace the "google_maps_key"
    string in this file.
    -->
    <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
        AIzaSyCryt_PB6SwbJOEuyxdjCh1WDc_j4C7ln0
    </string>
</resources>


    <resources>
    <!--
    TODO: Before you run your application, you need a Google Maps API key.
    To get one, follow this link, follow the directions and press "Create" at the end:
    https://console.developers.google.com/flows/enableapi?apiid=maps_android_backend&keyType=CLIENT_SIDE_ANDROID&r=54:0A:E2:07:DA:48:7C:25:5A:3D:84:1F:93:22:55:AE:35:0C:0A:AC%3Bcom.example.hamoda.g_maps
    You can also add your credentials to an existing key, using these values:
    Package name:
    54:0A:E2:07:DA:48:7C:25:5A:3D:84:1F:93:22:55:AE:35:0C:0A:AC
    SHA-1 certificate fingerprint:
    54:0A:E2:07:DA:48:7C:25:5A:3D:84:1F:93:22:55:AE:35:0C:0A:AC
    Alternatively, follow the directions here:
    https://developers.google.com/maps/documentation/android/start#get-key
    Once you have your key (it starts with "AIza"), replace the "google_maps_key"
    string in this file.
    -->
    <string name="google_maps_key" templateMergeStrategy="preserve" translatable="false">
        AIzaSyCryt_PB6SwbJOEuyxdjCh1WDc_j4C7ln0
    </string>
</resources>

1 个答案:

答案 0 :(得分:0)

使用安装了Google Play商店的模拟器系统映像,以确保您拥有最新版本的Google Play服务(Google Maps示例所依赖的)。您可以使用API​​ 24 x86 Google Play图像或Android O Google Play图像创建AVD。 Google Play Store version of system Images