Should I use Maven for an Android App? [closed] - java

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I code mostly in Java and use Maven for all of my projects. I do really love using Maven since it is easy to download the sources and documentations, and, more importantly, I don't need to keep the copy of the external libraries under my project source code folders.
I have started to develop an Android application and I found that the Android plugin for eclipse are terribly good. However, all provided examples are not maven projects so I do not know whether, if I use maven, I would still get all the functionalities from the Android plugin or whether there is any drawback from using Maven.
So the questions are:
Do all features from Android plugin for eclipse still work?
Is it going to be more difficult than using the normal build (I believe it is Ant but not certain)
Any other drawbacks, e.g. the file size of the final application (Maven tends to bundle a lot of things together) or the difficulties of getting the latest libraries on maven repository (which is probably differnt for Android).
Please do not point to this maven support for android projects?
I would like an answer from experience developers. I already know that it is possible to use maven for an Android app. All I need to know is whether I should use it.

My teams current task is to develop an Android app. Since it is a small app and also 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 gain the Android Eclipse plugin functionalities in our Maven project.
The R class was not updated according to our resources
We were not able to start the application directly from within Eclipse in the emulator and/or an attached device
Because of these issues which impeded our development sincerely we decided to develop the app without Maven.
But if any of you knows how to fix these issues I would love to hear a solution!

If you want fast running tests you are nearly forced to use maven. As robolectric is the way to go then. And they said Roboletric is probably easier to set up via maven under Eclipse (they are using IDEA).
That said, did you read this post or that? And what error message exactly did you get?
Typical things I made wrong:
use maven >= 3.0.3 ! And avoid that embedded thing in eclipse. (This was necessary only for robolectric, if I remember correctly)
use ~/.m2/settings.xml as described on the robolectric page to set up the android path
specify your android sdk also properly in the local.properties and under Preferences -> Android -> SDK location
Further read this and that or just try the mavenized robolectric example itself, which worked for me. Import it as 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 did I mention this strange tool: m2e-android - not sure why one needs so many stuff with Eclipse ... here you can install it via software updates http://rgladwell.github.com/m2e-android/updates/master/m2e-android/
Hopefully I remembered all steps correctly. Good luck!
Update:
Switching back to normal Android stuff without maven under Eclipse as the IDE makes strange stuff: http://groups.google.com/group/robolectric/browse_thread/thread/ac814076c40d9df1
But the nice thing of this Maven adventure is that I can now easily test and debug my projects via NetBeans :)

As we all know Android Devolopment migrated 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 independent from Android Studio, so you can invoke 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 build your Android apps from the command line on your machine from Android Studio,thus by avoiding the mess of plugins as there in Eclipse.
Check out this tutorial for Building Android Apps with Maven.
Refer here for more about Gradle build

I recommend avoiding Maven for professional development on Android. Here's why:
Google is investing time into keeping Android Studio integrated with Gradle. So maven is extra work right off the bat.
If you have to use Maven (e.g. to manage dependent libraries), then Gradle can use the Maven plugin. See https://docs.gradle.org/current/userguide/maven_plugin.html
By making maven your primary build tool you'll be downloading a massive amount of dependencies that you don't need and you're not sure where they come from. This goes against the notion that for your Android app, you ideally want just your code, and the android platform. In other words you're involving a lot of libraries/code you don't need.
In short, using maven as your Android build tool adds much more work than is necessary and creates a management nightmare (IMO).
Try this to illustrate:
Heat a pan on a stove.
Hold up a raw egg. Say "This is your android application."
Crack the egg into the pan.
Say "This is your android application on maven-with-rats-nest-dependency-tree-and-unknown-code-downloads-that-you-don't-need-anyway."
Wait for the egg to burn to a crisp.
Say, "This is your android application when the maven build packaged a useless or bad library with your Android application."

I have been able to use maven for android application development using Android Development Tools for Eclipse (Kepler) and Android for Maven Eclipse 1.0.1 (m2e-android). Follow these instructions http://rgladwell.github.io/m2e-android/. After you have created your new project with the android quickstart archetype modify your pom.xml. Add the android platform version. Eclipse (m2e) will report an error on the pom.xml on the android-maven-plugin declaration, to fix this issue follow alexander's response in Error in maven pom xml file: Building Android project. Then update the maven project using eclipse and that should be it.

From my own experience in Intellij. I used Maven as a build automation tool for my android development process. I started learn it with "Android Application Development with Maven" from Packtpub.

Related

How to install LWJGL3 in Visual Studio Code?

I want to write a little project for which I have chosen LWJGL library.
But I have some problem with installing it into Visual Studio Code IDE. I have found manuals for Eclipse, NetBeans, and IntelliJ, but none for the VSC. Can you please write a detailized guide how to install LWJGL3 into VSC?
Please write what and where I should copy files and where to add them into dependencies for my project.
I advise you stick with Maven which is a java widely used dependency manager. It will allow you to build your project independently of any IDE.
So an LWJGL can be build via Maven. Just go to customize section, select what you need and it will show you below how to add LWJGL to Maven.
But also spend some time to know Maven a little. It will help you a lot.

Migrate an existing java (libGDX) project and git repository from eclipse to IntelliJ IDEA

I'm a Java and Web developer.
After using eclipse for 5 years, I decided to at least try to migrate my currently active projects to the JetBrains IDE.
Mainly because of the new features for Android Studio that have been announced at Google IO 15 and I feel that it might be better for me to familiarize myself with it in general. Just in case the support for ADT in eclipse is dropped by Google at some point.
I also noticed that the Laravel (PHP framework) integration is pretty good for IntelliJ, which would come in handy for some of my planned Web projects.
The Java project I'd like to migrate is more specific a libGDX game which has a git repo.
So my question(s) are:
Is it possible to convert the project from an eclipse project to an IntelliJ project, without loosing the git repository?
Does anyone have got experience with this?
Does anyone know if there will be issues with files generated by the libGDX setup tool?
Thanks in advance
Edit: I know that there is an import option for eclipse projects to convert them to the IDEA structure, but I'm not sure if that will also handle git.
First of all, you could just try it, IntelliJ won't delete you anything. You could even use both IDEs on the same sources.
If you create a project or module from a directory which is versioned (e.g. contains .git), then IntelliJ will automatically pick it up, so you can use it.

Google app engine: maven or eclipse google plugin

I'm new to Google App Engine. To use Java App Engine, there are two options provided by Google: create a Maven project, or non-maven project backed by Eclipse Google Plugin. According to the doc, Eclipse version is easier. So should I go ahead with Eclipse? But I have seen lots of posts about maven. Could anyone comment what the pro/cons of using Maven are.
Thanks
Although you might want to try our first with the Eclipse plugin, Maven is the way to go in the long run because :
It is designed to enable collaboration between developers, ensuring everyone uses the same libraries and the same build process
It works with any serious Java IDEA, not only Eclipse. If you or the people you work with use IntelliJ, Netbeans or anything else Maven will help harmonize everything
It allows you to do Continuous Integration . Especially since now this comes bundled with App Engine via push-to-deploy. Push-to-deploy is great because it allows you to do debugging in production from the admin console. But you need to use Maven for it to work.
In conclusion, use the Eclipse plugin for your first quick-and-dirty tutorial or test project. But then learn Maven to make a real project.

new to android - what is the benefit of compiling with 'ant'?

I tried to look though the documentation but nothing explained why some android java apps are compiled with 'ant' vs. the normal way to to compile an app in eclipse?
In basic words you can use ant to compile your Android project and get several apks as output, lets say for different companies. Like build machine. In ant you write all dependences and its easy to manage compilation process.
From my experience I used ant to bind Android NDK with SDK but Eclipse can do that pretty well.
So If you are not familiar with ant, use Eclipse for Android. It will be enough.
Some link to start from

Project setup for creating third party libraries for Android

I am creating a library for Android that others can include in their own project. So far I have been working on it as a normal Java project with JDK 1.6 setup as system library. This works just fine in Eclipse when I add the android.jar.
The issue comes when I try to my build script. I am running Gradle and doing a normal compile and test build cycle. My thoughts were that it does not matter if I compile it with a normal JDK, since this is not a standalone application. The benefits by creating a normal Java project is that Gradle does support this much better. My project also does not contain any UI at all. However, the problem is that of course android.jar and the JDK contains lots of the same classes and I think that this is what messes up my build script. Everything crashes when running the tests (the tests are in the same project under src/test/java).
My question is, how should I create this project that is meant to be included in Android projects as a third party library? Should I create it as an Android project in Eclipse even though I am only creating a library that does not use any of the UI features? Also, should the tests be in a separate project?
Thanks for all responses!
Have you looked at the Android plugin for Gradle? It incorporates the ProGuard tool to package only necessary classes into your Android APK file, so might address your scenario. Have a look here: https://github.com/jvoegele/gradle-android-plugin/wiki
I will start with the simple question, the one regarding the test project. My experience is that is is better to have a separate test project. I have done this with success in many Java ME project, where the problems are similar. The test project only need to import the source code, not the libraries. Then there should be no problems with duplicate classes.
The other question is a little more difficult. My intuition tells me that the core project should be an Android project.

Categories