这是我的full code,这里是my screenshot 在旧代码中:
在MyLibrary / styles.xml
// Here, do something useful with the audio data that's
// now in the audioBytes array...
应用程序/ styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="RoTheme" parent="Theme.AppCompat.Light.DarkActionBar">
</style>
</resources>
它有效,但改变时
在MyLibrary /的build.gradle
<resources>
<style name="AppTheme" parent="RoTheme">
</style>
</resources>
到
defaultConfig {
minSdkVersion 23
targetSdkVersion 23
并点击android studio&#34; gradle sync&#34;,它会提升
productFlavors {
dev {
minSdkVersion 23
targetSdkVersion 23
}
}
如何解决?
答案 0 :(得分:0)
替换
<style name="RoTheme"
parent="android:style/Theme.AppCompat.Light.DarkActionBar">
到
{{1}}
android:style表示它是Android的内置样式
答案 1 :(得分:0)
产品风格支持与
defaultConfig
相同的属性,因为defaultConfig
实际上属于ProductFlavor
类,但创建产品风格类似于创建构建类型。
请参阅build-variants了解详情,
所以保持defaultConfig
不变并添加productFlavors
但不要替换它,你应该这样做:
android {
...
defaultConfig {...}
buildTypes {...}
productFlavors {
demo {
applicationId "..."
versionName "..."
}
full {
applicationId "..."
versionName "..."
}
}
}
答案 2 :(得分:0)
就我而言,错误只发生在
中compile project(path: ":mylibrary")
如果我使用以下代码将起作用:
dependencies {
compile 'ro.mylibrary:mylibrary-dev-release:1.0@aar'
}
repositories {
flatDir {
dirs "$System.env.HOME/Dropbox/try/adr/product-flavor-make-custom-theme-inheritance-failed/mylibrary/build/outputs/aar"
}
}
所以如果我在我的库中使用productFlavors,那么这个bug只会出现在虚拟项目中,这不是什么大问题。