应用程序未安装在 Android 11 中,但适用于以前的版本 [英] App not installing in Android 11 but works on previous versions

查看:68
本文介绍了应用程序未安装在 Android 11 中,但适用于以前的版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含两个包 com.example.packagecom.other.package 的应用程序.我在build.gradle中的配置如下:

I have an app with two packages com.example.package and com.other.package. My configurations in build.gradle is as follows:

android {
    compileSdkVersion 30
    defaultConfig {
        applicationId "com.example.package"
        minSdkVersion 18
        targetSdkVersion 30

我构建了一个未签名的发布版本.然后我用

I build an unsigned release build. Then I sign it with

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore <keystore> <OUTPUT> <ALIAS>

我从中获得的构建版本适用于除 Android 11 以外的所有版本.在 android 11 上安装我的应用时出现以下错误:

The build I get from this works well on all versions except for Android 11. On android 11 when I install my app I get the following error:

adb: failed to install ginger-uk.apk: Failure [-124: Failed parse during installPackageLI: Targeting R+ (version 30 and above) requires the resources.arsc of installed APKs to be stored uncompressed and aligned on a 4-byte boundary]

因此,我尝试使用 zip 对齐 APK 并进行安装,但随后在 Android 11 上出现以下错误:

So I tried zip aligning the APK and installing but then I get the following error on Android 11:

App not installed error

然后我尝试在基于某些 stackoverflow 解决方案签名之前先进行 zipalign,但在 Android 11 上出现以下错误:

I then tried to zipalign first before signing based on some stackoverflow solution but I get the following error on Android 11:

adb: failed to install ginger-uk.apk: Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Scanning Failed.: No signature found in package of version 2 or newer for package com.other.package]

我的问题是有人成功签署了适用于 android 11 及以下版本的 APK 吗?你是怎么做到的?

My Question is has anyone successfully signed an APK for android 11 and below? and how do you do this?

推荐答案

这可能是相关的:Android 11 不再支持 APK Signature Scheme v1.现在必须使用 APK Signature Scheme v2 或更高版本对 apk 进行签名.有关更多信息,请参阅此链接:https://developer.android.com/about/versions/11/behavior-changes-11#minimum-signature-scheme

This could be related: Android 11 no longer supports APK Signature Scheme v1. The apk must now be signed using APK Signature Scheme v2 or higher. Refer to this link for further information: https://developer.android.com/about/versions/11/behavior-changes-11#minimum-signature-scheme

这篇关于应用程序未安装在 Android 11 中,但适用于以前的版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆