提问人:alijandro 提问时间:3/22/2023 更新时间:3/22/2023 访问量:831
不能对 Android 库中的不同构建风格使用不同的命名空间
Can not use different namespaces for different build flavors in Android library
问:
我尝试在我的 Android 库项目中为不同的产品风格使用不同的包名称。使用以下配置namespace
productFlavors {
foo {
namespace 'com.example.foo'
manifestPlaceholders = [pkgName:"com.example.foo"]
}
// the later one always win
bar {
namespace 'com.example.bar'
manifestPlaceholders = [pkgName:"com.example.bar"]
}
}
它看起来在不同的产品口味中不起作用。它总是使用后一个命名空间,即使我切换到不同的产品风格。namespace
我尝试徒劳地使用属性,并发出以下警告manifestPlaceholders
package
AndroidManfiest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="${pkgName}">
</manifest>
不能在清单中对包使用占位符;改为 在 build.gradle 中设置 applicationId
如何在 Android 库中为不同的构建风格使用不同的命名空间?
答: 暂无答案
评论
applicationId
manifestPlaceholders
> com.android.builder.errors.EvalIssueException: Library projects cannot set applicationId.