-
Notifications
You must be signed in to change notification settings - Fork 458
HOWTO Compile AFWall
If you don't know anything about compiling Android apps (apk's), you should better read this article here first.
- Software
- IDE Requirements
- General procedure using Android Studio
- After repository refactoring and cleanup
- Build via Command Line
- Compiling native binaries
- Compiling via graphical user interface
- For experts user only!
- Useful links
Android Studio:
- AndroidSDK
- Java Develop Kit (JDK) 1.7
- 7-Zip to extract Eclipse/Android SDK packages [optional]
- Basic cmd/terminal knowledge [optional]
Eclipse (old):
- Eclipse Classic
-
ADT for Eclipse or get the Plugin via
https://dl-ssl.google.com/android/eclipse/
in Eclipse "Install New Software"
Advanced users can build the latest AFWall+.APK from the Command Line or see the next steps.
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.)
- Download and install some GitHub sync-tool like SmartGit or GitHub for Win/Mac.
- Download and install the JAVA SE Development Kit 7 (JDK7) 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 Open Project and then navigate to your GitHub synchronization directory where you have added AFWAll+, from your GitHub sync-tool.
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 API's related to API 14 (or higher), which is our lowest supported API. For more details follow the setup instructions here. 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 Release (assembleRelease). 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=******************************
If all of the above succeeded, push the AFWall+ .apk to your device and run.
❗ JAVA 8 is not yet supported. Use a supported JavaVersion (class -> dex
conversion can't handle 1.8 right now). VERSION is unrelated to your JDK. The JDK has to be >= VERSION.
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 "Import Non-Android Studio Project"
Selecting "Open an existing Android Studio Project" doesn't work, as it doesn't seem to setup the .gradle and .idea files etc.
Choose the Android list targets - lists all your installed Android target e.g. API level 17 for the latest Android Version.
Select: "id: 4 or "Google Inc.:Google APIs:17" Name: Google APIs Type: Add-On Vendor: Google Inc. .... "
You also can use the "-t 4" argument.
After this we set our JAVA_HOME path:
- export ANDROID_JAVA_HOME="/opt/sun-jdk-1.9.0__22"
- mkdir afwall_build
- cd afwall_build
- git clone git://github.com/ukanth/afwall.git
- cd afwall
- git submodule init
- git submodule update
- android update project -p . -s
- ant debug
This build the afwall-debug.apk and place it into /bin
folder.
On the host side you'll need to install:
- NDK r9, nominally under /opt/android-ndk-r9
- Host-side gcc, make, etc. (Red Hat "Development Tools" group or Debian build-essential)
- autoconf, automake, and libtool
This command will build the Android binaries and copy them into res/raw/
make -C external NDK=/opt/android-ndk-r9
- Here is a Video Tutorial from a xda member for those users who want to use the graphical user interface (GUI) method. The tutorial is based on the needed software explained above.
- Here you get the official build instructions.
Use apkbuilder
(included in the Android Develop Kit)
apkbuilder ${output.apk.file} -u -z ${packagedresource.file} -f ${dex.file}
Use jarsigner
jarsigner -keystore ${keystore} -storepass ${keystore.password} -keypass ${keypass} -signedjar ${signed.apkfile} ${unsigned.apkfile} ${keyalias}
adb -d install -r ${signed.apk}
- List of Sample Apps | Android Developers
- Installing the Android SDK | Android Developers
- Signing Your Applications | Android Developers
- How To: Decompile / Compile .APK | XDA-Froum
- How to build .APK file? | Stack Overflow
- How-To: Decompile/Recompile APK's with ApkTool | AndroidForums
- How to Create Android Apps - Eclipse Export .APK Market Ready Files Step-by-Step Guide | YouTube
Footer