PSA: Intellij, AAR, and APK

27 views
Skip to first unread message

maven-androi...@io7m.com

unread,
Sep 25, 2015, 11:56:24 AM9/25/15
to maven-androi...@googlegroups.com
Hello.

On the advice of Manfred Moser, I'm writing this small PSA in case
anyone runs into the same problem with Intellij that I've had to work
around.

Intellij doesn't seem to be able to cope well with AAR dependencies
when those dependencies are part of the same overall project. The
symptom is a lot of spurious "duplicate class" errors concerning R.java
and BuildConfig.java.

I haven't tracked down the specific cause of the issue. Searches online
led me here:

http://stackoverflow.com/questions/19192699/intellij-idea-12-duplicate-class-r-java-and-buildconfig-java

The suggested fix was to reconfigure the various directories marked as
sources, generated sources, excluded, etc. Unfortunately, those are all
configured correctly.

Currently the safe workaround seems to be to disable Intellij's
internal build logic and instead let Maven do it all. This has the
obvious advantage that if your Maven build is stable (and why wouldn't
it be!) then all developers are building the program exactly the same
way, regardless of whether that build is triggered in an IDE or from
the command line.

In practical terms:

1. Open the "Run" configuration for your application.
2. Select "Do not deploy anything" under the "Package" section.
3. In the "General" tab, remove the existing "Make" command
from the "Before Launch" list at the bottom.
4. Add a "Run Maven goal" command with whatever parameters
you'd normally use to build the app. I recommend adding
parameters such as -Dmaven.javadoc.skip=true to reduce
the build time during everyday development.
5. Add another "Run Maven goal" command to call android:deploy-apk
and deploy the resulting apk to your device.

When running the application from the IDE, maven will build and deploy
the apk. No more duplicate class errors!

M

Manfred Moser

unread,
Sep 25, 2015, 12:15:22 PM9/25/15
to maven-androi...@googlegroups.com
Ideally we could

- create a bug in the intellij tracker
- vote on it and express our dissatisfaction esp. if you are a paying customer
- document this on our website

Manfred
> --
> You received this message because you are subscribed to the Google Groups
> "Maven Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email
> to maven-android-deve...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

Csaba Kozák

unread,
Sep 26, 2015, 6:27:47 AM9/26/15
to Maven Android Developers
The main problem here is the IntelliJ team does not make any effort on its Maven Android plugin support.
It does not even recognize the new default paths (androidManifestFile, et) of AMP 4.0.
I already poked them several times on various tickets, but they did not even responded.

Alex O'Ree

unread,
Sep 26, 2015, 7:40:43 AM9/26/15
to maven-androi...@googlegroups.com

Fwiw, I've been poking around the NetBeans android plugin. It may be viable with some effort and is open source

--

Manfred Moser

unread,
Sep 29, 2015, 5:25:50 PM9/29/15
to maven-androi...@googlegroups.com
I will try to talk to them at JavaOne.. if others can poke them at various other conferences and so on as well that might help.

In the meantime.. give AndMore a whirl.

Manfred
> --
> You received this message because you are subscribed to the Google Groups "Maven Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to maven-android-deve...@googlegroups.com <mailto:maven-android-deve...@googlegroups.com> .
> For more options, visit https://groups.google.com/d/optout <https://groups.google.com/d/optout> .

Alex O'Ree

unread,
Oct 1, 2015, 8:37:48 AM10/1/15
to maven-androi...@googlegroups.com

https://youtrack.jetbrains.com/issue/IDEA-145825

Vote!  These are some of the issues I have. With enough complaints they may fix it

> To unsubscribe from this group and stop receiving emails from it, send an email to maven-android-deve...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages