gpt4 book ai didi

android - 在动态模块中使用样式时出错 - android app bundle

转载 作者:太空宇宙 更新时间:2023-11-03 13:39:53 25 4
gpt4 key购买 nike

我在我的 Android 应用程序中使用应用程序包 - 动态模块。在项目中,我有一个主模块和一个子模块。在子模块的 values -> styles.xml 中,我定义了自定义样式来为 Activity 启用一些动画。

<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>

在 list 中,我使用主题属性使用此样式,

<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 插件不支持从 list 中的动态功能引用资源。

原因之一是所有动态特性的 list 都合并到基础模块的 list 中,基础模块不应该依赖于动态特性。

如果您在基础中定义样式,应该可以解决它。

来源:

来自 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.

关于android - 在动态模块中使用样式时出错 - android app bundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54807720/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com