Android project

The simple way to create android project is IDE, which will generate typical structure of project

Code example

If some directory is omitted in your project like jni you must add as needed.

file/folder description
app/ Main module of your application. You can add more modules if necessary. Content of other modules is similar.
app/build/ Contains build outputs like compiled java classes, .apk or .aab files.
app/libs/ Contains local libraries that module may use.
app/src/ Contains source files of application, i.e. code and resources.
app/src/main/java/ Contains java/kotlin code.
app/src/main/res/ Contains resources of application like strings, images and etc. Through subdirectory names, you can specify resources for different device configurations such as screen size, language, etc.
app/src/main/assets/ contains files that should be compiled into an .apk file as-is. You can access to them using the AssetManager.
app/src/main/jni/ Contains native code using the Java Native Interface (JNI).
app/src/main/gen/ Contains the Java files generated by Android Studio, such as your file and interfaces created from AIDL files.
AndroidManifest.xml File contains configuration of application like application components and permissions.
app/src/main/androidTest/ Contains code for instrumentation tests that run on an Android device.
app/src/main/test/ Contains code for local tests that run on your host JVM. File belong to the Proguard library, that is used in build script to build release version of application. This library minify and uglify code. If you wrong configure proguard, application can crush. For example, you use java reflection with class MyCls, but Proguard changed name of class to A. So you need exclude MyCls from handling by Proguard. File contains local property of project. By default it contains path to the Android SDK.
*.gradle Files belong to the Gradle build system, that is used to build/run application. So you need to learn it, as minimum how to add dependency to project from other projects and libraries.

java 8 features

Java 8 has been supported natively since Android SDK 26. But with Android Gradle plugin 4+ you can use a number of Java 8 language APIs without requiring a minimum API level for your app. For this you must add desugaring to the build.gradle.

If you forget to do this, a java.lang.NoClassDefFoundError will be thrown when using Java 8 features such as lambdas.


APK means Android Application Package.

The apk is the file format that Android uses to distribute and install apps. It contains all the elements that an app needs to install correctly on your device.

If you develop android application, then result of you project may be .apk file.

Actually .apk like .jar file is a .zip file.


The AAR means Android ARchive.

The The .aar the file format that Android uses for distribution the android binary libraries.

If you develop android library, then result of you project will be .aar file.

Unlike .jar file, it contains android rsources.


The AAB means Android App Bundle.

An .aab file is used by developers for uploading apps to Google Play. After upload, Google Play uses a process called Dynamic Delivery to deliver optimized versions of app packages (.APK files) to user devices so they contain only the specific portions of the app that each device needs to run. With Dynamic Delivery, app install sizes can be reduced significantly on user devices.

App bundles cannot be installed as Android apps on user devices. If you'd like to generate APK files from an AAB file, you can use a tool called bundletool.