How to use code automation for Android Projects? - android

I am extremely new to the idea of Build Automation, and am not sure if it would be helpful for me or not. Honestly, I'm not exactly sure what it does or the benefits of it. I've been looking up a lot of information about Maven, and am having a bit of trouble piecing it all together.
Right now I develop a lot of similar Android applications. Most of these applications have a similar base of functionality which I copy from one application to the next. However, when I make changes to one part of that "main functionality," I need to go back and apply the changes to other applications. This is horribly inefficient, obviously. What I've been beginning to do is to set the main functionality as a library which is then imported by each application. So far so good.
So in addition to the library approach I'm using, would Maven be helpful? Is there something else more helpful that I haven't seen yet? Sorry for the really basic questions and thanks for the help!

Maven will not help you for code generation it will only help you to automate your build process.
You can configure your eclipse using maven plugin for android Android SDK Full Javdocs with Maven in Eclipse
I have not used Maven for android project as of now since currently I am using Ant for that purpose. You will find sample maven and ant files in the examples in android SDK
About code Generation:
I have read that Acceleo provides support for android based UML Code generations.

Related

Robotium project and maven

I tried to create an android test project using Robotium as testing framework and maven as builder. But, is it necessary for my android application to use maven as builder ???
No, you do not per se need Maven. As a matter of fact, the Getting Started of Robotium gives a basic example of how to do this in just Eclipse.
Now, would life be better when using Maven. I generally like "yes" for an answer to that question. Testing is only one part of your iterative development, and it is great to have all your steps automated. Doing that with Maven allows you to leverage the entire lifecycle that it offers for your project from test driven development, perhaps in an IDE, to packaging and deployment. And the Android Maven Plugin fits into that approach.

Appcelerator Module development : How to connect my Java source with the module

I have been trying to build a module in Appcelerator to let one Android library become available to Appcelerator platforms as well, but the documentation on Appcelerator site isn't helping me much. It's been two days since I am hitting walls.
I followed Android Module Development Guide available on their site, but it doesn't specify many things, for example:
It tells about creating a module from command line for a calculator, but doesn't write much about how to integrate the actual code.
I might be missing something, that's a possibility, so I am giving it a read once again.
But can anyone point me towards correct direction or make things a little more clear please?
I am answering my own question, so that if someone comes here it helps them.
Turns out that I was hitting the older version of their documentation, called Wiki.
The newer version hosted at docs.appcelerator.com are more descriptive.
In this particular case, these docs helped me quite a lot.
Apart from this, following links helped too and I got a sample module built and running:
Titanium Module Concepts
Integrating an external library in an Android module
Module Development Guide Reference Module for iOS and Android
Hope it helps someone.

Build Android project using AndroidProguardScala with Ant

i'm developing for Android in Scala following instructions from Eclipse, Android, Scala made easy but still does not work. Everything works great in my development machine, building within Eclipse.
But now i need to build the project with Ant, outside of Eclipse, and i'm lost.
I still want to use this method, don't want to use SBT. So i'm assuming i should do a "headless build" of the plugin... any hint?
You really should try and use SBT. There is a great plugin for sbt on github with a good getting started tutorial. Also, SBT's wiki has some really good information for how to go beyond the basic sbt.
The sbt-android plugin has a really nice feature where it adds Typed Resources to your android build so you can do something like:
var button:Button = activity.findView(TR.myButtonInTheLayout)
Type safe layout management... its a pretty handy feature.
Sbt-android also supports using standard scala directory layout or standard android directory layout, whatever your comfortable with.

What benefits does Maven give (over ant) for building android projects?

I've recently been trying to setup maven for building my android projects, using the maven-android-plugin.
Whilst this is a good exercise, I'm not convinced that the benefits will outweigh the frustration in getting it working.
Can anyone give me some pros/cons on using Maven for android? I'm not looking for subjective answers, but the facts on whether its worth the effort.
Regards
Well maven is worth it if you are developing a j2ee application to save you from the jar hell
when using external apis
So if you are not going to use the maven repositories its not worth it.
I hate maven because of the problems you already mentioned. But it saves a lot time if you need xy jars. Im currently developing a eclipse plugin which can download required jars and dependencies form maven without the maven compiler or pom files. But its far from ready
You can also create a separate maven project and include it in the android project
im not sure if it works with android but you can do it in standart jdk
Maybe the gradle makes more sense.
Google released an ide called AndroidStudio, it uses gradle. Seems like google will suggest gradle in building an Android project.
I tried to use Maven to build my android project, it's hard to use, finally I changed to gradle.
Another good answer on stackoverflow why-use-gradle-instead-of-ant-or-maven
My android app shares business objects and other functionality with my back-end server so I pulled this out into a common maven project which both the app and the server (as maven projects) have a dependency on. Maven is perfect for this sort of thing, so its helpful in this instance, but if you are writing fairly straightforward apps, I'm not sure what benefit maven would have, especially when getting the android-maven-plugin to behave took me so long.

Scala Programming for Android

I have followed the tutorial at Scala and Android with Scala 2.7.3 final. The resulting Android App works but even the most basic application takes several minutes (!) to compile and needs 900 kb compressed, which is a show stopper for mobile applications. Additionally, the IDE runs out of memory every now and then. I assume dex is not made for big libraries like the scala-library.
So my question is: Has anyone actually done this and is there any cure for this?
I've written some basic Android applications in Scala, nothing too epic. Not being a Java programmer I was suggested to use a "treeshake", I was explained by a friend that this strips out all the unnecessary libraries from the jar files.
I have not documented it, but I found that someone else already has:
http://chneukirchen.org/blog/archive/2009/04/programming-for-android-with-scala.html
Proguard is not the only solution, you might find something that suits your work flow or is more suited for your environment.
Additionally google have just realised JACK , which deals with quite a lot of reducing build and memory times see https://source.android.com/source/jack.html
You can now use the Android plugin for Gradle to create Android applications in Scala. It incorporates the ProGuard tool to trim the fat from the resulting APK file, so seems to meet your needs.
https://github.com/jvoegele/gradle-android-plugin/wiki
There is also an plugin for the Scala-based builder sbt: sbt-android-plugin.
For tutorials and examples, see also Stéphane Micheloud's "Exploring Android" page: http://lamp.epfl.ch/~michelou/android/
I verified this detailed solution with Eclipse 3.7, Scala 2.10 and the plug-in AndroidProguardScala v50:
https://stackoverflow.com/a/11084146/1287856
Everything works fine. A simple test application with scalafied main activity class only takes 38Kb. Libraries projects are supported. Proguard is activated when exporting the project.
Developing Android apps for Scala is continuously evolving. The current best way to do it appears to SBT in conjunction with the android-sdk-plugin, which is maintained* and works well for me in my Scala/Android project. A somewhat recent example that demonstrates the use of this plugin with the already mentioned Scaloid can also be found.
Please note that this question is a typical example of a question with outdated answers on Stack Overflow. This answer will likely become outdated at some point as well.
* The other SBT based projects mentioned in this answer thread don't appear to have code being written for them in the last six months at the time of writing. They may have compatibility issues with newer versions of Scala and SBT.
If you use maven, use android-scala-test as a startup template. It works great for me out-of-the-box.
Scaloid is an Android API wrapper written in Scala that help you to write your Android program in Scala-style.
You can use the Scala on Android without SBT, it built externally by Gradle to create Android applications.
https://github.com/yareally/android-scala-intellij-no-sbt-plugin
Gradle is more native building tool for android than SBT.
There is good example of Scala client and server side solution concept, and gradle building tool as advance for IntelliJ IDEA workbench.
Big advance that core classes are common for client and server.
https://github.com/ghik/akkdroid
Good tutorial for IDEA and android-plugin:
http://fxthomas.github.io/android-plugin/
The biggest issue with Scala on Android is the compile times.
Possibly because of the Proguard class stripping compiles with IDEA13/Scala plugin on a Dual Quad Core (8-CPU) E5450 Xeon with 8GB can take two minutes or more.
I simply moved back to Java after completing a largish Scala Android project as compile times were too frustrating.

Categories

Resources