8000 GitHub - er2off/basic-android-app: Basic Android application with only GNU Make.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
/ basic-android-app Public template

Basic Android application with only GNU Make.

Notifications You must be signed in to change notification settings

er2off/basic-android-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Basic application template

This is basic template of Android application that does not uses gradle, CMake and others, just GNU Make.

This template uses newer AAPT2 and D8 unlike most others Makefile projects for Android.

Installation

Copy conf/config.example.mk to config.mk and replace values with compatible for you.

To just build an APK, run make

To deploy to device (connect it before), run make deploy

To clean compiled files, run make clean

So easy!

Why this can be useful?

You can learn more about Android low-level build processes such as .java's to classes.dex translation and magic R class. Also you can learn about modern Android build tools such as aapt2 and d8 (replacements of aapt and dx).

What the hell happens here?

This is the most interesting part!

  1. AAPT2 compiles res/ files into *.flat files into directory. Also it uses weird output file naming:
  • slashes are changed with underscores and .flat extension is added
  • BUT for values/ it also replaces .xml with .arsc for some reason.
  1. AAPT2 links resources to res.apk and generates R*.class files, so you can use R.layout.main instead of some 0xCAFEBABE.

  2. Then we are using javac in the same way as usual Java applications. It uses both .java files in src/ and work/java/ (where R.class located).

  3. Then d8 utility (another magic utility) generates classes.dex. This utility also can convert Java8+ features into Android-compatible ones. Additionally to economy some space, in this makefile R.classes are excluded from list (however, this can break some apps so keep in mind).

  4. To install application, we also need key, keytool makes it.

  5. We are using zip to add classes.dex and everything other (such as assets/ or lib/) into copy of res.apk

  6. To speed up application and maybe even reduce its size, we are using zipalign.

  7. To make app installation possible, we sign it with generated key. Note that when use javasigner, first sign and then zipalign.

  8. PROFIT!

About

Basic Android application with only GNU Make.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0