About the problem that flutter package cannot be uploaded

On the Android side, when the minSdkVersion is 24, the flutter build apkpackaged apk has a signature problem in most application markets, and the apk cannot be uploaded normally. The solution is to use Android Studio to open Android for native packaging, that is, use [Build]->[Generate Signed Bundle/APK]->[Select APK]->[Fill in the signature information]->[Signature Versions only check V1 ] to sign.

illustrate:

  • If you want to support versions below Android 7.0, try to choose two signature methods at the same time, but if you encounter a signature problem, you can only use the v1 signature scheme;
  • If the signed information needs to be processed and modified, the v1 signature scheme is used.

flutter build apkYes v2 mode is selected by default, to sign only with the legacy scheme, open the build.gradle file and add v2SigningEnabled false to your build signing configuration:

android {
    ...
    signingConfigs {
      release {
        ...
        // 加入这句
        v2SigningEnabled false
      }
    }
  }

Finally, let's talk about the process of Android packaging and signing:
insert image description here

The following is the difference between the signatures of each version:

  • v1: sign the jar (unzip the file contents in the archive);
  • v2: Sign the entire apk (calculate and verify the binary content of the entire apk file), introduced in Android 7.0;
  • v3: On the basis of the original v2, APK key rotation is added, so that the application can change its signature key during the APK update process, introduced in Android 9.0;
  • v4: Support for streaming-compatible signature schemes via APK Signature Scheme v4, introduced in Android 11.

Guess you like

Origin blog.csdn.net/xiangzhihong8/article/details/123542663