Skip to content

HOWTO Compile AFWall

CHEF-KOCH edited this page Jan 24, 2016 · 36 revisions

❕ If you don't know anything about compiling Android apps (apk's), you should better read this article here first. ❕

Index

Software

Build from Android Studio:

Build from Eclipse (old):

Advanced users can build the latest AFWall+.APK from the Command Line or see the next steps.

IDE Requirements

AFWall+ can be built using any IDE that supports the Gradle build tool, used by projects such as Android Studio or Intellij IDEA plus many others. (Gradle is the new equivalent of the old "Ant" build tool.)

Setup Gradle

This step is obsolete/optional if you installed Android Studio 1.5 (or higher) since it comes with it's own Gradle version integrated. But the binary is mostly not up-2-date which means that you still could use this step to work with newer versions instead of the Android Studio one, in this case please ensure you correct pointed Android Studio to this version.

  • Download Gradle.
  • Extract it e.g. to C:\ or any dir your want.
  • Setup the $Path (which is important so that Android Studio and your systems recognize it).

Gradle Path

You not need to reproduce this steps for the Java JDK since it (if you used the installer) setup this automatically.

General procedure using Android Studio

  • Download and install your favorite GitHub sync-tool like Git for Windows or any other compatible Android Studio Client. Android Studio supports every Version Control you only need (maybe, if not detected) to navigate to the correct executable and it grabs your settings automatically.
  • Download and install the JAVA SE Development Kit 8 (JDK8) from here.
  • Install the latest Android Studio from here.
  • When you start Android Studio, you'll see "Welcome to Android Studio" with several options. Here you choose to checkout from Version Control, select GitHub and the AFWall+ repo and select the dir you want to fork it to.

The project will open immediately, but now you want to close it, so that you can return to the Welcome screen, this time you choose Configure >> SDK Manager. Here you select all APIs related to API 15 (or higher), which is our lowest supported API for AFWall+, the IDE normally installs the latest (stable) API/SDK automatically. If you want to use an older API you need to download it separately (but it's not recommend). Now click on the sideways Gradle tab, on the right side of the IDE. This will open a new window, once in it, double click on Debug (assembleDebug). Check for build errors in the lower screen log window. If it compiles without errors, you can now build your own APK by clicking on the menu items: Build >> Generate Signed APK. This will ask you for 3 new passwords to be used in your "KeyStore" (1 master, 1 file, 1 APK alias). You may also add your credentials in signing.properties to enable automatic signing.

Example:

WARNING: NEVER UPLOAD THIS FILE TO GITHUB! .gitignore will reject accidental uploads.

  • KEYSTORE_FILE=path\to\mykeystore.keystore
  • KEYSTORE_PASSWORD=*************************
  • KEY_ALIAS=*********************************
  • KEY_PASSWORD=******************************

Generate signed APK

If all of the above succeeded, push the AFWall+ .apk to your device and run.

After repository refactoring and cleanup

Apparently, the first time after you have added our repo using the (Windows) GitHub app, or deleted a previous version from Android Studio, you need to import it into Android Studio by:

  • Selecting "Check out project from Version Control"

Android Studio Select AFWall+ repo to fork

Build via Command Line

Install the latest API and related packages in Android SDK Manager:

$ android

Clone the git repository and build by using gradlew with Internet connection:

$ git clone git://github.com/ukanth/afwall.git 
$ cd afwall
$ ./gradlew clean assembleDebug

After successful build, afwall-debug.apk will be found in aFWall/build/outputs/apk/.

Compiling native binaries

On the host side you'll need to install (for compiling e.g. iptables):

  • Android Studio 1.5 or higher (If you used the above steps you're mostly done).
  • Ensure Makefile are on the correct place.
  • Ensure you use allDebug.
  • Edit and compile the binaries as per needs, the debugger shows the important stuff within the output.txt file.

After Repository Refactoring

Default project view if all was imported correct Successful synced

Useful links

_ Final version 01.17.2016_