-
Notifications
You must be signed in to change notification settings - Fork 9
/
BUILD.howto.linux
93 lines (63 loc) · 3.25 KB
/
BUILD.howto.linux
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
* TriblerDroid *
Preparations
Eclipse with android SDK (my SDK path is ~/android/android-sdk-linux/)
Install Android 4.0 (API 14)
Create an AVD (target: 14, SD Card size: 200 MB)
Get android-ndk from http://developer.android.com/sdk/ndk/index.html (my path is ~/android/android-ndk-r7b/)
Get triblerdroid code (~/android/droid-release-0.1)
$ svn co http://svn.tribler.org/abc/branches/droid-release-0.1
If you run a 64bits machine, you need to install (Ubuntu):
ia32-libs-multiarch
ia32-libs
To build,
1. Compile C++ code:
$ ~/android/android-ndk-r7b/ndk-build -C ~/android/droid-release-0.1/jni/
2. Build .apk from Eclipse (e.g. Run project (as android application))
3. Patch .apk to add missing native lib
IMPORTANT: aapt won't do the right thing on Linux (not in my box anyway). The
hack is to use aapt for Windows with wine. Nasty, annoying, but it just works.
$ cd ~/android-sdks/android/droid-release-0.1/hack
$ wine aapt.exe a ../bin/droid-release-0.1.apk lib/armeabi/libcom_googlecode_android_scripting_Exec.so
The output should be:
'lib/armeabi/libcom_googlecode_android_scripting_Exec.so' as 'lib/armeabi/libcom_googlecode_android_scripting_Exec.so'...
aapt for Linux gives you (so the android device won't find the library on the right place):
'lib/armeabi/libcom_googlecode_android_scripting_Exec.so' as 'com_googlecode_android_scripting_Exec.so'...
4. Sign patched .apk using the andoroid debug key
$ jarsigner -verbose -keystore ~/.android/debug.keystore -storepass android -keypass android -digestalg SHA1 -sigalg MD5withRSA -sigfile CERT -signedjar ~/android/droid-release-0.1/bin/droid-release-0.1_COMPLETE.apk ~/android/droid-release-0.1/bin/droid-release-0.1.apk androiddebugkey
The output should be:
updating: META-INF/MANIFEST.MF
updating: META-INF/CERT.SF
updating: META-INF/CERT.RSA
signing: assets/android.js
signing: assets/json2.js
signing: res/drawable/icon.png
signing: res/drawable/script_logo_48.png
signing: res/drawable/stat_sys_warning.png
signing: res/layout/dialog.xml
signing: res/layout/main.xml
signing: res/raw/script.py
signing: AndroidManifest.xml
signing: resources.arsc
signing: classes.dex
signing: lib/armeabi/libevent.so
signing: lib/armeabi/gdbserver
signing: lib/armeabi/libcom_googlecode_android_scripting_Exec.so
4. Install and run .apk on emulator
Given that you have created an AVD called 'test', run it on the emulator
$ ~/android/android-sdk-linux/tools/emulator @test&
Now, install PythonForAndroid (http://android-scripting.googlecode.com/files/PythonForAndroid_r4.apk)
$ ~/android/android-sdk-linux/platform-tools/adb install ~/android/PythonForAndroid_r4.apk
And triblerdroid
$ ~/android/android-sdk-linux/platform-tools/adb install ~/android/droid-release-0.1/bin/droid-release-0.1_COMPLETE.apk
Now, on the simulator screen, click on applications (middle button) and QMediaDroid
Reply 'yes' to install Python
Push 'install'
(wait paciently...)
Close the Python installation window
DONE
///////////
==Useful commands==
Debug logging:
$ ~/android/android-sdk-linux/platform-tools/adb logcat > logname.log
Uninstalling:
$ ~/android/android-sdk-linux/platform-tools/adb uninstall com.tudelft.triblerdroid.first