Knowcode-AI / android-xml-editor

Apache License 2.0
14 stars 4 forks source link

Command 'Android XML Editor Open' resulted in an error #5

Open menavarroc opened 2 years ago

menavarroc commented 2 years ago

When I press to Android XML Editor: Open

The next error is displayed.

android_error

SimpleLogix commented 2 years ago

Im also getting this same error...

Re-installing does not help. I really want to switch over from Android Studio to VSCode and this is the only function that I use in android.

I can provide any other info about my vscode environment that could help solve this issue.

Nos78 commented 1 year ago

I was getting the same error - the extension caches the assets in a directory local to it's installation location (IE in the error message above, the extension is installed at c:\users\annag.vscode\sextensions\totalcross.android-xml-editor-0.0.1) and the directory \media\drawable does not exist. The \media directory exists, but the subdirectory drawable does not. So the extension cannot copy (cache) the assets into this directory (actually, the line that causes the error is when extension.js createOrShow() tries to empty the cached contents.

In any case, the directory should be created if it does not exist, and it is my guess that this error was not noticed by the developers because they have created this directory whilst coding the extension, and had not tried installing it as if they were a new user.

In any case, I suggest creating this directory and trying to run the extension again.

I have a fix for this (actually, I've expanded the extension by allowing the user to configure the assets location via the workspace settings. I have my android workspace root at the root of the project, rather than the /app/ directory, which means that the location src/main/resources/drawable is wrong and it would be better to have this as user configurable instead of hard coded).

Although whether my fix gets into the code, I don't know... I've noticed that there is a current pull request waiting to be merged, that changes the assets location from src/main/resources/drawable to src/main/res/drawable, as the SDK uses res instead of resources for the name. However this is yet to be merged and it leaves me wondering if any of the developers are even active any more?)

Anyway, hope this helps!

Nos78 commented 1 year ago

I've fixed this. Pull request created, if you know how to apply a patch (or check out github source) you can modify your installation with the new code in the meantime...

https://github.com/Knowcode-AI/android-xml-editor/pull/7

The files you need to change are:

Edit: changing the above files, you might find you need to start and close VSCode twice before seeing any effect. This is due to the way VSCode builds extensions - at least on my laptop, changing settings for already installed extensions, especially modifying the package.json, seems to require two reboots of the app, one reboot to rebuild the menu and typescript, and close it again to make it show?)

Alan3344 commented 3 weeks ago

I copied a copy and tested it, but it didn't work. image image