rovo89 / XposedInstaller

3.89k stars 1.51k forks source link

3.1.5 on LOS 15.1, Android O 8.1: java.lang.NullPointerException: Attempt to get length of null array #443

Open Menci opened 6 years ago

Menci commented 6 years ago

I installed XposedInstaller from https://forum.xda-developers.com/showthread.php?t=3034811 on my XZ1C (with LineageOS 15.1 from XDA, OpenGApps, Magisk). I can launch the app before I download the Framework. After the framework is downloaded, it crashed. I can no longer open the app.

And I rebooted to TWRP and installed the zip located in /sdcard/Android/data/de.robv.android.xposed.installer/cache/downloads/framework (cache cleared).

Then I rebooted to LOS. The app still could't be opened. I installed some modules via apk and open a module app to enter the Xposed Installer app's modules section, then I can turn on the modules. After rebooting the modules just worked as I expected. But if I click framework section in the left panel, it crashes.

I ran adb logcat and then clicked the Xposed Install icon from my launcher and found some useful information:

06-17 16:46:42.240  1494  1648 I ActivityManager: Displayed de.robv.android.xposed.installer/.WelcomeActivity: +281ms
06-17 16:46:42.241 28212 28217 I zygote64: Do partial code cache collection, code=45KB, data=51KB
06-17 16:46:42.241 28212 28217 I zygote64: After code cache collection, code=43KB, data=49KB
06-17 16:46:42.241 28212 28217 I zygote64: Increasing code cache capacity to 256KB
06-17 16:46:42.241 28212 28217 I zygote64: Compiler allocated 7MB to compile void android.widget.TextView.<init>(android.content.Context, android.util.AttributeSet, int, int)
06-17 16:46:42.424 28212 28212 I zygote64: Deoptimizing void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) due to JIT same target
06-17 16:46:42.434 28212 28237 E AndroidRuntime: FATAL EXCEPTION: ReloadLocalZipLoader
06-17 16:46:42.434 28212 28237 E AndroidRuntime: Process: de.robv.android.xposed.installer, PID: 28212
06-17 16:46:42.434 28212 28237 E AndroidRuntime: java.lang.NullPointerException: Attempt to get length of null array
06-17 16:46:42.434 28212 28237 E AndroidRuntime:    at de.robv.android.xposed.installer.util.FrameworkZips.refreshLocal(FrameworkZips.java:289)
06-17 16:46:42.434 28212 28237 E AndroidRuntime:    at de.robv.android.xposed.installer.util.FrameworkZips.access$300(FrameworkZips.java:40)
06-17 16:46:42.434 28212 28237 E AndroidRuntime:    at de.robv.android.xposed.installer.util.FrameworkZips$LocalZipLoader.onReload(FrameworkZips.java:475)
06-17 16:46:42.434 28212 28237 E AndroidRuntime:    at de.robv.android.xposed.installer.util.Loader$1.run(Loader.java:39)
06-17 16:46:42.436  1494 16363 W ActivityManager:   Force finishing activity de.robv.android.xposed.installer/.WelcomeActivity
06-17 16:46:42.443  1494  1642 I ActivityManager: Showing crash dialog for package de.robv.android.xposed.installer u0
06-17 16:46:42.458 28212 28212 I zygote64: Deoptimizing void android.support.v7.widget.LinearLayoutCompat.measureHorizontal(int, int) due to JIT inline cache
06-17 16:46:42.460 28212 28217 I zygote64: Do full code cache collection, code=120KB, data=81KB
06-17 16:46:42.460 28212 28217 I zygote64: After code cache collection, code=108KB, data=61KB
06-17 16:46:42.499   938   938 D SurfaceFlinger: duplicate layer name: changing de.robv.android.xposed.installer/de.robv.android.xposed.installer.WelcomeActivity to de.robv.android.xposed.installer/de.robv.android.xposed.installer.WelcomeActivity#1
06-17 16:46:42.516  1494  4052 I OpenGLRenderer: Initialized EGL, version 1.4
06-17 16:46:42.516  1494  4052 D OpenGLRenderer: Swap behavior 2
06-17 16:46:42.756  1494  4211 W zygote64: Long monitor contention with owner Binder:1494_B (2582) at void com.android.server.am.ActivityManagerService.activityIdle(android.os.IBinder, android.content.res.Configuration, boolean)(ActivityManagerService.java:7292) waiters=1 in int com.android.server.am.ActivityManagerService.getLastResumedActivityUserId() for 105ms
06-17 16:46:43.017 28212 28212 E WindowManager: 
06-17 16:46:43.017 28212 28212 E WindowManager: android.view.WindowLeaked: Activity de.robv.android.xposed.installer.WelcomeActivity has leaked window DecorView@1cd5a9b[] that was originally added here
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.view.ViewRootImpl.<init>(ViewRootImpl.java:485)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:346)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:93)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.Dialog.show(Dialog.java:330)
06-17 16:46:43.017 28212 28212 E WindowManager:     at com.afollestad.materialdialogs.MaterialDialog.show(MaterialDialog.java:1438)
06-17 16:46:43.017 28212 28212 E WindowManager:     at com.afollestad.materialdialogs.MaterialDialog$Builder.show(MaterialDialog.java:1429)
06-17 16:46:43.017 28212 28212 E WindowManager:     at de.robv.android.xposed.installer.installation.StatusInstallerFragment.onCreateView(StatusInstallerFragment.java:136)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.Fragment.performCreateView(Fragment.java:2508)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1279)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1557)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1618)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.BackStackRecord.executeOps(BackStackRecord.java:807)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.executeOps(FragmentManager.java:2386)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2181)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2136)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2043)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.FragmentManagerImpl$1.run(FragmentManager.java:719)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.os.Handler.handleCallback(Handler.java:790)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.os.Handler.dispatchMessage(Handler.java:99)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.os.Looper.loop(Looper.java:164)
06-17 16:46:43.017 28212 28212 E WindowManager:     at android.app.ActivityThread.main(ActivityThread.java:6494)
06-17 16:46:43.017 28212 28212 E WindowManager:     at java.lang.reflect.Method.invoke(Native Method)
06-17 16:46:43.017 28212 28212 E WindowManager:     at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:440)
06-17 16:46:43.017 28212 28212 E WindowManager:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
06-17 16:46:43.017 28212 28212 E WindowManager:     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)
06-17 16:46:43.136  2610  2736 W OpenGLRenderer: Incorrectly called buildLayer on View: ShortcutAndWidgetContainer, destroying layer...

Now /sdcard/Android/data/de.robv.android.xposed.installer/cache/downloads/framework is empty. If I touch a .zip file there, the app still can't be opened.

newdive commented 6 years ago

I've also encountered such problem on android-x86-7.1-rc1. after debugging the installer app, i found out that it's a permission problem.

see the source code below

for (File dir : DownloadsUtil.getDownloadDirs(DownloadsUtil.DOWNLOAD_FRAMEWORK)) {
    if (!dir.isDirectory()) {
        continue;
    }
    for (String filename : dir.list()) {
        if (!filename.endsWith(".zip")) {
            continue;
        }
    ...
    }
}

here dir.list() will return null if the system is using BlockGuard to check file accessiblity, and my android 7 emulator actually does that. However, XposedInstaller does not have storage permission by default, and cause the above exception. In order to make it work, you need to go to settings -> apps -> XposedInstaller-> permissions
and grant storage permission for XposedInstaller .