-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Development and Debugging on Android
Developers are suggested to use the KOReader emulator on linux and mac. The only reason to develop against an android emulator is to fix or enhance the platform support.
While the minimum API supported is 14 (Ice Cream Sandwitch) there's no way to test changes on anything below API17 using emulators. So please check your changes in a real device instead.
Obtaining source code, required build tools etc are described in readme :
add emulator path to your paths (to start AVD without Android Studio):
export PATH=$PATH:'~/Android/Sdk/tools' ;
~/Android/Sdk/tools that's default path to emulator (from Android Studio)
Release APKs are not signed. You need to sign them before install. See apksigner. Debug packages are signed with AOSP test keys and are recommended for development and debugging.
./kodev release android
./kodev release --debug android
ANDROID_ARCH=x86 ./kodev release android
ANDROID_ARCH=x86 ./kodev release --debug android
Don't forget to cd platform/android/luajit-launcher && ./mk-luajit.sh clean && cd - when changing architectures.
More info: https://github.com/koreader/koreader/pull/3353
cd platform/android/luajit-launcher
make lint
emulator -avd {avd_name}
If the emulator won't start on your system, try preloading the relevant libstdc++ for your system:
LD_PRELOAD='/usr/$LIB/libstdc++.so.6' emulator -avd Nexus_5X_API_23
Note: Some emulators are broken for different reasons. Please check known working emulator at the end of this document.
./kodev run android will automatically take care of it for you, but besides installing the APK through the usual means (e.g., dragging it onto the emulator, copying it over to the device and manually installing it) you can also run ADB yourself:
adb install koreader-android-arm-linux-androideabi-{version_id}.apk
Note: You need to have adb in system path (In ubuntu sudo apt install android-tools-adb.)
Emulator has to be the same architecture (ARM Koreader on ARM AVD) otherwise you will get error here complaining about inconsistent architecture.
./kodev log android
or to see all android logs:
adb logcat
Basic principle explained in https://mhandroid.wordpress.com/2011/01/25/how-cc-debugging-works-on-android/
See some notes on using gdb here.
Run ndk-gdb from platform/android/luajit-launcher. You'll need that in your $PATH:
export PATH=$PATH:whatever/android-ndk-r15c/prebuilt/linux-x86_64/binDiff to work around error:
--- android-ndk-r15c-orig/build/gmsl/__gmsl 2017-07-21 11:03:50.000000000 +0200
+++ android-ndk-r15c/build/gmsl/__gmsl 2019-01-10 21:20:16.847568638 +0100
@@ -509,7 +509,7 @@
# Arguments: 1: A number in human-readable integer form
# Returns: Returns the integer encoded as a string of x's
# ----------------------------------------------------------------------------
-int_encode = $(__gmsl_tr1)$(wordlist 1,$1,$(__gmsl_input_int))
+int_encode = $(__gmsl_tr1)$(wordlist 1,$(words $1),$(__gmsl_input_int))
# The arithmetic library functions come in two forms: one form of each
# function takes integers as arguments and the other form takes theWithout a rooted device you can't browse around in /data but you can execute commands like this:
adb exec-out run-as org.koreader.launcher ls /data/user/0/org.koreader.launcher/files/
We try to maintain compatibility with API level 14.
| Android version | API level | Working x86 emulator |
|---|---|---|
| Android 11.0 | 30 | Yes |
| Android 10.0 | 29 | No |
| Android 9.0 | 28 | No |
| Android 8.0 | 26 | No |
| Android 7.1 | 25 | Yes |
| Android 6.0 | 23 | Yes |
| Android 5.0 | 21 | No |
| Android 4.3 | 18 | No |
| Android 4.2 | 17 | Yes |
| Android 4.1 | 16 | No |
| Android 4.0.3, 4.0.4 | 15 | No |
| Android 4.0, 4.0.1, 4.0.2 | 14 | No |
https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels
Home |
- Changelog
- Install on Android
- Install on Cervantes
- Install on ChromeOS
- Install on Kindle
- Install on Kobo
- Install on PocketBook
- Install on reMarkable
- Install on Desktop Linux
- Install on MacOS
- Install on Windows with WSL
- Install using Linux container (Docker, Podman)
Basic reading controls (click to open)
Advanced reading controls (click to open)
- Getting started
- Gestures
- Change defaults
- DPI control
- Style tweaks for misbehaving books
- Reflowing tweaks
- Screenshots
- Troubleshooting
- Android tips and tricks
- Auto frontlight
- Auto standby
- Auto suspend
- Background runner
- Battery statistics
- Calibre
- Cover browser
- Cover image
- Frontlight gesture controller
- Goodreads (deprecated)
- Highlight exporter
- Japanese Support
- Keep alive
- News downloader
- Perception expander
- Progress sync
- Read timer
- Reading statistics
- Send2Ebook
- SSH
- System statistics
- Terminal emulator
- Time sync
- Vocabulary builder
- Wallabag