Google services added Force close application with log cat error

后端 未结 7 1629
無奈伤痛
無奈伤痛 2021-01-06 12:23

I have been developing a simple app for load a map view. I have followed the API. https://developers.google.com/maps/documentation/android/start#add_a_map

BUT

相关标签:
7条回答
  • 2021-01-06 12:24

    Google must update Google play services to version 4.xxx enter image description here

    0 讨论(0)
  • 2021-01-06 12:25

    Use the previous version of Google Play Services libproject for now. It can be downloaded from here: https://dl-ssl.google.com/android/repository/google_play_services_3225130_r10.zip

    Worked for me.

    You can then update this later when Google makes the latest version available to everyone but something tells me it will be a while before this change propagates to all the devices out there.

    0 讨论(0)
  • 2021-01-06 12:27

    I have the same problem when running the app on my 2012 N7 running 4.3.

    I don't think the actual released version of Play Services matches the SDK version in version.xml:

    google_play_services_version 4030500
    

    So it's either a case of waiting for a Play Services update on Play Store, or possibly try changing the version.xml in google-play-services_lib.

    0 讨论(0)
  • 2021-01-06 12:30

    Do these 2 steps and let me know please

    1st update your Google play services as show here enter image description here

    2nd try out this new manifest file that i have created for you

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.newgmaps"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk
            android:minSdkVersion="11"
            android:targetSdkVersion="11" />
    
        <permission
            android:name="com.example.newgmaps.permission.MAPS_RECEIVE"
            android:protectionLevel="signature" />
    
        <uses-permission android:name="icom.example.newgmaps.permission.MAPS_RECEIVE" />
        <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
        <uses-permission android:name="android.permission.INTERNET" />
        <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
        <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
        <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
        <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
        <uses-feature
            android:glEsVersion="0x00020000"
            android:required="true" />
    
        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@style/AppTheme" >
            <meta-data
                android:name="com.google.android.gms.version"
                android:value="4030500" />
            <meta-data
                android:name="com.google.android.maps.v2.API_KEY"
                android:value="AIzaSyA5QozHkGwJP_9iJi7jtBV938T1wws02gA" />
    
            <activity
                android:name="com.example.newgmaps.MainActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
        </application>
    
    </manifest>
    

    let me know if you solved this problem also Thank you

    0 讨论(0)
  • 2021-01-06 12:32

    I added this below xml code in "AndroidManifest.xml"

    <Application 
    ...
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
    ...
    </Application>
    

    The crash error was disappeared. But when I call...

    int iErrorCode = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
    

    "iErrorCode" is 2. 2 means like this

    public static final int SERVICE_VERSION_UPDATE_REQUIRED The installed version of Google Play services is out of date. The calling activity should pass this error code to getErrorDialog(int, Activity, int) to get a localized error dialog that will resolve the error when shown. Constant Value: 2 (0x00000002) Details...

    And also LogCat said...

    W/GooglePlayServicesUtil(4728): Google Play services out of date. Requires 4030500 but found 3266136

    Where is version code "4030500"??

    [SDK]\extras\google\google_play_services\libproject\google-play-services_lib\res\values

    You can see "version.xml". Open it!

    <?xml version="1.0" encoding="utf-8"?> <resources>
        <integer name="google_play_services_version">4030500</integer>
    </resources>
    

    Peekaboo~~! :) This is why we got this errorCode(2) when update new SDK and use new "google-play-services-lib".

    Okay! Got it! Let's check my Google Play Version on my device.

    enter image description here

    The version on my phone is "4.4.21" There is no problem I think. What is this "3266136"? Where were this from? I cannot understand this.

    If I figure this out, I will update this long answer.

    Good luck! Everybody! :)

    Updated 1: I downloaded apk 4.4.22 and installed on my phone. But, LogCat still show me "3266136". This is really odd thing. I think Google-Team have to fix it ASAP!!

    4.4.22 Download here...

    Updated 2: After all, I decided to down-grade "google-play-services_lib" and "android-support-v4.jar" to previous version. I will be wait for them. :)

    0 讨论(0)
  • 2021-01-06 12:49

    If you start the Android SDK manager you should see a "Google play services for Froyo" module. Install and use this instead of the "new" version. This worked for me.

    0 讨论(0)
提交回复
热议问题