-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Xiaomi MiUI: java.io.FileNotFoundException: /data/system/theme_config/theme_compatibility.xml #994
Comments
Upon trying |
I ran into same error message. But mine use full screen gesture, so mine never shows bottom navigation bar. Seems like Xiaomi's MiUI related issue? OS: Windows 10
|
@hafizidev Yeah should be. In any case, we can depend on the shortcuts as an alternative. |
That's expected. If they don't appear on the device, they won't be mirrored. See #7. IIUC, there is an exception, but mirroring still works? To investigate the issue, could you test with 1.11 and 1.10, please (which changed things where the exception occurs)? |
Yes mirroring still works, just there is this exception in the console while starting the app. I ran both version 1.10 and 1.11 and this exception doesn't occur in both versions. |
OK, so this is harmless. It's just a workaround which is applied to make some devices work. When the workaround fails for some reason it just log the stacktrace in the console. |
Looks like I have the same/similar error. However the cast works but i can not control de device.
|
This happens with my Xiaomi phone as well and I'm also using fullscreen gestures. Btw, awesome app. |
C:\Users\Administrator>adb shell |
/storage/emulated/0/data/目录,和/data/目录不是同一个目录吧? /storage/emulated/0/下的目录是可以读写找到的。 adb 不可读写 /data/ 晕 |
Since this is harmless (#994 (comment)), I disabled the error report: 96bd2c9 |
'java.io.FileNotFoundException' logged but harmless, properly handling this issue Genymobile#994
In fact, the error is still printed: #1336 😕 |
The failing statement is here:
The whole thing is in a try-catch-Throwable block, which logs only in debug mode. (and the message So I guess some method in the callstack catches the exception and just calls |
Could you please take scrcpy v1.13 and replace this file:
and confirm that it works without the error message. Thank you. |
This issue isn't allowing me to do anything, apart from seeing my interactions with the phone itself. Love this tool though. Also, I installed through choco. |
Yeah, no more error displays after I replaced with yours |
@hafizidev Thank you for your feedback 👍 |
My pleasure. But I just noticed, I got a warning
|
Yes, that's expected. Check §"Downscaling quality" here: https://github.com/Genymobile/scrcpy/releases/tag/v1.13 ( |
To avoid NullPointerException on some devices, workarounds have been implemented. But these workaround produce (harmless) internal errors causing exceptions to be printed in the console. To avoid this problem, apply the workarounds only if it fails without them. Fixes #994 <#994> Refs #365 <#365> Refs #940 <#940>
棒棒哒~ 我想问这是什么语音开发的 小白 看着啥都想 但是感觉啥都不是 混合语言吗 |
My script uses `AndroidViewClient` but cannot create a `ViewClient` ```python3 from com.dtmilano.android.viewclient import ViewClient def createViewClient(): return ViewClient(*ViewClient.connectToDeviceOrExit(serialno='.*')) vc = createViewClient() ``` The script returns the following stack trace: ```sh File "/home/bob/workspace/script.py", line 4, in createViewClient return ViewClient(*ViewClient.connectToDeviceOrExit(serialno='.*')) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 2690, in __init__ self.dump() File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 3522, in dump self.setViewsFromUiAutomatorDump(received) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 3105, in setViewsFromUiAutomatorDump self.__parseTreeFromUiAutomatorDump(received) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 3323, in __parseTreeFromUiAutomatorDump self.root = parser.Parse(receivedXml[start_xml_index:end_xml_index + 1]) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 2394, in Parse _ = parser.Parse(encoded, True) File "../Modules/pyexpat.c", line 284, in CharacterData File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 2381, in CharacterData element = self.nodeStack[-1] IndexError: list index out of range ``` When I execute the command `adb shell uiautomator dump` on my device a Pocophone X3 with MIUI 12 installed, I get the following result: ```sh adb shell uiautomator dump java.io.FileNotFoundException: /data/system/theme_config/theme_compatibility.xml: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileInputStream.<init>(FileInputStream.java:159) at java.io.FileInputStream.<init>(FileInputStream.java:115) at java.io.FileReader.<init>(FileReader.java:58) at miui.content.res.ThemeCompatibilityLoader.getVersion(ThemeCompatibilityLoader.java:108) at miui.content.res.ThemeCompatibilityLoader.getConfigDocumentTree(ThemeCompatibilityLoader.java:126) at miui.content.res.ThemeCompatibilityLoader.loadConfig(ThemeCompatibilityLoader.java:59) at miui.content.res.ThemeCompatibility.<clinit>(ThemeCompatibility.java:31) at miui.content.res.ThemeCompatibility.isThemeEnabled(ThemeCompatibility.java:111) at android.content.res.MiuiResourcesImpl.<clinit>(MiuiResourcesImpl.java:41) at android.content.res.Resources.<init>(Resources.java:285) at android.content.res.MiuiResources.<init>(MiuiResources.java:49) at android.content.res.Resources.getSystem(Resources.java:206) at android.util.MiuiMultiWindowAdapter.<clinit>(MiuiMultiWindowAdapter.java:79) at android.view.Display.getSize(Display.java:665) at com.android.commands.uiautomator.DumpCommand.run(DumpCommand.java:98) at com.android.commands.uiautomator.Launcher.main(Launcher.java:83) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:380) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:167) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252) at libcore.io.IoBridge.open(IoBridge.java:482) ... 18 more UI hierchary dumped to: /sdcard/window_dump.xml ``` So `uiautomator` throws an error, but still succeeds to dump the XML. The constructor of `ViewClient` calls `parser.Parse(receivedXml[start_xml_index:end_xml_index + 1])` [Ln 3323](https://github.com/dtmilano/AndroidViewClient/blob/master/src/com/dtmilano/android/viewclient.py#L3323), but the XML contained in `received` cannot be parsed because it still contains parts of the exceptions: `start_xml_index = receivedXml.index("<")` will return the first index of '<', which is in the exception (`java.io.FileInputStream.<init>`). We fixed the issue by filtering out the exception from the `received` variable [Ln 3461](https://github.com/dtmilano/AndroidViewClient/blob/master/src/com/dtmilano/android/viewclient.py#L3460): ```python3 received = re.sub(re.compile('java.io.FileNotFoundException.*<\?xml', re.DOTALL),'<?xml', received) ``` But it would probably be cleaner to replace the value of `start_xml_index = receivedXml.index("<")` with `start_xml_index = receivedXml.index("<?xml")`. @dtmilano What do you think? Would you be interested by a pull request? Note that this error is similar to two issues in the `scrcpy` project: - Genymobile/scrcpy#1116 - Genymobile/scrcpy#994 These issues were fixed by just ignoring the exceptions (see Genymobile/scrcpy@96bd2c9).
My script uses `AndroidViewClient` but cannot create a `ViewClient` ```python3 from com.dtmilano.android.viewclient import ViewClient def createViewClient(): return ViewClient(*ViewClient.connectToDeviceOrExit(serialno='.*')) vc = createViewClient() ``` The script returns the following stack trace: ```sh File "/home/bob/workspace/script.py", line 4, in createViewClient return ViewClient(*ViewClient.connectToDeviceOrExit(serialno='.*')) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 2690, in __init__ self.dump() File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 3522, in dump self.setViewsFromUiAutomatorDump(received) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 3105, in setViewsFromUiAutomatorDump self.__parseTreeFromUiAutomatorDump(received) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 3323, in __parseTreeFromUiAutomatorDump self.root = parser.Parse(receivedXml[start_xml_index:end_xml_index + 1]) File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 2394, in Parse _ = parser.Parse(encoded, True) File "../Modules/pyexpat.c", line 284, in CharacterData File "/home/bob/.local/lib/python3.6/site-packages/com/dtmilano/android/viewclient.py", line 2381, in CharacterData element = self.nodeStack[-1] IndexError: list index out of range ``` When I execute the command `adb shell uiautomator dump` on my device a Pocophone X3 with MIUI 12 installed, I get the following result: ```sh adb shell uiautomator dump java.io.FileNotFoundException: /data/system/theme_config/theme_compatibility.xml: open failed: ENOENT (No such file or directory) at libcore.io.IoBridge.open(IoBridge.java:496) at java.io.FileInputStream.<init>(FileInputStream.java:159) at java.io.FileInputStream.<init>(FileInputStream.java:115) at java.io.FileReader.<init>(FileReader.java:58) at miui.content.res.ThemeCompatibilityLoader.getVersion(ThemeCompatibilityLoader.java:108) at miui.content.res.ThemeCompatibilityLoader.getConfigDocumentTree(ThemeCompatibilityLoader.java:126) at miui.content.res.ThemeCompatibilityLoader.loadConfig(ThemeCompatibilityLoader.java:59) at miui.content.res.ThemeCompatibility.<clinit>(ThemeCompatibility.java:31) at miui.content.res.ThemeCompatibility.isThemeEnabled(ThemeCompatibility.java:111) at android.content.res.MiuiResourcesImpl.<clinit>(MiuiResourcesImpl.java:41) at android.content.res.Resources.<init>(Resources.java:285) at android.content.res.MiuiResources.<init>(MiuiResources.java:49) at android.content.res.Resources.getSystem(Resources.java:206) at android.util.MiuiMultiWindowAdapter.<clinit>(MiuiMultiWindowAdapter.java:79) at android.view.Display.getSize(Display.java:665) at com.android.commands.uiautomator.DumpCommand.run(DumpCommand.java:98) at com.android.commands.uiautomator.Launcher.main(Launcher.java:83) at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method) at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:380) Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) at libcore.io.Linux.open(Native Method) at libcore.io.ForwardingOs.open(ForwardingOs.java:167) at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252) at libcore.io.IoBridge.open(IoBridge.java:482) ... 18 more UI hierchary dumped to: /sdcard/window_dump.xml ``` So `uiautomator` throws an error, but still succeeds to dump the XML. The constructor of `ViewClient` calls `parser.Parse(receivedXml[start_xml_index:end_xml_index + 1])` [Ln 3323](https://github.com/dtmilano/AndroidViewClient/blob/master/src/com/dtmilano/android/viewclient.py#L3323), but the XML contained in `received` cannot be parsed because it still contains parts of the exceptions: `start_xml_index = receivedXml.index("<")` will return the first index of '<', which is in the exception (`java.io.FileInputStream.<init>`). We fixed the issue by filtering out the exception from the `received` variable [Ln 3461](https://github.com/dtmilano/AndroidViewClient/blob/master/src/com/dtmilano/android/viewclient.py#L3460): ```python3 received = re.sub(re.compile('java.io.FileNotFoundException.*<\?xml', re.DOTALL),'<?xml', received) ``` But it would probably be cleaner to replace the value of `start_xml_index = receivedXml.index("<")` with `start_xml_index = receivedXml.index("<?xml")`. @dtmilano What do you think? Would you be interested by a pull request? Note that this error is similar to two issues in the `scrcpy` project: - Genymobile/scrcpy#1116 - Genymobile/scrcpy#994 These issues were fixed by just ignoring the exceptions (see Genymobile/scrcpy@96bd2c9).
Hello, I am having this issue.
|
Use a newer version.
Android 12 requires at least scrcpy v1.18. Just use the latest (1.25 currently). |
yup, it worked. thanks |
DONOTMERGE: it causes #994 on Xiaomi devices This allows to make Context.getPackageManager() work. Fixes #4015 <#4015> Refs <#4015 (comment)> Co-authored-by: Simon Chan <[email protected]>
* Ref: Genymobile/scrcpy#994 Change-Id: I700cee9418881880941fcf75fd813a1e2037173e
OS: Ubuntu 16.04
Android: Version 5.0.2
Mode of running: Run scrcpy without installation
On running the program without installation, the bottom keys are missing from the display (Please zoom in the image):
Please check the log that appears after executing
./run x
The text was updated successfully, but these errors were encountered: