theapache64 / stackzy

💻 A cross-platform desktop application to identify libraries used inside an android application. Made possible by Compose Desktop ⚡
Apache License 2.0
1.04k stars 56 forks source link

Fix app crashes when emulator/device is selected #60

Closed smellouk closed 3 years ago

smellouk commented 3 years ago

While testing the app I found two bugs which was related to adb source selection. 1- Wrong cast apk source Steps:

App is crashing with exception

 class com.theapache64.stackzy.model.AndroidDeviceWrapper cannot be cast to class com.theapache64.stackzy.data.local.AndroidDevice (com.theapache64.stackzy.model.AndroidDeviceWrapper and com.theapache64.stackzy.data.local.AndroidDevice are in unnamed module of loader 'app')

The issue is we are casting to wrong type The fix is in commit: 7c9a7e115d1ff75f27414395825596b250527472

2- AndroidApp with empty package name Steps:

App is crashing with exception

Char sequence is empty.
    at kotlin.text.StringsKt___StringsKt.first(_Strings.kt:71)
    at com.theapache64.stackzy.model.AndroidAppWrapper.getAlphabet(AndroidAppWrapper.kt:28)

The issue is pm list packages is returning string which ends with \n and when we split the string we create a package with empty string. The fix is in commit: 7c9a7e115d1ff75f27414395825596b250527472

Unfortunate I was unable to add test for the SelectAppViewModel because unit test was failing with weird exception

@Composable functions must be marked with the @Composable annotation
theapache64 commented 3 years ago

HI @smellouk,

Thanks for the PR :smiley: I'll look into it and will keep you posted.

theapache64 commented 3 years ago

I was actually concentrating on the Playstore pathway. Couldn't test ADB recently. I appreciate the time you took to report and fix this issue. Thanks again :)

smellouk commented 3 years ago

@theapache64 it's a great project, worth it to spend my time on it :D

theapache64 commented 3 years ago

Thank you :)

On Wed, Apr 14, 2021 at 8:52 PM S. Mellouk @.***> wrote:

@theapache64 https://github.com/theapache64 it's a great project, worth it to spend my time on it :D

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/theapache64/stackzy/pull/60#issuecomment-819603868, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACJ23R5YIJSEUTHHUYEPNDLTIWXMPANCNFSM424WZN4A .