Polipoid brings the Polipo HTTP proxy to Android. Polipo lets you do useful things such as cache web pages for offline access and should generally speed up browsing a little.
Polipoid acts as a thin wrapper around the 'Polipo' HTTP proxy. The code is written in the Xtend programming language and is built using Maven. Consequently, to build it you will need in addition to the SDK:
We need a copy of the Polipo binary which will run on the machine you're building for. Once it's built just put it in the root of the assets/ directory. The following steps should take you through the process. See $NDK/docs/STANDALONE-TOOLCHAIN.html
for more info.
Run the following to set up your toolchains, $NDK is the root of your NDK installation:
mkdir /tmp/toolchain-9-arm
mkdir /tmp/toolchain-9-x86
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --arch=arm --install-dir=/tmp/toolchain-9-arm
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-9 --arch=x86 --install-dir=/tmp/toolchain-9-x86
Go to the polipo/
direcory in the polipoid source and run the following:
make clean
PATH=/tmp/toolchain-9-arm/bin:$PATH CC=arm-linux-androideabi-gcc EXTRA_DEFINES="-fvisibility=default -fPIE -U __linux__" LDFLAGS="-rdynamic -fPIE -pie" make polipo
cp polipo ../src/main/assets/polipo-arm
make clean
PATH=/tmp/toolchain-9-x86/bin:$PATH CC=i686-linux-android-gcc EXTRA_DEFINES="-fvisibility=default -fPIE -U __linux__" LDFLAGS="-rdynamic -fPIE -pie" make polipo
cp polipo ../src/main/assets/polipo-x86
Finally to allow the application to run on an Android version earlier than 5.0.0 you will also need to build the 'run_pie' executables for both Arm and x86 CPU architectures. Go to the src/main/run-pie
directory and run the following:
/tmp/toolchain-9-arm/bin/arm-linux-androideabi-gcc -o run_pie-arm run_pie.c
/tmp/toolchain-9-x86/bin/i686-linux-android-gcc -o run_pie-x86 run_pie.c
cp run_pie-arm ../assets/run_pie-arm
cp run_pie-x86 ../assets/run_pie-x86
In addition to installing Maven you will need to make sure the "Android Support Repository" is installed. You can do this by opening the "Android SDK Manager", expanding "Extras" and downloading "Android Support Repository". Now, assuming you've got your ANDROID_HOME environment variable set, you should be all set up.
Another option is to run the https://github.com/mosabua/maven-android-sdk-deployer/ to install the artifacts to your ~/.m2/repository directory.
Once you've done all the above, all you should have to do to build the APK is run mvn package
to build target/polipoid.apk
.
To deploy this APK to your android device or emulator you can run mvn android:deploy
. During development I tend to just use Eclipse for this though.
I use Eclipse to develop the application, and you can too, once you've got Building working. After you've done the following steps you can import the code and act like it's a normal Android project. You will need to perform the following steps:
If the Xtend support doesn't work, you might need to download the Eclipse pre-packaged with Xtend off the Xtend website, then install the 'Andmore' plugin on top of that.
The project is written in Xtend, which gets converted to .java before in turn getting compiled to normal Java .class files. The .xtend files live in src/, and generated .java lives in gen/. To follow stack traces you will need to look at the generated files. Also breakpoints only seem to work when set on the .java (as of writing).
To release the project to the Fdroid repo do the following: