Android清单合并删除属性(Android manifest merge dropping attribute)

编程入门 行业动态 更新时间:2024-10-28 04:20:34
Android清单合并删除属性(Android manifest merge dropping attribute)

我正在使用groovy生成一个部分清单,其中包含来自我的构建配置文件的应用程序链接的意图过滤器声明。 在apk中找到的合并清单看起来和预期的一样,但有一个问题:即使在build.gradle中设置了属性android:debuggable也会被删除。 如果我删除部分清单并重建apk, android:debuggable="true"将按预期设置。

我的主要清单看起来像:

<manifest package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto"> <application android:name="MyApp" tools:replace="android:theme, android:label, android:allowBackup"> </application> </manifest>

和我生成的部分清单看起来像:

<?xml version="1.0" encoding="utf-8"?> <manifest package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android"> <application android:name="MyApp"> <activity android:name=".activity.MyActivity"> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> </manifest>

并在build.gradle文件中设置debuggable true 。

android:debuggable属性从apk中找到的合并清单中删除,我可以做些什么来确保它在不加入部分清单的情况下正确设置(我不知道在脚本运行时在gradle同步时间并且不想将其硬编码为真)?

I am using groovy to generate a partial manifest that contains intent filter declarations for app links from my build config files. The merged manifest found in the apk looks as expected but with one issue: the attribute android:debuggable is getting dropped despite being set in build.gradle. If I remove the partial manifest and rebuild the apk, android:debuggable="true" will be set as expected.

my main manifest looks like:

<manifest package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:installLocation="auto"> <application android:name="MyApp" tools:replace="android:theme, android:label, android:allowBackup"> </application> </manifest>

and my generate partial manifest looks like:

<?xml version="1.0" encoding="utf-8"?> <manifest package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android"> <application android:name="MyApp"> <activity android:name=".activity.MyActivity"> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> </manifest>

and in build.gradle file debuggable true is set.

The attribute android:debuggable is getting dropped from the merged manifest found in the apk, what can I do to ensure that it is set correctly without adding it in the partial manifest (I don't know it at gradle sync time when the script runs and don't want to hardcode it to true)?

最满意答案

从部分清单文件的application节点中删除android:name属性后,合并正确发生。

部分清单工作:

<?xml version="1.0" encoding="utf-8"?> <manifest package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android"> <application> <activity android:name=".activity.MyActivity"> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> </manifest>

After removing the android:name attribute from the application node of the partial manifest file, the merge occurs correctly.

The partial manifest that works:

<?xml version="1.0" encoding="utf-8"?> <manifest package="com.app.myapp" xmlns:android="http://schemas.android.com/apk/res/android"> <application> <activity android:name=".activity.MyActivity"> <intent-filter android:autoVerify="true"> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.BROWSABLE"/> <category android:name="android.intent.category.DEFAULT"/> </intent-filter> </activity> </application> </manifest>

更多推荐

android,apk,manifest,gradle,电脑培训,计算机培训,IT培训"/> <meta name="d

本文发布于:2023-07-15 15:22:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1115282.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:清单   属性   Android   manifest   attribute

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!