Tac*_*0sS 12 android android-manifest android-studio android-gradle-plugin
我们有多个项目,具体取决于许多Android lib模块.为避免应用清单中出现重复的xml标记,我们将相关的接收者,服务和活动放在各自的模块中.
直到今天,我们使用:
今天我们更新到:
直到这个更新,一切正常,并且清单合并,我们有冲突,我们修复它们.截至我们所做的更新,清单根本不会合并!
---更新1 ---
我们已经使用了Merged Manifest视图,并且发现它只是不包含合并中的清单,它从模块清单中唯一合并的是权限,例如,如果我向a添加新权限模块显示它只会合并它而不是其他元素!
我保证合并有很多东西!
---更新2 ---
似乎一切之外的应用程序标记其合并到主清单,一切都内的应用程序标记,它没有.
---更新3 ---
不合并的模块:
摇篮:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
jniDebuggable true
}
}
}
dependencies {
compile project(path: ':android-infra')
compile 'com.google.android.gms:play-services-gcm:9.0.0'
compile project(path: ':engine-core-server')
compile project(path: ':engine-core-aneeda')
}
Run Code Online (Sandbox Code Playgroud)
表现:
<manifest package="com.sensiya.voip.managers.gcm"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission android:name="com.google.android.c2dm.permission.KAKI"/>
<application
tools:node="replace">
<service
android:enabled="true"
android:name="com.sensiya.voip.managers.gcm.GcmIntentService"/>
<receiver android:name="com.sensiya.voip.managers.gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE"/>
<category android:name="com.iamplus.onenumber.device"/>
</intent-filter>
</receiver>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
将合并的模块:
摇篮:
apply plugin: 'com.android.library'
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
jniDebuggable true
}
}
}
dependencies {
compile project(path: ':android-infra')
compile 'com.sensiya:sense-services-client:1.24.2@aar'
compile project(path: ':engine-core-server')
compile project(path: ':engine-core-aneeda')
}
Run Code Online (Sandbox Code Playgroud)
表现:
<manifest package="com.iamplus.android.senseServices"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
tools:node="replace">
<service
android:name="com.iamplus.senseServices.ContextualEventService"
android:enabled="true"/>
<service
android:name="com.iamplus.senseServices.Serv"
android:enabled="true"/>
<service
android:name="com.iamplus.senseServices.Serv1"
android:enabled="true"/>
</application>
</manifest>
Run Code Online (Sandbox Code Playgroud)
有什么建议?
它可能是很多东西.因为你没有提供代码,我猜你正在使用默认的合并行为.有关更多信息,请参阅:合并冲突启发式
您可以使用Merged Manifest视图预览合并清单的结果并查找冲突错误.
通常,默认情况下合并应该有效.然后只需使用Merged Manifest视图来查看合并期间丢失值的方式和位置.使用合并规则标记可以帮助您通过分配规则标记来管理合并.
如果根本没有合并.所以它可能是模块之间的依赖问题.
请注意,依赖顺序对具有相同优先级的模块(如库)起着至关重要的作用.
---更新5.April.2017 ---
以下是一些有用的提示:
tools:node=”remove"
或tools:node="removeAll"
或gradle这个(见禁用清单合并在Android的摇篮建)---更新(2)5.2017年4月---
添加代码后,我可以看到您正在使用Attribute
tools:node="replace"
Run Code Online (Sandbox Code Playgroud)
在模块中的应用程序元素下(也可能在应用程序的清单中).我认为这就是为什么你没有从导入的模块合并到你的应用程序清单中的任何清单合并的原因.请参阅节点标记tools:node="replace"
下方.
完全替换优先级较低的元素.也就是说,如果优先级较低的清单中存在匹配元素,请忽略它并使用与此清单中显示的完全相同的元素.
这意味着上面的两个模块永远不会得到任何与manifest合并的东西:
因此,摆脱该属性,清理和重建模块.然后重建整个项目.
如果您遇到明显的合并冲突,您有两种选择。
1) 找到项目中包含的所有清单文件,包括作为依赖项的库中的清单文件,并确保不存在冲突的配置。
或者 2) 在清单中添加一些合并解决规则,以规定如何解决每个冲突。
这里有一个很棒的页面,其中包含许多详细信息。
https://developer.android.com/studio/build/manifest-merge.html
归档时间: |
|
查看次数: |
5525 次 |
最近记录: |