I've defined the following style in a module and I want to use it as a theme on an Activity
Android Module's styles.xml:
<resources>
<style name="MyTheme" parent="android:Theme.Light.Panel"></style>
</resources>
Android application's AndroidManifest.xml:
<activity android:name="MyActivity" android:theme="@style/MyTheme"> ... </activity>
I'm using IntelliJ, and I get compilation error saying
android-apt-compiler: AndroidManifest.xml:26: error: Error: No resource found that matches the given name (at 'theme' with value '@style/MyTheme').
How can I reference the style that is in the module's jar in my main application?
Thanks.
I just fixed this issue, the project is like this:
what I did:
1.set moduleLib as Library project
(menu->Project Structures...->Modules->moduleLib->facet Android -> check the "Is Library project"
2 set the moduleMain depends on the moduleLib
2.1 go to the setting of moduleMain(the steps are similar to the previous one)
2.2 switch to the "Dependencies"
2.3 click "+", and select "module Dependency" add the moduleLib
2.4 change the "scope" to Compile(I have tried to pick up the Provided, but I can't use the theme then)
it works for me
Library module's resources automatically get copied to and packed with App module, if module dependency is correctly set-up. That is: dependency on a module directory, not a jar file.
Library project's jar output does not package resources. Default android build tools don't support it.
There is special a packaging type called apklib
used by maven-android-plugin
that can package resources as well, but you have build with Maven to use this functionality.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With