简体   繁体   中英

Error rendering components from an included library in IntelliJ IDEA 14

I have a layout file that includes controls that are part of a library module that is compiled in the project.

IntelliJ reports that it can't dispaly the control, despite that it shows up properly when running the actual android app on my device.

It suggests rebuilding the project, creating the class, or fixing my build path. The module that has the controls are in the Dependencies tab, and are set to Export, and Scope=Compile.

The layout file references the custom controls via their fully qualified package/class name. The rendering API I've selected is the same version as my Target SDK set in my AndroidMainfest.xml

I have tried both using a tag with the class attribute pointing to the class, as well as a tag where the tag name is the fully qualified class. Both result in IntelliJ not being able to render the view.

I was able to solve this by specifying a Project compiler output directory at the IntelliJ project level. Prior to this fix, my library modules used an output path as a subdirectory of where the module is defined.

File > Project Structure > Project compiler output. Set it to the standard "\\out"

Next, I set my library modules up to use the inherited project output path. Project Settings > Modules > [library module name] > android > Packaging Tab > "Use resources directory specified at "Structure" section radio button.

Also make sure that "Include assets from dependencies into APK is set.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM