在 XML 中指定时找不到从功能模块导入的资源
Resources imported from feature module not found when specified in XML
我们有一个基本模块和一个功能模块
在功能模块中,我们使用位于基本模块中的布局执行 setContentView。
紧接着我们在基本布局中手动膨胀布局(layout_a.xml
)(参见再见功能中的GoodbyeActivity.java
)
在这个 layout_a.xml
中,我们有一个带有背景资源的简单按钮,该资源仅在功能模块中可用。
应用程序不会 运行、运行 时崩溃。它编译没有错误。
似乎整个拆分资源的想法都被打破了。或者我在这里做错了什么?
指向功能资源的任何内容也会发生此错误。 <include>
语句、字符串、维度等。很烦人的是你也看不到任何构建错误。
要重现此错误,请克隆上述 link 中的存储库。它是 android 即时应用程序演示存储库的克隆。
使用 url "http://hello-feature.instantappsample.com/goodbye/example" 打开 hello-feature-module en 运行 免安装应用程序
在再见功能中,请参阅 res 文件夹中的 GoodbyeActivity
和 layout_a.xml
。
If you remove line 29 in the layout_a.xml file the app runs fine.
参考 Google issue tracker,已使用 Android SDK Built-Tools 修复到 27.0.2
请将您的 Android SDK Built-Tools 更新至 27.0.2 并确保您使用的是 Android Studio 3.0.1或更新.
如果任何问题仍然存在,请报告 Google issue tracker 他们将重新开放进行检查。
我们有一个基本模块和一个功能模块
在功能模块中,我们使用位于基本模块中的布局执行 setContentView。
紧接着我们在基本布局中手动膨胀布局(layout_a.xml
)(参见再见功能中的GoodbyeActivity.java
)
在这个 layout_a.xml
中,我们有一个带有背景资源的简单按钮,该资源仅在功能模块中可用。
应用程序不会 运行、运行 时崩溃。它编译没有错误。
似乎整个拆分资源的想法都被打破了。或者我在这里做错了什么?
指向功能资源的任何内容也会发生此错误。 <include>
语句、字符串、维度等。很烦人的是你也看不到任何构建错误。
要重现此错误,请克隆上述 link 中的存储库。它是 android 即时应用程序演示存储库的克隆。
使用 url "http://hello-feature.instantappsample.com/goodbye/example" 打开 hello-feature-module en 运行 免安装应用程序
在再见功能中,请参阅 res 文件夹中的 GoodbyeActivity
和 layout_a.xml
。
If you remove line 29 in the layout_a.xml file the app runs fine.
参考 Google issue tracker,已使用 Android SDK Built-Tools 修复到 27.0.2
请将您的 Android SDK Built-Tools 更新至 27.0.2 并确保您使用的是 Android Studio 3.0.1或更新.
如果任何问题仍然存在,请报告 Google issue tracker 他们将重新开放进行检查。