Should I use Maven for an Android app?

I mainly program in Java and use Maven for all my projects. I really enjoy using Maven, as it’s easy to download sources and documentation, and more importantly, I don’t need to save a copy of external libraries in the project source folders.

I started developing an Android app, and I found that the Android plugin for eclipse is terribly good. However, all the examples presented are not maven projects, so I don’t know if I will use maven, I still get all the functionality from the Android plugin or if there is a drawback from using Maven.

So the questions are:

  • Do all functions of the Android plugin for eclipse still work?
  • It will be harder than using a regular assembly (I believe this is Ant, but not necessary)
  • Any other flaws, for example. the size of the final application file (Maven, as a rule, combines a lot of things) or the difficulty of getting the latest libraries in the maven repository (which is probably different from Android).

Do not point to maven support for Android projects

I would like to receive a response from experienced developers. I already know that you can use maven for an Android application. All I need to know is whether I should use it.

+47
java android maven
Jan 08 2018-12-12T00:
source share
6 answers

My current tasks of my team are to develop an Android application. Since this is a small application, as well as some kind of prototype, we decided to evaluate Maven and the Android Eclipse plugin.

In short: After two developers spent three days, we were not able to get the functionality of the Android Eclipse plugin in our Maven project.

  • Class R was not updated according to our resources.
  • We were unable to launch the application directly from Eclipse in the emulator and / or connected device.

Due to these problems that were holding back our development, we decided to develop an application without Maven. But if any of you know how to fix these problems, I would love to hear a solution!

+34
Jan 08 2018-12-01T00:
source share

If you need quick tests, you are almost forced to use maven. While robolectric is the way to go. And they said that Roboletric is probably easier to configure via maven under Eclipse (they use IDEA).

However, did you read this post or which one ? And what error message did you receive?

Typical things I did wrong:

  • use maven> = 3.0.3! And avoid this inline stuff in eclipse. (This was only necessary for robolectric, if I remember correctly)
  • use ~ / .m2 / settings.xml as described on the robolectric page to configure the android path
  • specify your Android sdk file also correctly in local.properties and under "Settings" → Android → SDK location.
  • Further read this and which or just try the mavenized robolectric example itself, which worked for me. Import it as an existing maven project.
  • Install the necessary sdk (in my case 2.2_r3) via maven-android-sdk-deployer and

    export ANDROID_HOME=/path/to/android/sdk mvn install -P 2.2 
  • And I mentioned this strange tool: m2e-android - I don’t know why so much is needed with Eclipse .. here you can install it using the software updates http://rgladwell.github.com/m2e-android/updates/ master / m2e-android /

I hope I remember everything correctly. Good luck

Update:

Switching to regular Android material without maven under Eclipse, as the ID environment does strange things: http://groups.google.com/group/robolectric/browse_thread/thread/ac814076c40d9df1

But the nice thing about this Maven adventure is that now I can easily test and debug my projects through NetBeans :)

+12
Jan 31 '12 at 21:39
source share

As we all know, Android Devolopment has been ported to Android Studio from Eclipse.

The Android Studio build system consists of an Android plugin for Gradle . Gradle is an advanced build toolkit that manages dependencies and allows you to define custom build logic.

The build system is not dependent on Android Studio, so you can call it from Android Studio or from the command line.

The Android Studio build system supports remote Maven dependencies. As you know, Maven is a popular software project management tool that helps organize project dependencies using repositories.

You can create your Android applications from the command line on your computer from Android Studio, thereby avoiding the clutter of plugins like in Eclipse.

Check out this tutorial on building Android apps with Maven.

See for more about Gradle build.

+2
Oct 28 '14 at 19:05
source share

I recommend avoiding Maven for professional Android development. That's why:

  • Google is investing time in supporting Android Studio integrated with Gradle. So maven is extra work from the start.
  • If you need to use Maven (for example, manage dependent libraries), then Gradle can use the Maven plugin. See https://docs.gradle.org/current/userguide/maven_plugin.html
  • Having made maven the main build tool, you download a huge number of dependencies that you don’t need, and you don’t know where they came from. This contradicts the notion that for your Android application you only need your code and Android platform ideally. In other words, you use a lot of libraries / code that you don't need.

In short, using maven as a tool to create Android adds a lot more work than necessary and creates a management nightmare (IMO).

Try this to illustrate:

  • Heat the skillet on the stove.
  • Keep a raw egg. Say, "This is your Android app."
  • Hack the egg into the pan.
  • Say: "This is your Android app at maven-with-rats-nest-dependency-tree-and-unknown-code-downloads-that-you-don't-need-anyway."
  • Wait for the egg to burn until crisp.
  • Say: "This is your Android application when the maven assembly packed a useless or bad library with your Android application."
+1
Apr 12 '16 at 23:43
source share

I was able to use maven to develop Android applications using the Android Development Tools for Eclipse (Kepler) and Android for Maven Eclipse 1.0.1 (m2e-android). Follow these instructions http://rgladwell.imtqy.com/m2e-android/ . Once you have created your new project with the quickstart archetype for Android, change your pom.xml. Add a version of the Android platform. Eclipse (m2e) will report an error on pom.xml in the android-maven-plugin declaration to fix this problem after alexander answered in Error in the maven pom xml file: Creating an Android project . Then upgrade your maven project using eclipse and that should be it.

0
May 7 '14 at 16:40
source share

From my own experience at Intellij. I used Maven as a build automation tool for my Android development process. I started to learn it using “Developing Android Applications with Maven” from Packtpub.

0
Dec 20 '15 at 2:36
source share



All Articles