Build Android project using AndroidProguardScala with Ant - android

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.

Related

How do I use Clojure in Android Studio using Graclj?

My ultimate goal is to be able to write Clojure apps for Android, using Android Studio and Cursive. I started with leiningen but found out that it is a build system that is independent of what Andoid Studio uses ie Gradle. So I tried leiningen with Intellij, but couldn't get Android deploys to work except from the command line. Since I wanted to integrate with Android Studio, I decided to try Graclj: https://github.com/graclj/graclj which is a Gradle plugin for Clojure.
I can get the Graclj tutorial running in Android Studio, as per this guide:
https://github.com/graclj/learning-graclj/tree/learning-0.1.0
However:
Graclj expects the Clojure src and built classes and jars to be in the root project
Android Studio expects src and classes to be in the app subproject
After the tutorial I end up with separate Gradle build tasks for Graclj and Android Studio but I don't know how to integrate them
So, can anyone suggest a way that I can hook into Andoid Studio's build process?
Do I need to change some settings to the Graclj plugin to do this? If so, how?
Do I need to change some Android Studio plugin settings?
Do I need to add/change something in the Gradle build scripts?
Am I heading down a dead end? ;-)
I have looked at the Android Studio build process: http://developer.android.com/tools/building/configuring-gradle.html
but I don't know enough about Gradle to know what I'm supposed to be doing here.
If I need to supply any more info, just ask.
Any help appreciated!
Unfortuantely, I don't have any Android (let alone Android Studio) experience. However, I'll do my best to answer based on Gradle/Graclj knowledge.
Graclj does not require you to use the root project. You can apply the plugin(s) in any of the projects that you have in your build. However, I don't know how well a model-based plugin like Graclj will work with the "traditional" Android plugin. You could try the "experimental" one that's using the model approach, though there's a decent chance that it won't be compatible unless there's one that works with Gradle 2.12.
Alternatively, you might be able to add a dependency to the Android app project on the JAR produced by Graclj (which you may still want to put in a project besides the root). Not sure if there's a very good way to do this (haven't tried myself).
dependencies {
// my-other-proj being whichever one you use Graclj in
compile project(':my-other-proj')
}
Or maybe you would need to add it to a configuration first in the my-other-proj to interop with traditional plugins:
artifacts {
archives createMainJar
}
It is possible that you're at a dead end (for now). Graclj is very new, so this stuff should all be possible eventually.

Add android eclipse library to unity3d project

I have an android library in the form of an eclipse project that I want to integrate with unity3d. I know I can make a jar from eclipse and drop it in unity's plugins/android folder. However as I understand it that necessarily strips out the resources from the project.
If I export the unity game to an eclipse project, I can right-click and add the android project as a library. However I don't like this approach because it doesn't fit with our current automation process - which basically just script's unity's build dialog.
I'd like a way to tell unity that I want this eclipse project linked as an android library on export. Does anyone know a way to do that, or how to pack the resources into the jar or another way of getting this stuff to talk?
One possible way to go is using Unity's Build Player Pipeline. Depending on the platform you are working on you then have to set up a shell script or do your stuff in C#.
It's some year ago that I were a Java/Eclipse expert as I am working on iOS now. The Android Developers page shows some way to manipulate projects via command line.
Maybe the better way to go is using Eclipse switches like --import (s. 1st answer in Create an Eclipse project on the command line? and the link provided) but on the other hand I can't find the switch in the help pages.
Well, not really a bounty answer but maybe some inspiration :-)
The only real answer I've found is that in 4.2, you can drop an eclipse project in plugins/android and it will be linked correctly. Just have to hang on I suppose. :-/

How do I set up an Android development environment PURELY in Vim?

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.

Building .so libraries on windows for use on android

I am building C libraries that will be used by an android app(through either JNI or the NDK, I've never used the NDK though) and I am wondering what IDE/development environment is best to use? I've basically only used Visual Studio for native development and I'm not sure how to adapt to building .so libraries for use on android.
Thanks
EDIT: Update -- I want to avoid makefiles if possible (never used them) and rather use a complete IDE such as the case with visual stuido to compile
Generally, cygwin (i.e. command line) is used for building Android native code. But you can also try to use Eclipse for this purpose. It doesn't help very much but it highlights syntax and you don't have to switch to other apps to write code and build your app. You can read more about using Eclipse for C/C++ Android development here.
I would strongly recommend that you use the NDK's compiler.
Normally this is done by writing an Android.mk in accordance with the instructions for the NDK. It is not complicated. The easiest thing to do is to grab the hello-jni sample app and just make the necessary changes, for example substituting your source files into its android.mk.
You can stay in visual studio if you like that as an editing environment, simply using the ability to bind an external command to a keystroke to launch the ndk build script. Ages ago I had figured out how to reformat GCC error messages with sed into something that VS could parse to make them click-able, though I soon moved development of that project under linux.
I think a lot of people use Eclipse as their IDE for Android development. I use it and its pretty good. You shouldn't have any problems if you're used to VS.
The Android SDK comes with a plugin, the Android Development Tools (ADT), to develop applications for Android inside the Eclipse IDE, which is same kind of beast as Visual Studio. And within that IDE, it is possible to use JavaCPP (disclaimer: I am the author) to have it compile all the native C/C++ stuff we need through the Android NDK, but without needing Makefiles and such. More details here:
http://code.google.com/p/javacpp/#Instructions_for_Android

Android NDK with Visual Studio

I'd like to build some native libraries for android using the NDK (native development kit), but i'd like to use Visual Studio 2010 to do it. I've googled quite a bit but haven't found any information on it. Does anyone have any experience with this and know the steps necessary to make this happen? I have CYGWin installed, made sure i get Make (per the NDK instructions), but i'm not really sure of the next steps in terms of setting up the project, compiler in visual studio, etc.
If anyone knows of any write-ups, tutorials, or links to sample projects, that would be awesome, as there isn't much on google yet.
thanks!
Here's another solution, which integrates the NDK fully within Visual Studio. No makefiles. It behaves like a proper Win32 project:
Here's an excellent blog post about how you can configure your environment to debug android NDK code using Visual Studio.
Visual Studio is officially not supported.
Some problems (but not limited to):
MSVS cannot create the proper ARM binaries
Android makefiles (.mk) are not supported by MSVS
There are however, third party solutions:
vs-android
VisualGDB
You might want to check out DS-5 as well, though it's not Visual Studio.
The answer depends on what kind of integration you require.
To just build the native Android code from Visual Studio you can create a new Makefile project, and make it run ndk-build.cmd when you press "build". If you would like to get the error messages mapped as well, you will need to parse the output of ndk-build.cmd and convert it to a format that Visual Studio can udnerstand.
If you want to debug your native Android code from Visual Studio, you will need a third party tool that will control ndk-gdb on behalf of Visual Studio and provide workarounds for several bugs (e.g. rebind breakpoints when libraries are loaded).
You can try our VisualGDB for Android tool that does exactly that - creates projects that wrap ndk-build and controls NDK debugger on behalf of Visual Studio. If you need more information, there is a step-by-step tutorial available.
I have not found a direct clean solution, here is my workaround.
I develop my native code on VS as a static library, and use some test project to try it as a console aplication.
When it is ok, from cygwin I use a little bash script that copies all needed files to the jni folder and launch the standard android ndk make command. (also copy some file to assets folder when needed), producing the executable in the right folder.
To use the pthreads I have linked my projects to pthreads-win32.
The only files I do not compile in VS are the jni code.
I hope this can help you.
There's also a couple of other third party alternatives for developing ANdroid apps with VS in addition to those above. There is the open source dot42 located at http://www.dot42.com and Remobjects, http://www.remobjects.com , which allows you to program in c#, Pascal, and Swift. I have played with the trial of Remobjects and am now starting to play around with dot42.
My use of the remobjects trial allowed me to recreate in c# the first five chapter projects in the textbook of the Android course I took. I haven't had the same success with dot42 so far but I need to find some time to really give it a chance.

Categories

Resources