Crashing app (my own TKCompanionApp) after updates

Hi all,
after the building setup update (if I’ve properly understood) of F-Droid and concurrent update of the version and libraries of my app (moved to React Native 0.68.3, NPM 8.19.2, NodeJS 16.17.1 and Android NDK r23c)adb, it seems I’m not able to run the downloaded version(s) anymore.
TKCompanionApp 4.0.0 and 4.0.1 crashes on startup when downloaded from F-Droid and using the locally-built APK, while debug mode works fine.

The error I see through ADB is something related to a missing Java class, but I have no idea why it’s missing… :frowning: I mean, except updating the libraries I’ve not changed other things.

10-17 07:52:13.715 25761 25761 W System.err: java.lang.ClassNotFoundException: name.bresciani.marco.tkcompanionapp.ReactNativeFlipper

The “full” ADB error, with its surroundings:

10-17 07:52:13.508 25761 25761 V fb-UnpackingSoSource: starting syncer worker
10-17 07:52:13.510 25761 25761 V fb-UnpackingSoSource: releasing dso store lock for /data/user/0/name.bresciani.marco.tkcompanionapp/lib-main (from syncer thread)
10-17 07:52:13.511 25761 25761 V fb-UnpackingSoSource: not releasing dso store lock for /data/user/0/name.bresciani.marco.tkcompanionapp/lib-main (syncer thread started)
10-17 07:52:13.528 25761 25761 D SoLoader: libjscexecutor.so not found on /data/data/name.bresciani.marco.tkcompanionapp/lib-main
10-17 07:52:13.528 25761 25761 D SoLoader: libjscexecutor.so found on /data/app/~~DH2Uqv-AxzpONkgk-OM_-g==/name.bresciani.marco.tkcompanionapp-SgaAOni7xn23AW7fd9J95A==/lib/arm64
10-17 07:52:13.528 25761 25761 D SoLoader: Not resolving dependencies for libjscexecutor.so
10-17 07:52:13.589 25761 25761 D JavaScriptCore.Version: 250230.2.1
10-17 07:52:13.641 32627 25439 I TrackerControl.VPN: Get uid local=/10.1.10.1:60854 remote=/147.92.191.123:443
10-17 07:52:13.643 32627 25439 I TrackerControl.VPN: Get uid=10338
10-17 07:52:13.696  3894  5834 I AppsFilter: interaction: PackageSetting{98bb6f3 name.bresciani.marco.tkcompanionapp/10601} -> PackageSetting{f88fae com.motorola.motosignature.app/10151} BLOCKED
10-17 07:52:13.705   821   821 I Accelerometer: batch: handle:0, flag:0,samplingPeriodNs:66667000 maxBatchReportLatencyNs:0
10-17 07:52:13.706   821   821 I Accelerometer: enable: handle:0, en:1
10-17 07:52:13.715 25761 25761 W System.err: java.lang.ClassNotFoundException: name.bresciani.marco.tkcompanionapp.ReactNativeFlipper
10-17 07:52:13.715 25761 25761 W System.err:    at java.lang.Class.classForName(Native Method)
10-17 07:52:13.715 25761 25761 W System.err:    at java.lang.Class.forName(Class.java:454)
10-17 07:52:13.715 25761 25761 W System.err:    at java.lang.Class.forName(Class.java:379)
10-17 07:52:13.715 25761 25761 W System.err:    at name.bresciani.marco.tkcompanionapp.MainApplication.initializeFlipper(MainApplication.java:65)
10-17 07:52:13.715 25761 25761 W System.err:    at name.bresciani.marco.tkcompanionapp.MainApplication.onCreate(MainApplication.java:47)
10-17 07:52:13.715 25761 25761 W System.err:    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1192)
10-17 07:52:13.715 25761 25761 W System.err:    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6886)
10-17 07:52:13.715 25761 25761 W System.err:    at android.app.ActivityThread.access$1500(ActivityThread.java:252)
10-17 07:52:13.715 25761 25761 W System.err:    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1999)
10-17 07:52:13.715 25761 25761 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:106)
10-17 07:52:13.715 25761 25761 W System.err:    at android.os.Looper.loop(Looper.java:250)
10-17 07:52:13.715 25761 25761 W System.err:    at android.app.ActivityThread.main(ActivityThread.java:7886)
10-17 07:52:13.715 25761 25761 W System.err:    at java.lang.reflect.Method.invoke(Native Method)
10-17 07:52:13.715 25761 25761 W System.err:    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
10-17 07:52:13.715 25761 25761 W System.err:    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:970)
10-17 07:52:13.716 25761 25761 W System.err: Caused by: java.lang.ClassNotFoundException: Didn't find class "name.bresciani.marco.tkcompanionapp.ReactNativeFlipper" on path: DexPathList[[zip file "/data/app/~~DH2Uqv-AxzpONkgk-OM_-g==/name.bresciani.marco.tkcompanionapp-SgaAOni7xn23AW7fd9J95A==/base.apk"],nativeLibraryDirectories=[/data/app/~~DH2Uqv-AxzpONkgk-OM_-g==/name.bresciani.marco.tkcompanionapp-SgaAOni7xn23AW7fd9J95A==/lib/arm64, /data/app/~~DH2Uqv-AxzpONkgk-OM_-g==/name.bresciani.marco.tkcompanionapp-SgaAOni7xn23AW7fd9J95A==/base.apk!/lib/arm64-v8a, /system/lib64, /system_ext/lib64]]
10-17 07:52:13.716 25761 25761 W System.err:    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
10-17 07:52:13.716 25761 25761 W System.err:    at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
10-17 07:52:13.716 25761 25761 W System.err:    at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
10-17 07:52:13.716 25761 25761 W System.err:    ... 15 more
10-17 07:52:13.718 25790 25790 W getprop : type=1400 audit(0.0:118802): avc: denied { search } for name="mm" dev="sysfs" ino=5470 scontext=u:r:untrusted_app:s0:c89,c258,c512,c768 tcontext=u:object_r:sysfs_mm:s0 tclass=dir permissive=0 app=name.bresciani.marco.tkcompanionapp
10-17 07:52:13.727 25761 25796 D libMEOW : meow reload base cfg path: na
10-17 07:52:13.727 25761 25796 D libMEOW : meow reload overlay cfg path: na
10-17 07:52:13.753 25761 25796 D libMEOW : applied 1 plugins for [name.bresciani.marco.tkcompanionapp]:
10-17 07:52:13.753 25761 25796 D libMEOW :   plugin 1: [libMEOW_gift.so]:
10-17 07:52:13.833 25761 25761 W .tkcompanionap: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed)
10-17 07:52:13.833 25761 25761 W .tkcompanionap: Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed)
10-17 07:52:13.857 25761 25761 D libMEOW : applied 1 plugins for [name.bresciani.marco.tkcompanionapp]:
10-17 07:52:13.857 25761 25761 D libMEOW :   plugin 1: [libMEOW_gift.so]:
10-17 07:52:13.857 25761 25761 I InputTransport: Create ARC handle: 0xb400007778e75fe0
10-17 07:52:13.865 25761 25761 W unknown:ReactNative: Packager connection already open, nooping.
10-17 07:52:13.872   903  1384 I BufferQueueConsumer: [](id:38700001d3e,api:0,p:-1,c:903) connect(): controlledByApp=false
10-17 07:52:13.872   903  1384 I BufferQueue: [unnamed-903-7486](this:0xb4000074fbdadc58,id:7486,api:0,p:-1,c:-1) BufferQueue core=(903:/system/bin/surfaceflinger)
10-17 07:52:13.874  3894  6473 V WindowManager: Changing focus of displayId=0 to Window{ee30c86 u0 name.bresciani.marco.tkcompanionapp/name.bresciani.marco.tkcompanionapp.MainActivity} from null
10-17 07:52:13.881 25761 25794 D libMEOW : applied 1 plugins for [name.bresciani.marco.tkcompanionapp]:
10-17 07:52:13.881 25761 25794 D libMEOW :   plugin 1: [libMEOW_gift.so]:
10-17 07:52:13.890   553   553 I hwservicemanager: getTransport: Cannot find entry android.hardware.configstore@1.0::ISurfaceFlingerConfigs/default in either framework or device manifest.
10-17 07:52:13.893 25761 25794 I libMEOW_gift: ctx:0xb40000772309c928, ARC not Enabled.
10-17 07:52:13.903 25761 25794 E ion     : ioctl c0044901 failed with code -1: Invalid argument
10-17 07:52:13.964   814   814 I hwcomposer: [HWCDisplay] [Display_0 (type:1)] fps:60.405380,dur:1009.84,max:21.78,min:14.24
10-17 07:52:14.017   903  1384 W ServiceManager: Permission failure: android.permission.ACCESS_SURFACE_FLINGER from uid=10601 pid=25761
10-17 07:52:14.017  3894  3915 I LaunchCheckinHandler: MotoDisplayed name.bresciani.marco.tkcompanionapp/.MainActivity,cp,ca,1005
10-17 07:52:14.017   903  1384 D PermissionCache: checking android.permission.ACCESS_SURFACE_FLINGER for uid=10601 => denied (283 us)
10-17 07:52:14.018  3894  3915 I WindowManager: SURFACE show Surface(name=name.bresciani.marco.tkcompanionapp/name.bresciani.marco.tkcompanionapp.MainActivity)/@0xb5fd4e0 on display:0
10-17 07:52:14.021  3894  3925 I ActivityTaskManager: Displayed name.bresciani.marco.tkcompanionapp/.MainActivity: +1s39ms
10-17 07:52:14.024  3894  3915 I InputTransport: Destroy ARC handle: 0xb4000077060c0f60
10-17 07:52:14.036 29734 29734 I InputTransport: Create ARC handle: 0xb40000771b264da0

Could someone help me with some hints?

Meanwhile, I’m going to bisect between 3.1.2 and 4.0.0 version to understand the mess I possibly did with RN update… :man_shrugging:t2:

Thanks,

Marco

1 Like

I’ve tried to rebuild locally the 401 and I see this::

10-24 18:05:26.044   808 12295 V OEMCryptoCENC: OEMCrypto_GetHDCPCapability result = 0x0
10-24 18:05:26.071 13454 13477 W unknown:ReactContext: initializeMessageQueueThreads() is called.
10-24 18:05:26.097 13454 13477 E AndroidRuntime: FATAL EXCEPTION: create_react_context
10-24 18:05:26.097 13454 13477 E AndroidRuntime: Process: name.bresciani.marco.tkcompanionapp, PID: 13454
10-24 18:05:26.097 13454 13477 E AndroidRuntime: java.lang.RuntimeException: Unable to load script. Make sure you're either running Metro (run 'npx react-native start') or that your bundle 'index.android.bundle' is packaged correctly for release.
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.jniLoadScriptFromAssets(Native Method)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.loadScriptFromAssets(CatalystInstanceImpl.java:248)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.bridge.JSBundleLoader$1.loadScript(JSBundleLoader.java:29)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.bridge.CatalystInstanceImpl.runJSBundle(CatalystInstanceImpl.java:277)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1404)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager.access$1200(ReactInstanceManager.java:136)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1108)
10-24 18:05:26.097 13454 13477 E AndroidRuntime:        at java.lang.Thread.run(Thread.java:923)
10-24 18:05:26.099 29324 30981 W ActivityTaskManager:   Force finishing activity name.bresciani.marco.tkcompanionapp/.MainActivity
10-24 18:05:26.100 29324 30981 V WindowManager: Changing focus of displayId=0 to null from Window{1bd5daa u0 name.bresciani.marco.tkcompanionapp/name.bresciani.marco.tkcompanionapp.MainActivity}
10-24 18:05:26.100 29324 13505 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
10-24 18:05:26.116 29324  2685 I libMEOW_gift: ctx:0xb400007a4bbd1f28, ARC not Enabled.

Can’t understand. Why the release APK is asking for Metro? What I did wrong?

Yeh facing the same issue on Android

2022-10-25 14:32:35.436 18549-18549/com.jackz.SampleApp D/SoLoader: Not resolving dependencies for libexpo-gl.so
2022-10-25 14:32:35.443 18549-18977/com.jackz.SampleApp D/Surface: Surface::connect(this=0xbbba9000,api=1)
2022-10-25 14:32:35.443 18549-18977/com.jackz.SampleApp I/BufferQueueProducer: [SurfaceTexture-0-18549-0](this:0xbbe5b000,id:0,api:1,p:18549,c:18549) connect(P): api=1 producer=(18549:com.jackz.SampleApp) producerControlledByApp=true
2022-10-25 14:32:35.448 18549-18977/com.jackz.SampleApp W/Gralloc3: allocator 3.x is not supported
2022-10-25 14:32:35.452 18549-18977/com.jackz.SampleApp E/ion: ioctl c0044901 failed with code -1: Invalid argument
2022-10-25 14:32:35.608 18549-18650/com.jackz.SampleApp I/ReactNativeJS: 60
2022-10-25 14:32:36.321 18549-18978/com.jackz.SampleApp I/System.out: [socket]:check permission begin!

Thanks @jackz. I think I’ve probably poorly migrated from RN 0.68.x to 0.69.x.

Unfortunately, I was so stupid to do that within two adjacent releases, instead of going step by step: I’ve done 0.68.2 to 0.68.3 and then 0.68.3 to 0.69.5 without doing an intermediate release for 0.68.3 only.
I think I have to fix a bunch of things in this part.
I’ve just updated the metadata to stick with the 3.1.2 version of my app, that works, while I’m trying to understand the migration to the 4.x.

I’ve tried gradlew clean build the revision 2f569906534d87ce805145f42a9bbc9dea7b473f and once installed through ADB, it’s not working (see above).
The same revision, ran as debug (a.k.a. npm run android) with actual phone connected, is working fine.

Where’s the error? Can someone help?

Did you do a git bisect to track the exact commit that breaks it?

Yes, twice. And found different results. (note for self: never try a bisect while attending work meetings…).

I’m going to try again in these days: unfortunately my lovely baby app is only an hobby :slightly_frowning_face: so I need to find a bit of time. :crossed_fingers:t2:

Tried twice, again. Seems to be the upgrade to RN 0.69.5, for whatever reason:

608e6331c8aacbcf82e5f05a3ea7e5b1a85f87b1 is the first bad commit
commit 608e6331c8aacbcf82e5f05a3ea7e5b1a85f87b1
Author: Marco Bresciani <>                     
Date:   Wed Sep 21 09:37:15 2022 +0200

    Update React Native to 0.69.5

 .ruby-version                            |    2 +-
 Gemfile                                  |    2 +-
 android/app/src/main/AndroidManifest.xml |    5 +-
 android/build.gradle                     |   84 +-
 package-lock.json                        | 8943 +++++++++++++++---------------
 package.json                             |   10 +-
 6 files changed, 4647 insertions(+), 4399 deletions(-)

I need to check the changes one by one and see. Or maybe update everything to its own latest version for good: I already have a 5.x branch with even React Native Paper update to the currenct 5.x RC. I’m just waiting for the official release.

There’s indeed something wrong with the update to RN 0.69.5.
I’ve followed the upgrade helper but there were, um, different differences.
I’ll probably create a new project, with latest RN 0.70.4 and then put the code there. And overwrite the project files.
Can’t understand the differences.
I’ll take time. :unamused:

@Licaon_Kter I’m trying with this: TKCompanionApp: try to fix the issues with 4.x versions (!12032) · Merge requests · F-Droid / Data · GitLab
The APKs for 400 and 401 both run on my device, now.

I’ve solved by removing the RN 0.69.5 update commit.
Now there are two branches for 4.0.0 and 4.0.1 even if they are not currently available on F-Droid.
Let’s go for 5.0.0. :man_shrugging:t2: