After the upgrade within the Google Play Apk use application, the installation fails incompatible with the current version of the problem

Once ready to upgrade an app from Google Play when used two ways to upgrade,

1. Upload a new updated version of the Google Play upgrade.

2. Detection pop in the new version update prompt.

Two ways to look no problem, but one thing you neglected yes. Google Play app store if you start uploading chose to use Google Play to provide the Apk signed a new key, it means the store can choose to upload a secondary signature, usually checked, because this option has several advantages:

  • Reduce the size of the app;
  • Instant provide the desired functionality;
  • Provide free installation experience (or need to click in the store updates are downloaded, the background is installed by default, does not display the installation interface)

Then after a long time after, your application needs to be upgraded because iteration time. Operating meal fierce as a tiger, go to Google Play to upload a version of the other, and in their own server push a version upgrade within the application. At this point a little attention problems caused, is bound to installation failure caused by application signature.

How to solve?

  1. To know if you are using the Google Play 2 signatures, there will be two APK, version management -> click to download the results of the library will be original and derivative apk apk (Google secondary signature apk), if your application only released in Google store, then, no, you can be the secondary signature derived apk download in other stores, pushed to the back-end server be prompted to download the update within the application.
  2. First started when uploaded to Google Play, Google does not use the second signature. It can be used directly within the application version upgrade
3. If you are using multiple channels, the upgrade time to determine whether the channel name is google_play, not only strong liters. Google Play need to exclude channels, you need to get the current App channel number and current channels to determine whether to upgrade in-app pop-up window.
AndroidManifest.xml
 
 <meta-data
      android:name="CHANNEL"
      android:value="${CHANNEL_NAME}" />
    -------------------------------------------
 build.gradle 
 
 productFlavors {
   googleplay {
       manifestPlaceholders = [CHANNEL_NAME: "google_play"]
   }
   official{
       manifestPlaceholders = [CHANNEL_NAME: "official"]
   }
}
   --------------------------------------------
 

/**
 * 获取app当前的渠道号或application中指定的meta-data
 *
 * @return 如果没有获取成功(没有对应值,或者异常),则返回值为空
 */
public static String getAppMetaData(Context context, String key) {
    if (context == null || TextUtils.isEmpty(key)) {
        return null;
    }
    String channelNumber = null;
    try {
        PackageManager packageManager = context.getPackageManager();
        if (packageManager != null) {
            ApplicationInfo applicationInfo = packageManager.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
            if (applicationInfo != null) {
                if (applicationInfo.metaData != null) {
                    channelNumber = applicationInfo.metaData.getString(key);
                }
            }
        }
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    return channelNumber;
}

Quadratic signature provided by Google, triggering the map does not show other issues?

Including the use of Google Map maps or other maps can not be used when, in the time value of the background configuration SHA1, SHA1 fill into apps to the Google play in the SHA1 signing certificate so that it can not go wrong.

It recommended
local SHA1 value;
after signature SHA1 value;
issued heavy-signed certificate to the store after the SHA1 value of the
three maps are configured in the background. Whether this is a test, package will not be published or otherwise map SHA1 value caused by incorrect not displayed. Others require a third party to use SHA1 configuration is also the same reason.

Google Map configuration SHA1 can see my article

Published 26 original articles · won praise 19 · views 40000 +

Guess you like

Origin blog.csdn.net/a23006239/article/details/90899136