[英]Android Manifest Merge issue - Removing google ads gradle dependency doesn't remove its AndroidManifest.xml nodes
I am having two product flavors in the project (1) free (2) pro 我在项目中有两种产品口味(1)免费(2)专业版
I am including google ads library only to the free product flavor as below 我仅将Google广告库包含在以下免费产品中
freeCompile 'com.google.android.gms:play-services-ads:11.4.2'
Now I want to replace it with another ad library. 现在,我想用另一个广告库替换它。 I am trying to remove this dependency but it doesn't remove the library completely and gives me an error as below. 我正在尝试删除此依赖项,但它没有完全删除该库,并给我一个错误,如下所示。 Hence it doesn't let me build the project. 因此,它不允许我构建项目。
The screenshot is of AndroidManifest.xml from the app\\build\\intermediates\\manifests\\full\\free\\debug
. 屏幕快照来自app\\build\\intermediates\\manifests\\full\\free\\debug
的AndroidManifest.xml。 Also I have not manually added these two activities ( com.google.android.gms.ads.AdActivity
& com.google.android.gms.ads.purchase.InAppPurchaseActivity
) to the main AndroidManifest.xml. 另外,我还没有手动将这两个活动( com.google.android.gms.ads.AdActivity
和com.google.android.gms.ads.purchase.InAppPurchaseActivity
)添加到主要的AndroidManifest.xml中。
What I have tried to remove these two activities from AndroidManifest.xml is 我试图从AndroidManifest.xml中删除这两个活动的是
But nothing seems to be working. 但是似乎没有任何作用。 How can I get rid of these errors and build my project? 如何摆脱这些错误并构建我的项目?
After a day long hassle, I managed to fix it using this official Android guildeline - Merge Multiple Manifest Files 经过一天的麻烦,我设法使用此官方Android guildeline对其进行了修复- 合并多个清单文件
tools:node="remove"
did the trick. tools:node="remove"
达到了目的。
I have manually removed those two activities that are the part of google sdk. 我已手动删除了google sdk中的这两个活动。 Here is what I have added to the main AndroidManifest.xml
这是我添加到主AndroidManifest.xml
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:exported="false"
android:theme="@android:style/Theme.Translucent"
tools:node="remove" />
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme"
tools:node="remove" />
Hope it helps to someone. 希望它对某人有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.