Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven build Android application - BuildConfig

While trying to use Maven for building Android projects I recognized that the maven-android-plugin doesn't autogenerate the BuildConfig class during build time. I have found a ticket regarding that problem and a Google Groups thread.

Issue: http://code.google.com/p/maven-android-plugin/issues/detail?id=275

Google Groups: http://groups.google.com/group/maven-android-developers/browse_thread/thread/cc74267bbb7baebb/4e63b710513bb535?lnk=gst&q=BuildConfig#4e63b710513bb535

The quick hack in the issues thread suggests creating another micro maven project to set the BuildConfig.DEBUG variable during build time with a profile switch. This would force me to build a multi module project for every single little application.

The suggestion in the Google Groups thread sounds ok for me (executing the Ant Task from the SDK to generate the BuildConfig class) but after digging through the build.xml and trying to get this work I gave up.

Has someone got a practical working solution for the BuildConfig problem with maven+android?

like image 745
denis Avatar asked Jul 12 '12 07:07

denis


1 Answers

Thanks to Jake Wharton and Manfred Moser, BuildConfig generation has been supported since Android Maven Plugin 3.3.2.

Check out changelog for 3.3.2 release here.

like image 182
yorkw Avatar answered Sep 20 '22 18:09

yorkw