Home » Android » "Minimal" source files to create Android app using Eclipse + ADT

"Minimal" source files to create Android app using Eclipse + ADT

Posted by: admin June 15, 2020 Leave a comment


I am trying to understand the anatomy of a MINIMAL Android application, using Eclipse + ADT (Android Development Toolkit).

Please can you advise what is the MINIMAL set of source files I need, for example :-

src / package / MainActivity.java
res / layout / activity_main.xml
res / menu / activity_main.xml  (??)
(any other source files needed?)

Please can you advise what is the MINIMAL that I need to put into each file in order for it to run on the AVD (Android Virtual Device) ?

For example, which of these files needs to contain reference(s) to which other files, etc?

How to&Answers:

Strictly speaking the minimal project that displays Hello World is

├── AndroidManifest.xml
├── res
└── src
    └── com
        └── example
            └── minimal
                └── Minimal.java


package com.example.minimal;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class Minimal extends Activity {

    /* (non-Javadoc)
     * @see android.app.Activity#onCreate(android.os.Bundle)
    protected void onCreate(Bundle savedInstanceState) {
        final TextView tv = new TextView(this);
        tv.setText("Hello World!");



<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="15" />

    <application android:label="Minimal">
        <activity android:name="Minimal">
                <action android:name="android.intent.action.MAIN"/>




You can actually get away with just a single MyActivity.java and the manifest file, if you inflate the layout programatically. Later Eclipse Tools will create many more files (in ..drawables, layout, menu, values) by default. You can however delete them all if you make sure that the manifest doesn’t refer to any icons or strings. I guess it’s not seen as good practice, but it can be done.


A minimal build.xml which can build and install dtmilano’s code:

<?xml version="1.0" encoding="UTF-8"?>
<project name="MyName" default="help">
    <property environment="env" />
    <condition property="sdk.dir" value="${env.ANDROID_HOME}">
        <isset property="env.ANDROID_HOME" />
    <loadproperties srcFile="project.properties" />
    <import file="${sdk.dir}/tools/ant/build.xml" />


ant clean
ant debug
ant install

Tested on Android 23, Ubuntu 15.10. Just make sure that adb install works before running this.

On a repo to make getting the code easier.