我正在使用应用程序包-我的Android应用程序中的动态模块.在项目中,我有一个主模块和一个子模块.在子模块的值中-> styles.xml,我定义了自定义样式,以使一些动画可以活动.
<style name="SampleActivityTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="buttonStyle">@style/CustomButtonStyle</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowActivityTransitions">true</item>
<item name="android:windowEnterTransition">@transition/activity_transition_note</item>
<item name="android:windowExitTransition">@transition/activity_transition_note</item>
<item name="android:windowSharedElementEnterTransition">@android:transition/move</item>
<item name="android:windowSharedElementExitTransition">@android:transition/move</item>
</style>
<activity
android:name=".activity.SampleActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|locale"
android:label=""
android:screenOrientation="portrait"
android:theme="@style/SampleActivityTheme">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</intent-filter>
</activity>
但是当我构建项目时,出现如下所示的编译错误,
/Users/chathura/Branches/AppBundle/sample_module/build/intermediates/merged_manifests/debug/AndroidManifest.xml:778: error: resource style/SampleActivityTheme (aka lk.sample.mysampleapp:style/SampleActivityTheme) not found.
这个问题的原因是什么?
任何建议表示赞赏.
谢谢.
最佳答案
目前,Android Gradle插件不支持从清单中的动态功能中引用资源.
原因之一是所有动态特征的清单都合并在基本模块的清单中,并且基本模块不应依赖于动态特征.
如果您在基础中定义样式,则应该对其进行修复.
资源:
从https://developer.android.com/studio/projects/dynamic-delivery
The manifest for your app’s base module is similar to that of any
other app module. Keep in mind,when Google Play generates your app’s
base APK,it merges manifests for all modules into that of the base
APK.