Can anyone describe a good Vim setup for Android Development? I'm using Eclipse for now but I would really like to use Vim because it's faster and I like it better. I'm not interested in Eclim for example.
I'm interested in what Vim plugins are used (for Java, autocomplete etc.), how the .vimrc looks like and how the whole process of building/running applications works (as efficiently as possible).
I've once had to do some Android development on a netbook, and set up a nice Vim setup for this purpose. Seriously, it's easier than it seems:
Run emulator from the command line. It's better to do it anyway. I started mine with something like this:
emulator -avd BlaDevice -no-boot-anim -scale 0.65 -show-kernel
To build and reinstall your modified app to the emulator, simply run ant reinstall from the project root. Map this command in Vim to your key combination of choice.
I've used typical Vim setup: NERDTree, FuzzyFinder, and omnicomplete. Java syntax highlighting works out of the box.
Never bothered to install Eclim, omnicomplete works just fine in most cases.
I have been working on a vim plugin for android development: https://github.com/hsanson/vim-android. Still work in progress but it has most functionality needed for android development using vim.
I still have some issues to solve but most are not related to the plugin:
Gradle errors from aapt report the wrong file. This makes jumping to the error
from the quickfix window a pain as it opens the wrong file.
I cannot make javacomplete work correctly. When auto completing a class I wrote
it gets stuck in "Searching..." and when auto completing a library or external JAR
method javacomplete spits hundreds of errors making it impossible to use.
I've only done a little bit of Android development with VIM, but I'd very much suggest getting your head around Ant (which the SDK uses to build projects from the command line), and perhaps Maven if you're daring. You'll be using Ant a lot!
There are a few tab/auto-complete VIM scripts around, but don't expect them to be anywhere near as quick or useful as Eclipse. I've found myself doing a lot more typing than I'm used to from Eclipse...
Both of what #Dave and #buru suggested led me to work on a plugin for Vim that'd help you work on development in Vim for Android applications. Feature parity to top-level tools like the visual development isn't there yet, but I was wondering if we could generate some components by using Fries and extending it.
The plugin is called android.vim and it was on Github # jalcine.github.io/android.vim. I'm very open to ideas and pull-requests so feel free!
Edit: I've taken down this plugin because I haven't the time or focus to work on it :(
I have just create a vim script for android development, it is called adt.vim, and I am using it, hope you will like it.
http://www.vim.org/scripts/script.php?script_id=4330
If any suggestion, please tell me, it is still under improve
Related
I've been using eclipse to develop Android apps with phonegap until, a few weeks ago, I decided to try Sublime Text 2. I found it to be so much better than the eclipse editor so I would like to keep using it. Only thing I'm missing is a quick way to test the app on the device inside Sublime.
Luckily, someone else also had the same idea and developed a plugin for this:
https://github.com/Korcholis/Andrew
Sadly, I cannot get it to work, I installed ant and pointed the plugin to adb but then nothing happens when I try to create a new project (and there is no error message in the console).
I also found this other plugin:
https://bitbucket.org/ucomesdag/sublime-android
But I have no idea on how to install and run it.
Did someone else found a way to do this?
A quick update into 2014.
As of PhoneGap Cordova 3.0, it is no longer required to develop Android apps via eclipse. You are free to use any code editor or IDE you wish as app building is done independently from eclipse via a simple command line.
cordova run android to package the .apk and install on any active devices detected by adb or
cordova build android to package the .apk only.
In your case, you can keep using Sublime and pop in the cordova run android command whenever you ready to go on a test run.
While I agree with Insane Coder that you should stick with supported IDEs to develop for Android, according to this link and existing Sublime Text 2 Ant support, you could build and develop your android project with this IDE (It will just take some time to set it all up... as opposed to using a supported IDE like IntelliJ or Eclipse).
Using PackageControl, look for "Ant". That will install syntax highlighting for Ant. Another plugin that enables the build command (ctrl+b) to work for Ant files, "Super Ant". You should be able to code for android in sublime text 2 with those installed.
On another note... Do you use windows? The Andrew project you link to, seems to have Windows compatibility issues. Apparently related to locating the "SDK" (he says sdk in Andrew's github page but, probably he means JDK?) in your hard drive. Which is probably a hassle because Windows typically installs stuff to "Program Files" and in code, that turns into "Progra~1" because of the space. In the link I give you there is another approach to it, so when you install the JDK set a folder that has no spaces in its name, like c:\java\jdk1.6.0_02 or something else that strikes your fancy. The problem you could be having with Andrew is that it isn't finding the jdk in your hard disk.
I wanted to start developing for Android, but found it terribly hard to set everything up so it would work on Sublime Text 2.
I know that I'm supposed to download and set up the Android SDK, but how, where and why? And how do I compile my projects and run them? This is a complete mystery to me.
I've been researching this for about 3 hours now and haven't had any success. Could anyone of you, please, help me by guide me through the process of setting everything up in ST2?
Please note that I do not want to use Eclipse IDE. I've grown to love ST2 and I'd like to stick with it.
I know that I'm supposed to download and set up the Android SDK, but how, where and why?
Visit the official site and follow the instructions for "other/existing IDE". I don't think anyone wrote specific instructions for using Sublime yet though (since you haven't found one).
And how do I compile my projects and run them? This is a complete mystery to me.
As others already answered, other than a JDK, you will most likely need to download and run Ant from the command line.
If you really want start Andriod development, without using the great support of an IDE like Intelji Idea or Eclipse, then you should properly look into building and running your applications in the command line beside Sublime Text 2
If you follow the instructions for using the 'Andrew' software module from github, you can get sublime to communicate with the android sdk and ant build tool via a tool called monitor.
https://github.com/Korcholis/Andrew
Kind of similar to a vim addon i used to use that talked to eclipse service.
But if anyone else is reading this, intellij (android studio) has come on leaps and bounds regarding speed and autocomplete.
Eclipse and IntelliJ are the known supported IDEs for Android development. If you don't want to use Eclipse or IntelliJ, read up about ant scripts and how to build with Ant. That should get you started.
Sublime Text 2, right now doesn't support Android development from within the IDE. The only option you have, other than using Ant, is to wait for someone to write a plugin for that.
I was planning to try to learn Android, and I have totally no knowledge on Android development.
But Vim is my favorite editor, so I prefer Vim rather than Eclipse.
How do I set up this environment, and how do I run it (from beginning to the end)?
Currently in,
~/.vim/bundle/
I already got
- conque-shell
- nerdtree
- supertab
- command-t
- taglist
...etc.
these plugin. Are there other plugins that I should add in?
I would strongly recommend you to use Vim plugin Eclim for Android development in Vim. I used it, and I found it extremely useful. Code autocomplete, refactoring and so on, is just awesome. Actually, when I started using Eclim, I got power of an IDE with my favorite editor Vim.
Also, you might want to read this publication about using Eclim for Android development.
You don't need any Vim plugins for Android development.
All you need is
Apache Ant for building the resulting app
A Java 5 compatible JDK
The Android SDK
Then you can use Vim to edit the AndroidManifest.xml, the layout.xmls, the Java source, the build.properties, the build.xml, and so on.
You need to know how to build an Android project by Ant.
I also use Vim to develop android project, and I have just created a Vim script for Android development. It is called adt.vim, and I am using it. I hope you will like it. http://www.vim.org/scripts/script.php?script_id=4330
If any suggestion, please tell me. It is still being improved.
Do I need to use Eclipse IDE in order to develop in Android ? Most of the user guides insist on Eclipse !
No, it isn't. See developer.android.com for instructions on how to develop, both with and without eclipse.
Managing Projects from the Command Line and Building and Running from the Command Line, for example, shows how to manage and build a project (without Eclipse), respectively.
Eclipse is very good IDE for android application development. Otherwise there are other IDE's like:
Netbeans, JetBrains as mentioned by DAC
Plus you have got:
IntelliJ
No, it isn't; however, I don't see why you'd want to do otherwise. It greatly simplifies things when using Google's own SDK and Eclipse plugins.
I think it may be somewhat futile to develop for Android without an IDE if you plan on using the emulator, debugging and anything else that is useful for Android development; however, most of the other large Java IDE's support android:
NetBeans
JetBrains
No it's not. You could even use nicer languages like scala... (take with a pinch of salt)
I've used Eclipse and vim variously as development environments for Android applications and found both the Eclipse plugin and the command-line SDK tools to be of similar capability.
Since I haven't explored either in its entirety, however, I'd like to ask:
What advantages are there to using Eclipse over the command-line tools and vice-versa?
I could see:
(Eclipse) nice GUI for debugging
(ant/adb/android) more amenable to automation
(hybrid) you can have it all, can't you!?
I'm especially interested in specific features that may be a deal-breaker for one and move a developer in the direction of the other.
Using Eclipse as a development environment for Android doesn't preclude you from also building with Ant to hook into nightly builds or CI tools. You could even configure Eclipse to build using your Ant buildfile if you wanted. If you want some kind of CLI build tool, you might also consider Maven, as it also has plugins to enable building Android apps.
It has been some time (like six months) since I have used eclipse, so maybe it is better now, but I gave up on it because I found it to be very slow and buggy. Maybe it is the integration with ADT, but several times I spent hours hunting down problems that turned out to be fixed if I killed and restarted eclipse (and these problems were not fixed if I did a "clean" within eclipse). After doing that a few times, I felt like throwing the computer against the wall.
"ant clean" is much easier and faster than stopping and restarting eclipse.
Across my personal projects and multiple professional instances of building Android apps, I've always used both types of builds. You'll want to use Ant (or Maven, if you prefer) to set up continuous integration and automated testing. Trying to get that working with Eclipse (which I did a long time ago when the Android SDKs were first coming out) is a nightmare, while Ant/Maven is easily used from any of your favorite CI tools (I've usually used Hudson for this). If there's nothing unusual about your project, it'll be a snap to put together continuous integration, and off you go.
Meanwhile, for just day to day development work, using Eclipse to build your app locally works just fine. But that can easily be left up to the individual developer. I'd make the build that your CI system is running the canonical build, but I do use Eclipse for my normal development.
I'd use Eclipse until such time as you are happy with the debug build. Then you can set up Ant to produce the signed release build.
You can set it up to use the same source files as Eclipse but put the output binaries outside your workspace. You can also set it to use your release.keystore, sign it automatically and obfuscate the code all in one go.
I've set it up to do this. I open a command line (DOS box) move to the projects home directory (\dev\projects\Eclipse\Project1 say), I type "Ant release" and the apk ends up in \dev\projects\AntBuilds\Project1\bin as Project1-release.apk.
If you want the best of both worlds, you might want to look at the m2eclipse-android-integration Eclipse plug-in which allows you to use your command-line Maven build in the ADT/Eclipse environment as well:
https://code.google.com/a/eclipselabs.org/p/m2eclipse-android-integration/
Well for me im just a beginner, but I find eclipse much easier to work with. Android is a pretty complicated to get used to (for me) so having everything layed out in a GUI is preferable to command line. Plus SDK updates and such are easier to get.