How decompile an Android Application

Decompile is a process to revert the compile operation. I main, decompile converts the low level code in high level code. The Android application is compiled in APK container that groups files as: xml, images and class. APK containers are actually ZIP containers. An interest thing is can see the xml configuration or some source code of others applications. If this applications are Free Software is not a problem, but if this applications are privated we can’t see its configuration. The next application help you to decompile an APK file to see xml configuration and source code.

Some tools I’ve found:

  • APKTool: Decompile all the configuration XML and resources as images. It’s great to view AndroidManifest.xml or some layout xml. The source code is decompiled to “smali”. This assembler language is based in dalvik but it’s not translate to JAVA.
  • dex2jar: If we unzip the APK file we find a .dex files. This tools translate .dex file to JAR file with all the class files of the project. So, you can use any class2java decompiler to view source code
  • JAD Java Decompiler: It’s widely used through command line and very useful to make scripts by automatic process
  • JDGUI: Graphic decompiler and integrated with eclipse. It’s not a efficient solution to run process in background.
Currently, I’m interesting in decompile Android applications because I want to know the data imported/exported by them. And this is possible if I can analyze the AndroidManifest.xml and the source code.

ESTUFA is a framework that provides several ways to connect and re-use mobile applications (in previous post I already presented this idea). The system allow build “execution chains” to connect and plumb two applications.

This project is based in the idea of re-use and compose new applications using components (in this case Alchemist). It has a strong context with “end-user software engieneer”, we want implement a solution from end-user non-developers to build new applications without technical knowledge.

See the video to know how it’s possible connect IO FileManager with Twitter or GMail. For this, we use an execution chain that create a file zip from files of File Manager, upload it to dropbox, obtains a tiny URL pointing to dropbox and finally send this url to GMail or Twitter. The power of ESTUFA resides in its alchemists and the compatibility between these and applications.

If all goes well, this project will be my PhD thesis over the next 2 years :-)

 

Arduino & Android & ADK

The last Google I/O a new feature based in Android and Arduino was released. The ADK allows the communication between Android and Arduino using a USB connection. Google have developed a library called “USB Accessory” in Android and Arduino. So, this library help us to send and receive data through USB interface. Using the USB accessory we can control the Arduino board. We can power-on or power-off leds, servos, components and read the data of sensors (temperature, humidity, movement, etc).

The next video shows how is possible read/write an analog I/O (values between 0 and 1023) and read/write digital I/O (values 0 and 1). We have connected three leds to digital outputs and one potentiometer in an analog input. The potentiometer simulated all possibles values (0-1023 ~ 0-5v).

Arduino Source Code: ExampleBoardArduino.zip

Android Source Code: ExampleBoard.zip

During the next months I will work in three interesting topics. The first of them is the creation of a new architecture based in Android that allow communicate and integrate applications. The second  is the port of ARviewer to iPhone platform using phoneGap. And the last one is the very well-know Arduino and its possibilities with Android USB Host.

Some months ago we have started to developed a new idea about “create new android apps easily”. The magic idea is that the user can connect two o more applications with “connectors” (your way), although this applications haven’t been developed for that purpose. For example, imagine that you can (as user) configure twitter to show the all contents in ARviewer application, or you can configure to show this twitts in an amazing map. The developers don’t know the use of his data, only they configure some outputs and inputs and the final user is the responsible of link this applications. Numerous filters also are incorporated into the platform, so the final user can modify the data exchanged between applications. All the ideas are early but I wish tell you in more detail in the next posts.

Currently, ARviewer is the best FLOSS augmented reality viewer. The last year, we began the port of ARviewer to other platforms (iPhone) using a multi-platform framework. In the previous post I talked about the implementation in Android using PhoneGap. In short, we will have the development completed to run in iPhone platform. Some people have shown interest about this project, so we are very exciting about this and we are looking forward to show our work!

Google announced  in the last Google I/O a new feature: Android Open Accessory Development Kit. The new amazing feature allow communicate the Android devices with the Arduino boards using a USB HOST! This is a cool idea! New projects are shaping up using this technology to communicate micro-systems with Android devices. For example, imagine a little electronic circuit with Arduino that control a cooling system. You could connect your android phone to Arduino board to control and recollect all the information about the system. See an example of this idea [video]

The next 6 months I will work in these topics, so I wish tell you all the results about this interesting topics before the end of the year!

ARviewer, PhoneGap and Android

Three months ago I wrote a post describing the plan that Raúl Roman and I are involved: build an augmented reality interface using PhoneGap. Today, we have uploaded a beta version (0.1.0) of ARviewer-PhoneGap to Android Market. This version works fine and shows the geolocated nodes obtained from libregeosocial server. The next steps are:

  • We test this source code in IOS platform to check the real portability that phoneGap provide us.
  • We plan to add the “tagging mode” with phoneGap to allow tag new nodes/objetcs from the mobile.

Are very very similar the next images, right? Only we have found a critical problem with the refresh of nodes in the WebView using PhoneGap. We will study and analyze this behavior.

 

ARviewer PhoneGap

 

ARviewer Android (native)

 

More info: http://www.libregeosocial.org/node/24

Source Code (GPL): http://git.libresoft.es/ARviewer-phoneGap/

Android Market: https://market.android.com/details?id=com.libresoft.arviewer.phonegap

Two weeks ago, I have received the new fashion gadget of Microsoft: the kinect sensor. Thanks for the community (libfreenect), this sensor designed for Xbox can be used in GNU/Linux systems. Lately I have the need of integrate anything with Android mobile (is it because I have over 3 years programming with Android?) So, I couldn’t pass up this opportunity!

Using JDEROBOT (a distributed framework to programming behaviors robotic) and ICE (Internet Communications Engine) is possible show the images of kinect in an Android mobile. Using the mobile we can see the normal image, the depth image, control the tilt movements and play with the leds. For this, it’s necessary connect the kinect to PC with jderobot running and the android mobile access to PC using wifi connection to obtain all the date and images.

Soon, all source code will be FLOSS, meanwhile you can see the next video.

Since 6 months ago we have evaluated the possibility to implement a new AR interface (based in our project ARviewer) using phoneGap. phoneGap is a mobile framework based in HTML5/JS that allow execute the same source code HTML5 in differents mobile platforms (iphone, android, blackberry). It seem a good way to create portable source code. Since 3 years ago I work in this project with Raúl Román, a crack coder!!

Currently using phoneGap is not possible obtain the stream camera in the webView widget. So, this part of the source code must be developed in the native platform. We find another problem. We could not put the webview transparent so it would look the camera in the background, and paint objects on top with HTML. In this case, we asked for this to David A. Lareo (Bcultura) and Julio Rabadán (Somms.net) and gave us some very interesting clues about this problem.

The solution is implemented in the source code that you can see below. It’s necessary that our main view (R.layout.main) is the main view, for this we do ‘setContentView’ and later we add the main view of ‘DroidGap’ using ‘addview’ and ‘getParent’. Once we have our view mixed with phonegap main view, we set the backgroundColor transparent.

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.init();
        super.loadUrl("file:///android_asset/www/index.html");

        setContentView(R.layout.main);
        RelativeLayout view = (RelativeLayout)
                              findViewById(R.id.main_container);

        // appView is the WebView object
        View html = (View)appView.getParent();
        html.setBackgroundColor(Color.TRANSPARENT);
        view.addView (html,
                      new LayoutParams(LayoutParams.FILL_PARENT,
                      LayoutParams.FILL_PARENT));

        appView.setBackgroundColor(Color.TRANSPARENT);
    }

Currently, we have started this project so I will post the full source code in this blog

Address2Mobile project facilitates to user transfer information from screen (other devices also is possible) to mobile. In concrete it helps to user to create new nodes into LibreGeoSocial (LGS) application. Until now if you would like to create a new node in LGS, it should be done manually, introducing the text of the note by hand (using the mobile keyboard).

Address to mobile add a new method for this task. It uses the mobile camera for read QR Codes that will content encoded the information. Once that mobile read QR code, the LGS application incorporates the encode information into a new note ready to upload to the server.

This project is part of the Master on Free Software imparted by LibreSoft and Rey Juan Carlos University of Madrid. The author of this project is Carlos Cortes and Address2mobile is part of LibreGeoSocial official trunk. You can get the source code of LGS patch in subversion log and the source code of client-side-maps is availabled in the subversion. All code, of course, is FLOSS.

A great final project. Carlos thanks for your collaboration in LibreGeoSocial!

LibreGeoSocial 1.2: Download
Client-Side-Maps: Demo
Documentation: Presentation [PDF] and Slides [ODP]

Today, the day has begun early. I woke up at 5.00 a.m. because we had the AVE at 6.35 a.m. The target of the trip is to attend the “Libre Software World Conferente 2010 – Málaga”. Three weeks ago, the Junta of Andalucía announced the cancellation the OSWC2010. In this moment, enterprises and associations as ASOLIF, AndaLibre and the community began the organizing of an alternative conference, LSWC2010.

We have helped in this event from LibreSoft participating in several talks. In the morning, we have participated in a round-table about “Tourism and Free Software” where Abancq and AndaluciaLab have participated too. Before launch, I have presented LibreGeoSocial project inside of Tourism and Software Libre contexts. This talk have been very interesting because the assistants have shown their comments about AR, Android, Tourism and the geolocated data. I have used this SLIDES to present the project.

After launch, Jesús talked about “Free Software and University”. You can get more information about this talk in Jesus’s Blog.

This conference has been a great success, cool organization and it has been shown that this event, or free software, is not joined and sponsored by the “Junta de Andalucía”. Thanks to FLOSS enterprises this event has been celebrated in Málaga. In this way, I had the possibility to great people and friends of the FLOSS World.

See you the next year!! (with or without “Junta de Andalucía”)

The last week we had the opportunity to present (one more time) our project LibreGeoSocial. The first, we want to thanks MadridOnRails to invite us for promote our group GSyC/LibreSoft and out research lines. This year, the SIMO only had one hall!! (8 years ago, the SIMO used ten halls).

We made the presentation in the stand of “Ayuntamiento de Madrid”. There are several slots of 20 minutes where the people talk about his projects. In our case, we speak about our research group (talk by José Gato) and about our Augmented Reality FLOSS engine, LibreGeoSocial (talk by me). As usual we awaken curiosity because our research group is atypical and we have some interesting projects to the industry. One important conclusion is … the slides are boring!! The augmented reality videos are very impressive!!

If you want to see the presentation and videos in PDF format, download the Slides

License