Using the latest version 4.0.0-rc.1 of the Maven Android Plugin, some classes seem to be missing in the build. I get one of those exceptions when I start the app (two possible ways to start the app):
Both missing classes are inside support-v4-21.0.0.aar/libs/internal_impl-21.0.0.jar.
My dependency definition:
<dependency>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
<version>21.0.0</version>
<type>aar</type>
</dependency>
Is this some configuration error? A bug in the Android Maven plugin?
You need to set the following config in the pom:
<includeLibsJarsFromAar>true</includeLibsJarsFromAar>
So it will look something like this:
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<extensions>true</extensions>
<configuration>
//...
<includeLibsJarsFromAar>true</includeLibsJarsFromAar>
//... rest of config
</configuration>
</plugin>
The reason for that change is that Google decided to put jars inside the aar which is a bad practice of dependencies. If you want to substitute the version or something else it is not currently possible. In short it makes dependencies much more difficult to manage.
This setting is set to false by default to discourage this behavior of creating aar's with jar's inside the libs folder.
Using the latest Android-Maven-Plugin (Now 4.1.1 soon 4.2.0) this flag is set to true by default so you do not need to add it anymore.
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