Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing when opening app from main page #951

Closed
3 tasks done
assembleDebug opened this issue Dec 6, 2022 · 8 comments
Closed
3 tasks done

Crashing when opening app from main page #951

assembleDebug opened this issue Dec 6, 2022 · 8 comments
Labels
Bug Something isn't working Priority: 3

Comments

@assembleDebug
Copy link

assembleDebug commented Dec 6, 2022

Please check before submitting an issue

  • I know what my device, OS and App Manager versions are
  • I know how to take logs
  • I know how to reproduce the issue which may not be specific to my device

Describe the bug

I have installed this shady chinies app NP MANAGER (just bcz it connects to internet), provides functionalities which you see in MT Manager. This app seems highly obfuscated. I can not open the NP manager app info in the AM Debug version. It crashes the AM Debug. I am attaching logs below.

To Reproduce

  1. Open app manager
  2. Tap on NP manager in app list.
  3. It crashes.

Expected behavior

Should open details page for NP manager.

Screenshots

No response

Logs

java.lang.RuntimeException: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean io.github.muntashirakon.AppManager.apk.ApkFile.isSplit()' on a null object reference
    at io.github.muntashirakon.AppManager.details.info.AppInfoViewModel.lambda$loadTagCloud$0(AppInfoViewModel.java:216)
    at io.github.muntashirakon.AppManager.details.info.AppInfoViewModel$$ExternalSyntheticLambda0.run(Unknown Source:2)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7893)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
 Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean io.github.muntashirakon.AppManager.apk.ApkFile.isSplit()' on a null object reference
   at io.github.muntashirakon.AppManager.details.AppDetailsViewModel.getSplitCount(AppDetailsViewModel.java:978)
   at io.github.muntashirakon.AppManager.details.info.AppInfoViewModel.loadTagCloud(AppInfoViewModel.java:133)
   at io.github.muntashirakon.AppManager.details.info.AppInfoFragment.loadPackageInfo(AppInfoFragment.java:1551)
   at io.github.muntashirakon.AppManager.details.info.AppInfoFragment.$r8$lambda$oxlKbqiAsxIkEG69gntC-jrgnXk(Unknown Source:0)
   at io.github.muntashirakon.AppManager.details.info.AppInfoFragment$$ExternalSyntheticLambda56.run(Unknown Source:2)
   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
   at java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
   at java.lang.Thread.run(Thread.java:1012)

Device Info:
App version: 3.1.0-alpha02-DEBUG
App version code: 415
Android build version: 1669133913
Android release version: 13
Android SDK version: 33
Android build ID: TD1A.221105.001
Device brand: Redmi
Device manufacturer: Xiaomi
Device name: sweet
Device model: Redmi Note 10 Pro
Device product name: aosp_sweet
Device hardware name: qcom
ABIs: [arm64-v8a, armeabi-v7a, armeabi]
ABIs (32bit): [armeabi-v7a, armeabi]
ABIs (64bit): [arm64-v8a]
System language: en-US
In-App Language: auto
Mode: auto
Inferred Mode: root

Device info

Everything given in logs above.

Additional context

No response

@assembleDebug assembleDebug added the Bug Something isn't working label Dec 6, 2022
@MuntashirAkon
Copy link
Owner

This is the magic of the AndroidManifest.xml of NP Manager (in hexadecimal):

00 00 08 00

Since Android Binary XML uses little endian, it could be written as follows:

00 00 00 08

The first part is the version i.e. 0x0000 and the second part is the header i.e. 0x0008. Version 0x0000 appears to be invalid according to my checks (App Manager expects 0x0003). Other XML files, as it appears, are perfectly fine.

Related issue: LSPosed/LSPatch#135

@assembleDebug
Copy link
Author

So this is something which cannot be fixed on our side, right?

@MuntashirAkon
Copy link
Owner

So this is something which cannot be fixed on our side, right?

I'm not sure yet. Since Android package parser is able to parse this file, there might be a way. Interestingly, the other parser provided by the AOSP is not working as you can see in the error above.

@MuntashirAkon
Copy link
Owner

MuntashirAkon commented Dec 7, 2022

Even Android's own buildtools' aapt has failed to parse the manifest:

N: android=http://schemas.android.com/apk/res/android
  E: manifest (line=2)
    A: android:versionCode(0x0101021b)=(type 0x10)0x1348d13
    A: (0x0101021c)="3.0.62" (Raw: "3.0.62")
    A: (0x01010572)=(type 0x10)0x1c
    A: (0x01010573)="9" (Raw: "9")
    A: package="player.normal.np" (Raw: "player.normal.np")
    A: platformBuildVersionCode=(type 0x10)0x1c
    A: platformBuildVersionName=(type 0x10)0x9
zsh: segmentation fault  /Users/muntashir/Library/Android/sdk/build-tools/33.0.1/aapt d xmltree
(exit code: 139)

@MuntashirAkon
Copy link
Owner

Ah, aap2 can parse it. So, whatever this format is, it is new.

@MuntashirAkon MuntashirAkon added Priority: 3 Status: Accepted Accepted or approved feature/issue and removed Investigation Needed labels Dec 14, 2022
@MuntashirAkon
Copy link
Owner

All existing Java implementations will fail to parse this file. A possible alternative is to create a new implementation from aapt2: https://cs.android.com/android/platform/superproject/+/master:frameworks/base/libs/androidfw/include/androidfw/ResourceTypes.h

@MuntashirAkon MuntashirAkon added this to the v3.1.0-beta01 milestone Jan 13, 2023
@MuntashirAkon MuntashirAkon added Status: WIP Work in progress and removed Status: Accepted Accepted or approved feature/issue labels Jan 13, 2023
@MuntashirAkon
Copy link
Owner

Depends on REAndroid/ARSCLib#9

@MuntashirAkon
Copy link
Owner

Fixed in bbcc802

Note: If APK signing is enabled, the installation will still fail due to an issue with the apksig library, which will be fixed later in the corresponding library.

@MuntashirAkon MuntashirAkon removed the Status: WIP Work in progress label Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Priority: 3
Projects
None yet
Development

No branches or pull requests

2 participants