koreader / android-luajit-launcher

Android NativeActivity based launcher for LuaJIT, implementing the main loop within Lua land via FFI
MIT License
135 stars 85 forks source link

app fails to start when installed in /system #165

Closed pazos closed 4 years ago

pazos commented 5 years ago

Reported by @zaoqi-unsafe in https://github.com/koreader/koreader/issues/4770. It is also applicable to the NativeActivity.apk without KOReader module.

The apps fails with a message: “Unfortunately, has stopped”.

This issue makes impossible to bundle KOReader (or any other app based on android-luajit-launcher) inside custom roms.

To debug this issue we might need logs. A rooted phone is also a prerrequisite.

Frenzie commented 5 years ago

I might be able to do some tests on my old Xperia Ray if the (much more convenient) emulator won't suffice. The touchscreen is broken, but if I connect a mouse using a USB OTG cable I can still control it.

Frenzie commented 5 years ago

But I just realized I wouldn't be able to get logs that way. Although I understand there's some option of debugging over the network.

Edit: looks like you should be able to run the emulator with a -writable-system flag. https://stackoverflow.com/a/44473415/2470572

Frenzie commented 5 years ago

I investigated what I'd need to run it on my real device and used these packages (root is built into the LegacyXperia ROM).

https://f-droid.org/en/packages/ru.meefik.busybox/ https://f-droid.org/en/packages/de.j4velin.systemappmover/

Since the bottom half of my screen still responds to touch I could still start KOReader while it's connected to ADB over USB. (Kind of a necessity. Just playing around a little with the phone for a half hour drained the battery almost completely.)

Anyway, tl;dr this is the output.

--------- beginning of system
--------- beginning of main
08-07 14:59:49.459   269   269 E bt_a2dp_hw: adev_set_parameters: ERROR: set param called even when stream out is null
08-07 14:59:49.464  1080  1269 E native  : do suspend false
08-07 14:59:56.034  2624  2624 E dex2oat : Failed to create oat file: /data/dalvik-cache/arm/system@priv-app@KOReader.apk@classes.dex: Permission denied
--------- beginning of crash
08-07 14:59:56.336  2611  2611 E AndroidRuntime: FATAL EXCEPTION: main
08-07 14:59:56.336  2611  2611 E AndroidRuntime: Process: org.koreader.launcher, PID: 2611
08-07 14:59:56.336  2611  2611 E AndroidRuntime: Theme: themes:{}
08-07 14:59:56.336  2611  2611 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/priv-app/KOReader.apk"],nativeLibraryDirectories=[/system/lib/KOReader, /system/priv-app/KOReader.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libluajit.so"
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at java.lang.Runtime.loadLibrary(Runtime.java:367)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at java.lang.System.loadLibrary(System.java:1076)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at org.koreader.launcher.MainActivity.<clinit>(MainActivity.java:29)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at java.lang.Class.newInstance(Native Method)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2351)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5461)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-07 14:59:56.336  2611  2611 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Summarized:

08-07 14:59:56.336 2611 2611 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/priv-app/KOReader.apk"],nativeLibraryDirectories=[/system/lib/KOReader, /system/priv-app/KOReader.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libluajit.so"

Which makes some sense. We're not quite using the standard Android directories. But just from this it's not clear if this is an inherent problem with KOReader or merely some assumption of that SystemAppMover app breaking down.

pazos commented 5 years ago

Cool, you can try to copy libluajit.so and liblzma.so to /vendor/lib. (/vendor/lib64 for 64 bit devices)

Also please check that apk is owned by root:root and has 644 permissions.

Frenzie commented 5 years ago

Hm, apparently it's owned by system instead of root.

Screenshot_2019-08-07_17-47-53

But even though I'm in adb as root it says:

chown: 'KOReader.apk' to 'root:root': Read-only file system

So…

mount -o rw,remount /system
chown root:root KOReader.apk
mount -o ro,remount /system

Didn't change anything. It probably doesn't make a difference.

And of course afterward I find out adb can do all that slightly easier…

adb root
adb remount
adb shell

The libs themselves seem to have been copied to:

root@urushi:/data/app/org.koreader.launcher-1/lib/arm # ls
libluajit.so  liblzma.so

Anyway, having copied those into /vendor/lib we get the next logical error.

08-07 17:58:39.839  3206  3206 D AndroidRuntime: Shutting down VM
08-07 17:58:39.843  3206  3206 E AndroidRuntime: FATAL EXCEPTION: main
08-07 17:58:39.843  3206  3206 E AndroidRuntime: Process: org.koreader.launcher, PID: 3206
08-07 17:58:39.843  3206  3206 E AndroidRuntime: Theme: themes:{}
08-07 17:58:39.843  3206  3206 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit

Problem is, I'm not even sure where any of the files went. Maybe there's a better way than the app I used.

pazos commented 5 years ago
08-07 17:58:39.839  3206  3206 D AndroidRuntime: Shutting down VM
08-07 17:58:39.843  3206  3206 E AndroidRuntime: FATAL EXCEPTION: main
08-07 17:58:39.843  3206  3206 E AndroidRuntime: Process: org.koreader.launcher, PID: 3206
08-07 17:58:39.843  3206  3206 E AndroidRuntime: Theme: themes:{}
08-07 17:58:39.843  3206  3206 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit

Cool again!

The previous message was triggered by the android.app.NativeActivity class. This time is triggered by this, which is redundant code (but error-prone, it seems).

MainActivity is a subclass of android.app.NativeActivity. MainActivity overrides onCreate but calls the superclass first. So the shared library is loaded first by android.app.NativeActivity, using Manifest metadata properties.

    static {
        System.loadLibrary("your_lib");
    }

is often used in java apps that require calls to native code and implement native methods. In our case everything is already handled by our superclass.

Actually I removed the code in #161 and everything works as expected.

pazos commented 5 years ago

LegacyXperia ROM

For your phone the following scheme should work:

app: /system/priv-app/KOReader/org.koreader.launcher.apk libs: /system/priv-app/KOReader/libs/$(ABI)/{libluajit.so, liblzma.so}

/vendor/lib(64) is just the generic path that always works for libraries. The same happens with /system/app for packages.

Maybe there's a better way than the app I used.

If you are able to use adb remount you can push the application with adb push directly and make sure it is owned by root. After installing a new system app you'll need to reboot your phone to trigger the runtime events needed for the application to work.

Frenzie commented 5 years ago

Well, this was slightly annoying. You have to re-enable ADB over network every time after rebooting… :-)

Anyway, app installation was seemingly successful after putting the files the way you suggested (same startup behavior as with the app from F-Droid, processing/installing & shows up in menu):

root@urushi:/system/priv-app/KOReader # ls -l
total 31609
drwxrwxrwx    1 root     root          4096 Aug  8 11:02 libs
-rw-r--r--    1 root     root      32363273 Aug  8 11:15 org.koreader.launcher.apk
root@urushi:/system/priv-app/KOReader/libs/armeabi-v7a # ls -l
total 676
-rwxr-xr-x    1 system   system      345632 Aug  8 11:02 libluajit.so
-rwxr-xr-x    1 system   system      345632 Aug  8 11:02 liblzma.so

However, that doesn't resolve the problem:

frans@frenzie-desktop:/tmp/koko$ adb logcat luajit-launcher:V AndroidRuntime:I *:F
--------- beginning of system
--------- beginning of main
--------- beginning of crash
08-08 11:24:41.194  2759  2759 E AndroidRuntime: FATAL EXCEPTION: main
08-08 11:24:41.194  2759  2759 E AndroidRuntime: Process: org.koreader.launcher, PID: 2759
08-08 11:24:41.194  2759  2759 E AndroidRuntime: Theme: themes:{}
08-08 11:24:41.194  2759  2759 E AndroidRuntime: java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/system/priv-app/KOReader/org.koreader.launcher.apk"],nativeLibraryDirectories=[/system/priv-app/KOReader/lib/arm, /system/priv-app/KOReader/org.koreader.launcher.apk!/lib/armeabi-v7a, /vendor/lib, /system/lib]]] couldn't find "libluajit.so"
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at java.lang.Runtime.loadLibrary(Runtime.java:367)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at java.lang.System.loadLibrary(System.java:1076)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at org.koreader.launcher.MainActivity.<clinit>(MainActivity.java:35)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at java.lang.Class.newInstance(Native Method)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2351)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5461)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-08 11:24:41.194  2759  2759 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Copying the libs to /vendor/lib also shows the same problem as before:

frans@frenzie-desktop:/tmp/koko$ adb logcat luajit-launcher:V AndroidRuntime:I *:F
--------- beginning of system
--------- beginning of main
--------- beginning of crash
08-08 11:26:21.335  2832  2832 E AndroidRuntime: FATAL EXCEPTION: main
08-08 11:26:21.335  2832  2832 E AndroidRuntime: Process: org.koreader.launcher, PID: 2832
08-08 11:26:21.335  2832  2832 E AndroidRuntime: Theme: themes:{}
08-08 11:26:21.335  2832  2832 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5461)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-08 11:26:21.335  2832  2832 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.NativeActivity.onCreate(NativeActivity.java:170)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at org.koreader.launcher.MainActivity.onCreate(MainActivity.java:54)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6251)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
08-08 11:26:21.335  2832  2832 E AndroidRuntime:    ... 9 more
pazos commented 5 years ago

You need to delete

    static {
        System.loadLibrary("luajit");
    }

in MainActivity.java in order to get rid of that error.

The fact that NativeActivity does not throw a UnsatisfiedLinkError means that the library is already loaded (from both /system/priv-app/app/ and /vendor/lib)

Frenzie commented 5 years ago

But it does show an UnsatisfiedLinkError when the libraries are in /system/priv-app/KOReader/libs/armeabi-v7a. ;-) It's only when I put them in /vendor/lib that it doesn't.

Anyway, that luajit error persists, also without those lines.

$ adb logcat luajit-launcher:V AndroidRuntime:I *:F
--------- beginning of main
--------- beginning of system
08-08 14:31:28.764  1326  1326 I AndroidRuntime: VM exiting with result code 0, cleanup skipped.
--------- beginning of crash
08-08 14:31:52.604  2153  2153 E AndroidRuntime: FATAL EXCEPTION: main
08-08 14:31:52.604  2153  2153 E AndroidRuntime: Process: org.koreader.launcher, PID: 2153
08-08 14:31:52.604  2153  2153 E AndroidRuntime: Theme: themes:{}
08-08 14:31:52.604  2153  2153 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5461)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-08 14:31:52.604  2153  2153 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.NativeActivity.onCreate(NativeActivity.java:170)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at org.koreader.launcher.MainActivity.onCreate(MainActivity.java:52)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6251)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
08-08 14:31:52.604  2153  2153 E AndroidRuntime:    ... 9 more

(Note how the line number for at org.koreader.launcher.MainActivity.onCreate(MainActivity.java:52 proves it moved up 2 lines compared to with the other lines in place.)

pazos commented 5 years ago

adb logcat luajit-launcher:V AndroidRuntime:I *:F

For logs use adb logcat KOReader:V AndroidRuntime:I ActivityManager:I *:F instead.

Anyway, that luajit error persists, also without those lines.

I think i will use MainApp.java to log some stuff on debug builds. It is the entry point for an android application, so it runs before any activity. Lets see if we find something fishy there.

Frenzie commented 5 years ago

Alright, here it is with ActivityManager included (indeed, it does add a few tidbits):

08-08 14:33:11.254  1082  1234 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.cyanogenmod.trebuchet/com.android.launcher3.Launcher (has extras)} from uid 1000 on display 0
08-08 14:33:11.333  1082  1234 I ActivityManager: Killing 2415:com.android.exchange/u0a41 (adj 15): empty #9
08-08 14:33:27.406  1082  1392 I ActivityManager: Killing 2470:com.android.cellbroadcastreceiver/u0a22 (adj 15): empty #9
08-08 14:33:29.204  1082  1903 I ActivityManager: Killing 2433:com.android.messaging/u0a25 (adj 15): empty #9
08-08 14:34:30.677  1082  1391 I ActivityManager: START u0 {act=com.android.systemui.recents.SHOW_RECENTS flg=0x10804000 cmp=com.android.systemui/.recents.RecentsActivity} from uid 10015 on display 0
08-08 14:34:31.105  1082  1147 I ActivityManager: Displayed com.android.systemui/.recents.RecentsActivity: +418ms
08-08 14:34:39.609  1082  1391 I ActivityManager: Killing 2111:org.fdroid.fdroid/u0a55 (adj 15): remove task
08-08 14:34:45.358  1082  1992 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 cmp=com.cyanogenmod.trebuchet/com.android.launcher3.Launcher} from uid 10015 on display 0
08-08 14:34:46.735  1082  1860 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.koreader.launcher/.MainActivity bnds=[6,543][123,709] (has extras)} from uid 10011 on display 0
08-08 14:34:46.870  1082  1099 I ActivityManager: Start proc 2647:org.koreader.launcher/u0a37 for activity org.koreader.launcher/.MainActivity
08-08 14:34:49.212  2647  2647 E AndroidRuntime: FATAL EXCEPTION: main
08-08 14:34:49.212  2647  2647 E AndroidRuntime: Process: org.koreader.launcher, PID: 2647
08-08 14:34:49.212  2647  2647 E AndroidRuntime: Theme: themes:{}
08-08 14:34:49.212  2647  2647 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5461)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-08 14:34:49.212  2647  2647 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.NativeActivity.onCreate(NativeActivity.java:170)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at org.koreader.launcher.MainActivity.onCreate(MainActivity.java:52)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6251)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
08-08 14:34:49.212  2647  2647 E AndroidRuntime:    ... 9 more
08-08 14:34:49.215  1082  1099 W ActivityManager:   Force finishing activity org.koreader.launcher/.MainActivity
08-08 14:34:50.038  1082  1123 W ActivityManager: Activity pause timeout for ActivityRecord{a2cb0e9 u0 org.koreader.launcher/.MainActivity t460 f}
08-08 14:34:51.215  1082  1992 I ActivityManager: Process org.koreader.launcher (pid 2647) has died
08-08 14:36:48.844  1082  1903 I ActivityManager: Killing 2033:com.cyanogenmod.eleven:main/u0a44 (adj 15): empty #9
pazos commented 5 years ago

@Frenzie, thanks for the logs. They are useful.

In #161 I've moved some logging from the activity to the application level, so it hopefully triggers before the I ActivityManager: Start proc 2647:org.koreader.launcher/u0a37 for activity org.koreader.launcher/.MainActivity

Here is a commented log from the very beginning of the app launch:

# log app glue too
adb logcat KOReader:V threaded_app:* *:S

# application starts
I/KOReader(18933): Application started
V/KOReader(18933): Application info {
V/KOReader(18933):   Flags: user, debuggable
V/KOReader(18933):   Paths {
V/KOReader(18933):     Assets: /data/data/org.koreader.launcher/files
V/KOReader(18933):     Library: /data/app-lib/org.koreader.launcher-1
V/KOReader(18933):     Storage: /mnt/sdcard
V/KOReader(18933):   }
V/KOReader(18933): }

# native activity starts
V/threaded_app(18933): Creating: 0xb92a13d0
V/threaded_app(18933): Config: mcc=310 mnc=260 lang=en cnt=US orien=1 touch=3 dens=480 keys=1 nav=1 keysHid=3 navHid=0 sdk=17 size=2 long=1 modetype=1 modenight=1

# load helpers and setup the new activity
D/KOReader(18933): [NativeSurfaceView] Starting
D/KOReader(18933): [ClipboardHelper] Starting
D/KOReader(18933): [NativeThread]: starting

# here the native thread waits for the activity ready state.
V/KOReader(18933): [NativeThread]: waiting for activity
D/KOReader(18933): [NetworkHelper] Starting
D/KOReader(18933): [PowerHelper] Starting
D/KOReader(18933): [ScreenHelper] Starting
V/threaded_app(18933): Start: 0xb92a13d0
V/threaded_app(18933): activityState=10
V/threaded_app(18933): Resume: 0xb92a13d0
V/threaded_app(18933): activityState=11
V/threaded_app(18933): InputQueueCreated: 0xb92a13d0 -- 0xb9272f70
V/threaded_app(18933): APP_CMD_INPUT_CHANGED
V/threaded_app(18933): Attaching input queue to looper
V/KOReader(18933): [NativeSurfaceView] surface created
V/threaded_app(18933): NativeWindowCreated: 0xb92a13d0 -- 0xb92b59c8
V/threaded_app(18933): APP_CMD_INIT_WINDOW
V/KOReader(18933): [NativeThread]: activity window ready.
V/KOReader(18933): [NativeSurfaceView] surface changed {
V/KOReader(18933):   width:  1080
V/KOReader(18933):   height: 1776
V/KOReader(18933): }
V/threaded_app(18933): WindowFocusChanged: 0xb92a13d0 -- 1
V/KOReader(18933): [NativeThread]: activity gained focus.

# Starting lua asset loader and lua execution.
V/KOReader(18933): [NativeThread]: launching LuaJIT assets

I'm interested in seeing logs from the app installed on the system partition. I guess the crash happens just in V/threaded_app(18933): Creating: 0xb92a13d0 where the NativeActivity cannot get a valid mNativeHandle.

Based on a few reports I saw online the library path might change based on where the app was placed.

If you want to test but you don't want to build on top of #161 yourself I could upload a ready-to-be-tested apk.

Frenzie commented 5 years ago

Building is whatever, it's plugging the cable in & out for the mouse vs USB that's annoying. ;-)

I might look into it tonight.

Frenzie commented 5 years ago

Actually I decided to do it right now. Here's the log:

$ adb logcat KOReader:V AndroidRuntime:I ActivityManager:I *:F
--------- beginning of main
--------- beginning of system
08-09 18:42:50.937  1093  1895 I ActivityManager: Process com.android.printspooler (pid 2029) has died
08-09 18:42:52.432  1093  1110 I ActivityManager: Start proc 2267:com.android.dialer/u0a0 for broadcast com.android.dialer/.calllog.CallLogReceiver
08-09 18:42:52.441  1093  1352 I ActivityManager: Process com.android.exchange (pid 2158) has died
08-09 18:42:52.504  1093  2262 I ActivityManager: Start proc 2280:com.android.keychain/1000 for service com.android.keychain/.KeyChainService
08-09 18:42:52.656  1093  1895 I ActivityManager: Process com.android.externalstorage (pid 1331) has died
08-09 18:42:53.082  1093  1112 I ActivityManager: Process com.cyanogenmod.eleven (pid 1987) has died
08-09 18:42:53.386  1093  1872 I ActivityManager: Start proc 2300:com.android.providers.calendar/u0a12 for broadcast com.android.providers.calendar/.CalendarReceiver
08-09 18:42:53.799  1093  2051 I ActivityManager: Start proc 2315:com.android.managedprovisioning/u0a17 for broadcast com.android.managedprovisioning/.BootReminder
08-09 18:42:53.863  1093  1859 I ActivityManager: Process com.android.settings (pid 1766) has died
08-09 18:42:54.036  1093  1872 I ActivityManager: Start proc 2331:com.cyanogenmod.updater/u0a57 for broadcast com.cyanogenmod.updater/.receiver.UpdateCheckReceiver
08-09 18:42:54.498  1093  1859 I ActivityManager: Start proc 2353:com.android.onetimeinitializer/u0a7 for broadcast com.android.onetimeinitializer/.OneTimeInitializerReceiver
08-09 18:42:54.730  1093  2049 I ActivityManager: Process com.android.dialer (pid 2267) has died
08-09 18:42:54.748  1093  1110 I ActivityManager: Process com.android.cellbroadcastreceiver (pid 2223) has died
08-09 18:42:54.979  1093  1110 I ActivityManager: Start proc 2368:org.cyanogenmod.providers.datausage/1000 for broadcast org.cyanogenmod.providers.datausage/.BootReceiver
08-09 18:42:56.377  1093  1110 I ActivityManager: Start proc 2388:com.android.settings/1000 for broadcast com.android.settings/.cmstats.ReportingServiceManager
08-09 18:42:56.631  1093  2050 I ActivityManager: Start proc 2404:com.android.gallery3d/u0a40 for broadcast com.android.gallery3d/org.codeaurora.gallery3d.video.DmReceiver
08-09 18:42:57.018  1093  1912 I ActivityManager: Start proc 2418:com.android.deskclock/u0a46 for broadcast com.android.deskclock/.AlarmInitReceiver
08-09 18:42:57.108  1093  2051 I ActivityManager: Start proc 2432:com.android.exchange/u0a41 for service com.android.exchange/.service.EasService
08-09 18:42:57.415  1093  1391 I ActivityManager: Process com.android.managedprovisioning (pid 2315) has died
08-09 18:42:57.494  1093  1872 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.koreader.launcher/.MainActivity bnds=[6,543][123,709] (has extras)} from uid 10011 on display 0
08-09 18:42:57.809  1093  1896 I ActivityManager: Process com.android.keychain (pid 2280) has died
08-09 18:42:57.859  1093  1872 I ActivityManager: Start proc 2466:org.koreader.launcher/u0a37 for activity org.koreader.launcher/.MainActivity
08-09 18:42:58.225  1093  1369 I ActivityManager: Process com.android.providers.calendar (pid 2300) has died
08-09 18:42:56.803  2466  2466 I KOReader: Application started
08-09 18:42:56.804  2466  2466 V KOReader: Application info {
08-09 18:42:56.804  2466  2466 V KOReader:   Flags: system, debuggable
08-09 18:42:56.804  2466  2466 V KOReader:   Paths {
08-09 18:42:56.804  2466  2466 V KOReader:     Assets: /data/user/0/org.koreader.launcher/files
08-09 18:42:56.804  2466  2466 V KOReader:     Library: /system/priv-app/KOReader/lib/arm
08-09 18:42:56.804  2466  2466 V KOReader:     Storage: /storage/emulated/0
08-09 18:42:56.804  2466  2466 V KOReader:   }
08-09 18:42:56.804  2466  2466 V KOReader: }
--------- beginning of crash
08-09 18:42:56.890  2466  2466 E AndroidRuntime: FATAL EXCEPTION: main
08-09 18:42:56.890  2466  2466 E AndroidRuntime: Process: org.koreader.launcher, PID: 2466
08-09 18:42:56.890  2466  2466 E AndroidRuntime: Theme: themes:{}
08-09 18:42:56.890  2466  2466 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2450)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2510)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.ActivityThread.-wrap11(ActivityThread.java)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1363)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.os.Handler.dispatchMessage(Handler.java:102)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.os.Looper.loop(Looper.java:148)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.ActivityThread.main(ActivityThread.java:5461)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at java.lang.reflect.Method.invoke(Native Method)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
08-09 18:42:56.890  2466  2466 E AndroidRuntime: Caused by: java.lang.IllegalArgumentException: Unable to find native library: luajit
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.NativeActivity.onCreate(NativeActivity.java:170)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at org.koreader.launcher.MainActivity.onCreate(MainActivity.java:64)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.Activity.performCreate(Activity.java:6251)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2403)
08-09 18:42:56.890  2466  2466 E AndroidRuntime:    ... 9 more
08-09 18:42:56.943  1093  1872 W ActivityManager:   Force finishing activity org.koreader.launcher/.MainActivity
08-09 18:42:57.355  1093  1859 I ActivityManager: Start proc 2493:com.android.calendar/u0a49 for broadcast com.android.calendar/.alerts.AlertReceiver
08-09 18:42:57.748  1093  1136 W ActivityManager: Activity pause timeout for ActivityRecord{ce7b006 u0 org.koreader.launcher/.MainActivity t2 f}
08-09 18:42:58.430  1093  2049 I ActivityManager: Killing 2111:org.cyanogenmod.weather.provider/u0a20 (adj 15): empty #9
08-09 18:42:58.792  1093  1912 I ActivityManager: Start proc 2515:com.android.messaging/u0a25 for broadcast com.android.messaging/.receiver.BootAndPackageReplacedReceiver
08-09 18:42:59.106  1093  1112 I ActivityManager: Start proc 2530:com.android.providers.calendar/u0a12 for content provider com.android.providers.calendar/.CalendarProvider2
08-09 18:42:59.924  1093  1352 I ActivityManager: Start proc 2550:com.android.cellbroadcastreceiver/u0a22 for broadcast com.android.cellbroadcastreceiver/.CellBroadcastReceiver
08-09 18:43:00.227  1093  1369 I ActivityManager: Killing 2353:com.android.onetimeinitializer/u0a7 (adj 15): empty #9
^C

Edit: btw, your other logcat command says very little but I imagine that's expected:

$ adb logcat KOReader:V threaded_app:* *:S
--------- beginning of main
--------- beginning of system
08-09 18:42:56.803  2466  2466 I KOReader: Application started
08-09 18:42:56.804  2466  2466 V KOReader: Application info {
08-09 18:42:56.804  2466  2466 V KOReader:   Flags: system, debuggable
08-09 18:42:56.804  2466  2466 V KOReader:   Paths {
08-09 18:42:56.804  2466  2466 V KOReader:     Assets: /data/user/0/org.koreader.launcher/files
08-09 18:42:56.804  2466  2466 V KOReader:     Library: /system/priv-app/KOReader/lib/arm
08-09 18:42:56.804  2466  2466 V KOReader:     Storage: /storage/emulated/0
08-09 18:42:56.804  2466  2466 V KOReader:   }
08-09 18:42:56.804  2466  2466 V KOReader: }
--------- beginning of crash
pazos commented 5 years ago

Thanks for the logs. Exactly what I expected. Library has changed and the flag changed too.

The exception happens on https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/NativeActivity.java#L163 because path is null.

having a file /system/priv-app/KOReader/lib/arm/libluajit.so should work and then it tries to load it (and still can throw a UnsatisfiedLink exception in https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/NativeActivity.java#L177.

BTW, so files need to be root:root 755.

Frenzie commented 5 years ago

having a file /system/priv-app/KOReader/lib/arm/libluajit.so should work

I tried that after seeing the log. It made no difference. (Nor did I expect any, except that compared to the path with armeabi-v7a it actually worked, so to speak.)

BTW, so files need to be root:root 755.

Curious that that app from F-Droid makes 'em all system:system if they need to be root:root. (Permissions were 755.) Moving other apps with /system/app mover does result in working apps though. But I can't really find any with libs (nor do I care to debug that app).

The exception happens on https://github.com/aosp-mirror/platform_frameworks_base/blob/master/core/java/android/app/NativeActivity.java#L163 because path is null.

Why is that any different between system & user apps?

Frenzie commented 5 years ago

having a file /system/priv-app/KOReader/lib/arm/libluajit.so should wor

Actually hold on, is that a typo or do you mean /lib?

Edit: oh ffs I overlooked lib vs libs on the log.

Frenzie commented 5 years ago

Why @#$@#$ did that app create libs. Grmbl.

Makes no difference though

Never mind, the Android shell is awful and something went wrong due to me pressing tab where it would've worked under non-Android shell circumstances and me missing autocomplete crapping out, so I hadn't put the libs in /lib/arm yet.

Frenzie commented 5 years ago

So, almost working logs. I'm not quite sure where this error is coming from since we seem to be finding liblzma.so.

08-09 20:25:21.689  1095  1861 I ActivityManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.koreader.launcher/.MainActivity bnds=[6,543][123,709] (has extras)} from uid 10011 on display 0
08-09 20:25:21.790  1095  1113 I ActivityManager: Start proc 2770:org.koreader.launcher/u0a37 for activity org.koreader.launcher/.MainActivity
08-09 20:25:22.147  2770  2770 I KOReader: Application started
08-09 20:25:22.148  2770  2770 V KOReader: Application info {
08-09 20:25:22.148  2770  2770 V KOReader:   Flags: system, debuggable
08-09 20:25:22.148  2770  2770 V KOReader:   Paths {
08-09 20:25:22.148  2770  2770 V KOReader:     Assets: /data/user/0/org.koreader.launcher/files
08-09 20:25:22.148  2770  2770 V KOReader:     Library: /system/priv-app/KOReader/lib/arm
08-09 20:25:22.148  2770  2770 V KOReader:     Storage: /storage/emulated/0
08-09 20:25:22.148  2770  2770 V KOReader:   }
08-09 20:25:22.148  2770  2770 V KOReader: }
08-09 20:25:22.322  2770  2784 I KOReader: [main thread]: starting KOReader
08-09 20:25:22.322  2770  2784 V KOReader: [main thread]: waiting for app ready...
08-09 20:25:22.337  2770  2770 D KOReader: [NativeSurfaceView] Starting
08-09 20:25:22.344  2770  2770 D KOReader: [ClipboardHelper] Starting
08-09 20:25:22.349  2770  2770 D KOReader: [NetworkHelper] Starting
08-09 20:25:22.350  2770  2770 D KOReader: [PowerHelper] Starting
08-09 20:25:22.354  2770  2770 D KOReader: [ScreenHelper] Starting
08-09 20:25:22.367  2770  2770 I KOReader: Requesting android.permission.WRITE_EXTERNAL_STORAGE permission
08-09 20:25:22.378  1095  1861 I ActivityManager: START u0 {act=android.content.pm.action.REQUEST_PERMISSIONS pkg=com.android.packageinstaller cmp=com.android.packageinstaller/.permission.ui.GrantPermissionsActivity (has extras)} from uid 10037 on display 0
08-09 20:25:22.438  1095  1360 I ActivityManager: Start proc 2787:com.android.packageinstaller/u0a2 for activity com.android.packageinstaller/.permission.ui.GrantPermissionsActivity
08-09 20:25:22.501  2770  2770 V KOReader: [NativeSurfaceView] surface created
08-09 20:25:22.501  2770  2784 V KOReader: [main thread]: App window ready.
08-09 20:25:22.501  2770  2770 V KOReader: [NativeSurfaceView] surface changed {
08-09 20:25:22.501  2770  2770 V KOReader:   width:  480
08-09 20:25:22.501  2770  2770 V KOReader:   height: 854
08-09 20:25:22.501  2770  2770 V KOReader: }
08-09 20:25:23.277  1095  1164 I ActivityManager: Displayed com.android.packageinstaller/.permission.ui.GrantPermissionsActivity: +854ms (total +3m32s849ms)
08-09 20:25:24.904  2770  2770 V KOReader: Permission granted for request code: 1
08-09 20:25:24.956  2770  2784 V KOReader: [main thread]: App gained focus.
08-09 20:25:24.957  2770  2784 V KOReader: [main thread]: launching LuaJIT assets...
08-09 20:25:25.045  2770  2784 D KOReader: show progress dialog
08-09 20:25:25.329  2770  2784 I KOReader: Check file in asset module: koreader-v2019.07-58-g57018019_2019-08-08.7z
08-09 20:25:25.333  2770  2784 I KOReader: Found new package revision v2019.07-58-g57018019_2019-08-08
08-09 20:25:35.754  1095  1113 I ActivityManager: Process com.android.messaging (pid 2453) has died
08-09 20:25:36.921  1095  1843 I ActivityManager: Process android.process.acore (pid 1935) has died
08-09 20:25:36.944  1095  2039 I ActivityManager: Process org.fdroid.fdroid (pid 2125) has died
08-09 20:25:40.998  1095  1862 I ActivityManager: Process com.android.deskclock (pid 2431) has died
08-09 20:25:41.059  2770  2784 I KOReader: Installing new koreader package to /data/user/0/org.koreader.launcher/files
08-09 20:25:41.059  2770  2784 D KOReader: ffi.load liblzma.so
08-09 20:25:41.068  2770  2784 V KOReader: dl.lua - dl.dlopen - library lname detected /system/priv-app/KOReader/lib/arm/liblzma.so
08-09 20:25:41.071  2770  2784 V KOReader:          dl.dlopen - opening needed liblog.so for /system/priv-app/KOReader/lib/arm/liblzma.so
08-09 20:25:41.072  2770  2784 V KOReader: dl.lua - dl.dlopen - library lname detected /system/lib/liblog.so
08-09 20:25:41.074  2770  2784 V KOReader: dl.lua - sys_dlopen - loading library /system/lib/liblog.so
08-09 20:25:41.075  2770  2784 V KOReader:          dl.dlopen - opening needed libandroid.so for /system/priv-app/KOReader/lib/arm/liblzma.so
08-09 20:25:41.075  2770  2784 V KOReader: dl.lua - dl.dlopen - library lname detected /system/lib/libandroid.so
08-09 20:25:41.083  2770  2784 V KOReader: dl.lua - sys_dlopen - loading library /system/lib/libandroid.so
08-09 20:25:41.084  2770  2784 V KOReader:          dl.dlopen - opening needed libc.so for /system/priv-app/KOReader/lib/arm/liblzma.so
08-09 20:25:41.084  2770  2784 V KOReader: dl.lua - dl.dlopen - library lname detected /system/lib/libc.so
08-09 20:25:41.091  2770  2784 V KOReader: dl.lua - sys_dlopen - loading library /system/lib/libc.so
08-09 20:25:41.092  2770  2784 V KOReader:          dl.dlopen - opening needed libm.so for /system/priv-app/KOReader/lib/arm/liblzma.so
08-09 20:25:41.092  2770  2784 V KOReader: dl.lua - dl.dlopen - library lname detected /system/lib/libm.so
08-09 20:25:41.102  2770  2784 V KOReader: dl.lua - sys_dlopen - loading library /system/lib/libm.so
08-09 20:25:41.103  2770  2784 V KOReader:          dl.dlopen - opening needed libstdc++.so for /system/priv-app/KOReader/lib/arm/liblzma.so
08-09 20:25:41.103  2770  2784 V KOReader: dl.lua - dl.dlopen - library lname detected /system/lib/libstdc++.so
08-09 20:25:41.105  2770  2784 V KOReader: dl.lua - sys_dlopen - loading library /system/lib/libstdc++.so
08-09 20:25:41.116  2770  2784 E KOReader: [main thread]: failed to run script: [string "install.lua"]:65: undefined symbol: lzma_main
08-09 20:25:41.116  2770  2784 E KOReader: [main thread]: Stopping KOReader due to previous errors
08-09 20:25:41.183  1095  2038 I ActivityManager: Process com.android.calendar (pid 2470) has died
08-09 20:25:41.779  1095  1843 W ActivityManager: Exception thrown during pause
08-09 20:25:41.779  1095  1843 W ActivityManager: android.os.DeadObjectException
08-09 20:25:41.779  1095  1843 W ActivityManager:   at android.os.BinderProxy.transactNative(Native Method)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at android.os.BinderProxy.transact(Binder.java:503)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at android.app.ApplicationThreadProxy.schedulePauseActivity(ApplicationThreadNative.java:727)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at com.android.server.am.ActivityStack.startPausingLocked(ActivityStack.java:879)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at com.android.server.am.ActivityStack.finishActivityLocked(ActivityStack.java:2992)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at com.android.server.am.ActivityStack.requestFinishActivityLocked(ActivityStack.java:2818)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at com.android.server.am.ActivityManagerService.finishActivity(ActivityManagerService.java:4594)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:350)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2680)
08-09 20:25:41.779  1095  1843 W ActivityManager:   at android.os.Binder.execTransact(Binder.java:453)
08-09 20:25:41.798  1095  1360 I ActivityManager: Process org.koreader.launcher (pid 2770) has died
08-09 20:25:41.802  1095  1112 I ActivityManager: Process com.cyanogenmod.updater (pid 2503) has died
pazos commented 5 years ago

Actually I cannot reproduce on the emulator (I'm using nox player for mac because official emulator is a real pain to root).

Everything works fine here. Even more: updates work fine if the new version code is higher than the one installed into the system partion.

Here is the log:

macbook:x86 pazos$ adb logcat KOReader:* *:S
--------- beginning of system
--------- beginning of main
I/KOReader( 3575): Application started
V/KOReader( 3575): Application info {
V/KOReader( 3575):   Flags: system
V/KOReader( 3575):   Paths {
V/KOReader( 3575):     Assets: /data/data/org.koreader.launcher/files
V/KOReader( 3575):     Library: /system/priv-app/KOReader/lib/x86
V/KOReader( 3575):     Storage: /storage/emulated/0
V/KOReader( 3575):   }
V/KOReader( 3575): }
D/KOReader( 3575): [NativeThread]: starting
V/KOReader( 3575): [NativeThread]: waiting for activity
V/KOReader( 3575): [NativeSurfaceView] surface created
V/KOReader( 3575): [NativeThread]: activity window ready.
V/KOReader( 3575): [NativeSurfaceView] surface changed {
V/KOReader( 3575):   width:  720
V/KOReader( 3575):   height: 1280
V/KOReader( 3575): }
V/KOReader( 3575): [NativeThread]: activity gained focus.
V/KOReader( 3575): [NativeThread]: launching LuaJIT assets
I/KOReader( 3575): Check file in asset module: koreader-v2019.04-182-g2a707cac_2019-08-03.7z
I/KOReader( 3575): Found new package revision v2019.04-182-g2a707cac_2019-08-03
I/KOReader( 3575): Installing new koreader package to /data/data/org.koreader.launcher/files
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /system/priv-app/KOReader/lib/x86/liblzma.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /system/priv-app/KOReader/lib/x86/liblzma.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /system/priv-app/KOReader/lib/x86/liblzma.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libstdc++.so for /system/priv-app/KOReader/lib/x86/liblzma.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libstdc++.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libstdc++.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libstdc++.so
V/KOReader( 3575): update installed in 5 seconds
I/KOReader( 3575): Change directory to assets dir: /data/data/org.koreader.launcher/files
I/KOReader( 3575): command chmod 755 ./sdcv returned 0
V/KOReader( 3575):  stdout:
V/KOReader( 3575):  stderr:
I/KOReader( 3575): command chmod 755 ./tar returned 0
V/KOReader( 3575):  stdout:
V/KOReader( 3575):  stderr:
I/KOReader( 3575): command chmod 755 ./zsync returned 0
V/KOReader( 3575):  stdout:
V/KOReader( 3575):  stderr:
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libkoreader-lfs.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library libluajit.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libkoreader-lfs.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libkoreader-lfs.so
I/KOReader( 3575): Android 5.1.1 - Lollipop (API 22) - flavor: rocks
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/./libs/libblitbuffer.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/./libs/libblitbuffer.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
I/KOReader( 3575):  initializing for device shamu
I/KOReader( 3575):  framebuffer resolution: {
I/KOReader( 3575):     ["h"] = 1280,
I/KOReader( 3575):     ["w"] = 720
I/KOReader( 3575): }
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575):          dl.dlopen - opening needed libz.so.1 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libz.so.1
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libz.so.1
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libz.so.1
V/KOReader( 3575):          dl.dlopen - opening needed libjpeg.so.8 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libjpeg.so.8
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libjpeg.so.8
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libjpeg.so.8
V/KOReader( 3575):          dl.dlopen - opening needed libfreetype.so.6 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libharfbuzz.so.0 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libfreetype.so.6 for /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed liblog.so for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/liblog.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/liblog.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /lib/liblog.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libstdc++.so for /lib/liblog.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libstdc++.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libstdc++.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libstdc++.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/liblog.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libwrap-mupdf.so
V/KOReader( 3575):          dl.dlopen - opening needed libmupdf.so for /data/data/org.koreader.launcher/files/libs/libwrap-mupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575):          dl.dlopen - opening needed libz.so.1 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libz.so.1
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libz.so.1
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libz.so.1
V/KOReader( 3575):          dl.dlopen - opening needed libjpeg.so.8 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libjpeg.so.8
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libjpeg.so.8
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libjpeg.so.8
V/KOReader( 3575):          dl.dlopen - opening needed libfreetype.so.6 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libharfbuzz.so.0 for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libfreetype.so.6 for /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libharfbuzz.so.0
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed liblog.so for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/liblog.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/liblog.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /lib/liblog.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libstdc++.so for /lib/liblog.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libstdc++.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libstdc++.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libstdc++.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/liblog.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libmupdf.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libwrap-mupdf.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libfreetype.so.6
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/common/serialize.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library libluajit.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/common/serialize.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/common/serialize.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/rocks/lib/lua/5.1/lpeg.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library libluajit.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/rocks/lib/lua/5.1/lpeg.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/rocks/lib/lua/5.1/lpeg.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/common/socket/score.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library libluajit.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/common/socket/score.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/common/socket/score.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/common/mime/mcore.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library libluajit.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/common/mime/mcore.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/common/mime/mcore.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/common/ssl.so
V/KOReader( 3575):          dl.dlopen - opening needed libssl.so.1.1 for /data/data/org.koreader.launcher/files/common/ssl.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libssl.so.1.1
V/KOReader( 3575):          dl.dlopen - opening needed libcrypto.so.1.1 for /data/data/org.koreader.launcher/files/libs/libssl.so.1.1
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libcrypto.so.1.1
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libcrypto.so.1.1
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libcrypto.so.1.1
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libssl.so.1.1
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libssl.so.1.1
V/KOReader( 3575):          dl.dlopen - opening needed libcrypto.so.1.1 for /data/data/org.koreader.launcher/files/common/ssl.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/libs/libcrypto.so.1.1
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/libs/libcrypto.so.1.1
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/libs/libcrypto.so.1.1
V/KOReader( 3575): dl.lua - sys_dlopen - loading library libluajit.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/common/ssl.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /data/data/org.koreader.launcher/files/common/ssl.so
I/KOReader( 3575):  Loading plugins from directory: plugins
I/KOReader( 3575):  Plugin  plugins/SSH.koplugin/main.lua  has been disabled.
I/KOReader( 3575):  Plugin  plugins/autofrontlight.koplugin/main.lua  has been disabled.
I/KOReader( 3575):  Plugin  plugins/autosuspend.koplugin/main.lua  has been disabled.
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/./libs/libsqlite3.so
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /data/data/org.koreader.launcher/files/./libs/libsqlite3.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/./libs/libsqlite3.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libz.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libz.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /lib/libz.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libstdc++.so for /lib/libz.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libstdc++.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libstdc++.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libstdc++.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /data/data/org.koreader.launcher/files/./libs/libsqlite3.so
V/KOReader( 3575):          dl.dlopen - opening needed libm.so for /data/data/org.koreader.launcher/files/./libs/libsqlite3.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /lib/libm.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libm.so
V/KOReader( 3575):          dl.dlopen - opening needed libc.so for /data/data/org.koreader.launcher/files/./libs/libsqlite3.so
V/KOReader( 3575): dl.lua - dl.dlopen - library lname detected /lib/libc.so
V/KOReader( 3575): dl.lua - sys_dlopen - loading library /lib/libc.so
I/KOReader( 3575):  Plugin  plugins/hello.koplugin/main.lua  has been disabled.
I/KOReader( 3575):  Plugin  plugins/keepalive.koplugin/main.lua  has been disabled.
I/KOReader( 3575):  Plugin  plugins/timesync.koplugin/main.lua  has been disabled.
I/KOReader( 3575):  FM loaded plugin backgroundrunner at plugins/backgroundrunner.koplugin
I/KOReader( 3575):  FM loaded plugin batterystat at plugins/batterystat.koplugin
I/KOReader( 3575):  FM loaded plugin calibrecompanion at plugins/calibrecompanion.koplugin
I/KOReader( 3575):  FM loaded plugin coverbrowser at plugins/coverbrowser.koplugin
I/KOReader( 3575):  FM loaded plugin evernote at plugins/evernote.koplugin
I/KOReader( 3575):  FM loaded plugin goodreads at plugins/goodreads.koplugin
I/KOReader( 3575):  FM loaded plugin newsdownloader at plugins/newsdownloader.koplugin
I/KOReader( 3575):  FM loaded plugin perceptionexpander at plugins/perceptionexpander.koplugin
I/KOReader( 3575):  FM loaded plugin readtimer at plugins/readtimer.koplugin
I/KOReader( 3575):  FM loaded plugin send2ebook at plugins/send2ebook.koplugin
I/KOReader( 3575):  FM loaded plugin statistics at plugins/statistics.koplugin
I/KOReader( 3575):  FM loaded plugin systemstat at plugins/systemstat.koplugin
I/KOReader( 3575):  FM loaded plugin terminal at plugins/terminal.koplugin
I/KOReader( 3575):  FM loaded plugin texteditor at plugins/texteditor.koplugin
I/KOReader( 3575):  FM loaded plugin wallabag at plugins/wallabag.koplugin
pazos commented 5 years ago

@Frenzie: did you cherry-pick relevant changes from #161 or did you build on top of that PR?. I ask because I see in your logs references to [main thread] while on the updated version the name changed to [NativeThread].

Frenzie commented 5 years ago

That's all of 161 (which is only 2 commits, right :-P). If there's anything outdated remaining it's a bug in the build scripts.

Edit: Like so: Screenshot_2019-08-10_15-15-36

pazos commented 5 years ago

In any case:

If you place the app in /system/app libraries go in /system/lib or /vendor/lib if you place the app in /system/priv-app/koreader libraries go in system/priv-app/koreader/lib/{arm,x86}

pazos commented 5 years ago

If there's anything outdated remaining it's a bug in the build scripts.

Oh, I think gradle won't build the native application (again) if the shared libraries are present. So a cd platform/android/luajit-launcher && make clean is required in order to trigger the build of both libraries.

Amin-jkr commented 5 years ago

Hi, I also need to install Koreader with the /system/app/ method and as you already know doesn't work like that.

nobody said where to get them libraries and how to push them with adb.

Frenzie commented 5 years ago

The libraries are in the apk.

Amin-jkr commented 5 years ago

The libraries are in the apk.

How do I get them?

Frenzie commented 5 years ago

An apk is just a zip file with certain standard elements inside, so if Android doesn't unpack it on restart for you, you can just change the extension to .zip and extract it on your PC.

Screenshot_2019-08-13_21-01-37

Amin-jkr commented 5 years ago

An apk is just a zip file with certain standard elements inside, so if Android doesn't unpack it on restart for you, you can just change the extension to .zip and extract it on your PC.

Screenshot_2019-08-13_21-01-37

First of all thank you for your time and consideration.

I pushed the koreader apk to /system/app with chmod 644 then I pushed the two lib files (liblzma.so & libluajit.so) to all the possible directories that was mentioned, including /system/lib and /vendor/lib or /system/lib/armeabi-v7a etc...but at the end after rebooting still got the same "it has stopped working" error...

Another quick questions: 1.should I copy the .so files to /system/lib/armeabi-v7a or just /system/lib Note: the Android version is 4.2 , so I see the path for the apk is /system/app

Frenzie commented 5 years ago

You should use adb logcat, either by itself or more tailored like adb logcat KOReader:* *:S, to see what the error message is.

PS It's best to grab the latest nightly, which includes the logging improvements mentioned above.

http://build.koreader.rocks/download/nightly/

Amin-jkr commented 5 years ago

You should use adb logcat, either by itself or more tailored like adb logcat KOReader: :S, to see what the error message is.

PS It's best to grab the latest nightly, which includes the logging improvements mentioned above.

http://build.koreader.rocks/download/nightly/

Not the latest knightly version but I tried it with 05.2019 and it returned what I attached in a text file: logcatkoreaer.txt

pazos commented 5 years ago

Not the latest knightly version but I tried it with 05.2019 and it returned what I attached in a text file

@Amin-jkr: please follow the given instructions, it is for a good reason.

You need to:

  1. remove old apk from /system/app and old libraries from every place you installed them.
  2. Reboot and confirm you can't see KOReader on your nova launcher.
  3. get the latest nightly
  4. Install the application again on /system/app/
  5. Install both libraries (that you know how to extract from the apk) into /data/app-lib/koreader, so one will be /data/app-lib/koreader/libluajit.so and the other /data/app-lib/koreader/liblzma.so and make sure that they're rwx. You can do that with adb shell chmod 755 /path/to/library where "/path/to/library" the path to each library as you can read above.
  6. Reboot
  7. Launch KOReader for the first time while you are logging with adb logcat KOReader:* AndroidRuntime:* ActivityManager:* dalvikvm:* *:S

If it works please report: a simple it works. Anything else will be fine but won't be needed :smile: If it does not work please report attaching the log you got with the adb logcat command mentioned above.

Please don't do any other experimentation including: installing libraries somewhere else, installing an old version of the program, skip one of the steps above, etc.

Thanks and good luck!

Amin-jkr commented 5 years ago

Not the latest knightly version but I tried it with 05.2019 and it returned what I attached in a text file

@Amin-jkr: please follow the given instructions, it is for a good reason.

You need to:

  1. remove old apk from /system/app and old libraries from every place you installed them.
  2. Reboot and confirm you can't see KOReader on your nova launcher.
  3. get the latest nightly
  4. Install the application again on /system/app/
  5. Install both libraries (that you know how to extract from the apk) into /data/app-lib/koreader, so one will be /data/app-lib/koreader/libluajit.so and the other /data/app-lib/koreader/liblzma.so and make sure that they're rwx. You can do that with adb shell chmod 755 /path/to/library where "/path/to/library" the path to each library as you can read above.
  6. Reboot
  7. Launch KOReader for the first time while you are logging with adb logcat KOReader: AndroidRuntime: ActivityManager: dalvikvm: :S

If it works please report: a simple it works. Anything else will be fine but won't be needed 😄 If it does not work please report attaching the log you got with the adb logcat command mentioned above.

Please don't do any other experimentation including: installing libraries somewhere else, installing an old version of the program, skip one of the steps above, etc.

Thanks and good luck!

I did all you said carefully but when I tried to make sure the libraries were rwx, as you said, by putting adb shell chmod 755 /data/app-lib/liblzma.so it threw back: "no such file or directory" so I skipped that part and rebooted and no success unfortunately :( and when I tried logcat ing with the command you mentioned it returned: invalid filter: KOReader so I did it without any filter (adb logcat) and it returned this:

E/AndroidRuntime( 1083): java.lang.RuntimeException: Unable to start activity ComponentInfo{org.koreader.launcher/org.koreader.launcher.MainActivity}: java.lang.IllegalArgumentException: Unable to find native library: luajit
E/AndroidRuntime( 1083):        at org.koreader.launcher.BaseActivity.onCreate(BaseActivity.java:62)
E/AndroidRuntime( 1083):        at org.koreader.launcher.MainActivity.onCreate(MainActivity.java:39)
I/ActivityManager(  357): Start proc org.koreader.launcher for activity org.koreader.launcher/.MainActivity: pid=1083 uid=10027 gids={50027, 1028, 1015, 3003}
I/WindowManager(  357): enableScreenIfNeededLocked: mDisplayEnabled=true mForceDisplayEnabled=false mShowingBootMessages=false mSystemBooted=true
I/qtaguid (  357): Failed write_ctrl(s 1 10027) res=-1 errno=1
W/NetworkManagementSocketTagger(  357): setKernelCountSet(10027, 1) failed with errno -1
E/DimSurface(  357): hide: no Surface
E/DimSurface(  357): hide: no Surface
E/DimSurface(  357): hide: no Surface
E/DimSurface(  357): hide: no Surface
E/DimSurface(  357): hide: no Surface
E/DimSurface(  357): hide: no Surface
E/DimSurface(  357): hide: no Surface
I/KOReader( 1083): Application started
V/KOReader( 1083): Application info {
V/KOReader( 1083):   Flags: system
V/KOReader( 1083):   Paths {
V/KOReader( 1083):     Assets: /data/data/org.koreader.launcher/files
V/KOReader( 1083):     Library: /data/app-lib/koreader
V/KOReader( 1083):     Storage: /mnt/sdcard
V/KOReader( 1083):   }
V/KOReader( 1083): }
E/DimSurface(  357): hide: no Surface
I/dalvikvm( 1083): Could not find method org.koreader.launcher.BaseActivity.onRequestPermissionsResult, referenced from method org.koreader.launcher.MainActivity.onRequestPermissionsResult
W/dalvikvm( 1083): VFY: unable to resolve virtual method 11567: Lorg/koreader/launcher/BaseActivity;.onRequestPermissionsResult (I[Ljava/lang/String;[I)V
D/dalvikvm( 1083): VFY: replacing opcode 0x6f at 0x0007
I/dalvikvm( 1083): Could not find method android.provider.Settings$System.canWrite, referenced from method org.koreader.launcher.BaseActivity.hasWriteSettingsEnabled
W/dalvikvm( 1083): VFY: unable to resolve static method 1303: Landroid/provider/Settings$System;.canWrite (Landroid/content/Context;)Z
D/dalvikvm( 1083): VFY: replacing opcode 0x71 at 0x0007
E/DimSurface(  357): hide: no Surface
I/dalvikvm( 1083): Could not find method android.view.View.getRootWindowInsets, referenced from method org.koreader.launcher.BaseActivity.onAttachedToWindow
W/ActivityManager(  358): Activity pause timeout for ActivityRecord{4210ce18 u0 org.koreader.launcher/.MainActivity}

logcat.txt

pazos commented 5 years ago

Sorry but I can't help without that device on hand. Please try other applications while we fix this issue (if the issue gets fixed)

Amin-jkr commented 5 years ago

Sorry but I can't help without that device on hand. Please try other applications while we fix this issue (if the issue gets fixed)

Are you kidding me? Mate, you are one of the smartest guys I've seen here and you say you can't fix it?

pazos commented 5 years ago

No, no. I'm serious. Reasons?

Help means a lot of things and I think I could help you suggesting a few things, namely:

  1. I have no idea of the specific issue of your specific device
  2. I won't try to blindly help you suggesting stuff as is both frustrating and time consuming for us two.
  3. There are good alternatives available that use part of the same technology as KOReader. Please have a look at Coolreader and Librera Reader.

If you have specific questions about something related with your issue please let us know as we might help.

pazos commented 5 years ago

So, almost working logs. I'm not quite sure where this error is coming from since we seem to be finding liblzma.so.

@Frenzie: I'm wondering if KOReader starts fine on your phone now that we got rid of liblzma.so. Not hurry about results :smile:

Frenzie commented 5 years ago

Even if the touch part of the screen weren't broken this messing about with /system business would still be a huge pain. :-P

pazos commented 4 years ago

Closing this issue. It is probably fixed since we ditched lzma. But testing is a PITA