Android12 内置应用问题 mismatch in the <uses-library> tags between the build system and the manifest

FAILED: out/target/common/obj/APPS/MyEmail_intermediates/enforce_uses_libraries.status
/bin/bash -c "(rm -f out/target/common/obj/APPS/MyEmail_intermediates/enforce_uses_libraries.status ) && (build/soong/scripts/manifest_check.py           --enforce-uses-libraries        --enforce-uses-libraries-status out/target/common/obj/APPS/MyEmail_intermediates/enforce_uses_libraries.status          --aapt out/host/linux-x86/bin/aapt                                      vendor/rockchip/common/apps/GoogleEmail/MyEmail.apk )"
error: mismatch in the <uses-library> tags between the build system and the manifest:
        - required libraries in build system: []
                         vs. in the manifest: []
        - optional libraries in build system: []
                         vs. in the manifest: [org.apache.http.legacy, androidx.window.extensions, androidx.window.sidecar]
        - tags in the manifest (vendor/rockchip/common/apps/GoogleEmail/MyEmail.apk):
                uses-library-not-required:'org.apache.http.legacy'              uses-library-not-required:'androidx.window.extensions'          uses-library-not-required:'androidx.window.sidecar'
note: the following options are available:
        - to temporarily disable the check on command line, rebuild with RELAX_USES_LIBRARY_CHECK=true (this will set compiler filter "verify" and disable AOT-compilation in dexpreopt)
        - to temporarily disable the check for the whole product, set PRODUCT_BROKEN_VERIFY_USES_LIBRARIES := true in the product makefiles
        - to fix the check, make build system properties coherent with the manifest
        - see build/make/Changes.md for details

解决办法:

第一种:忽略检查

LOCAL_ENFORCE_USES_LIBRARIES := false

第二种:指明使用的库,应用申明的都要写,中间用空格隔开

LOCAL_OPTIONAL_USES_LIBRARIES := org.apache.http.legacy androidx.window.extensions 

FAQ:

 关于APP <uses-library>的使用情况查看:使用aapt 工具,可以查看到使用情况 

aapt dump badging  xxx.apk

<application
    	........
	........>
    	<uses-library
        	android:name="。。。。。。。"
        	android:required="true" />
</application>

require设置为true uses-library将会包含对应的库

require设置为false uses-library-not-required将会包含对应的库

说明:

扫描二维码关注公众号,回复: 17323303 查看本文章

这个元素用于指定该应用程序必须链接的共享类库。这个元素告诉系统该应用程序包的类装载器中所包含的类库代码。

Android的所有包(如andorid.app,android.content,android.view和android.widget等)都在应用程序自动链接的默认类库中。但是,有些包是在于独立的类库中,它们不能被自动的链接到应用程序包中,要查看这些包的文档,以确定要把哪些类库包含到包的代码中。

这个元素也会影响该应用程序在特殊设备上的安装,以及应用程序在Google Play上的可用性。

安装:

如果在该应用的清单中出现这个元素,并且它的android:required属性被设置为true,那么除非该类库在用户的设备上存在,否则PackageManager框架不会让用户安装这个应用程序。

属性:

android:name

这个属性用于指定类库的名称。这个名称是在对应的类库文档中提供的。例如:android.test.runner库就是包含Android测试类的一个程序包。

android:required

(默认值是true。这个属性在API Level 7中被引入)

这个属性用于指定应用程序是否需要有android:name属性所指定的类库:

true:没有这个库应用程序无法工作。如果用户设备设备上没有这个类库,系统不允许该应用程序安装在这个设备上。

false:如果该类库存在,则应用程序能够使用这个类库,但是如果有必要,也可以设计成没有该类库,应用程序也能够工作。系统会允许应用程序安装,即使该类库不存在。如果使用false,就要在运行时对类库的有效性进行必要的检查。对于类库的检查,可以使用反射机制来判断一个具体的类是否有效。

猜你喜欢

转载自blog.csdn.net/xiaowang_lj/article/details/135383143