AndroidIDEOfficial / AndroidIDE

AndroidIDE is an IDE for Android to develop full featured Android apps.
https://m.androidide.com
GNU General Public License v3.0
2.37k stars 304 forks source link

[Bug]: full code is added in my project if I create ".xml" file in certain dirs #1177

Open Rafael2616 opened 1 year ago

Rafael2616 commented 1 year ago

What happened?

If I create a .xml file in path layout with any name (First I tested with the name layout.xml, but then I saw that any name with this type of file this bug happens) I don't even have these dependencies in my project, for context This project was created with the jetpack compose template, a long time ago, maybe this can be useful or not, I haven't tested it with other projects or templates to find out if this also happens

Video showing the issue:

https://github.com/AndroidIDEOfficial/AndroidIDE/assets/93414086/7fbd66f7-2330-462a-b046-569de6fa024d

What's the expected behavior?

Do not add code in .xml file created in existing project

What version of AndroidIDE you're using?

v2.5.0 (debug builds)

Relevant log output

No response

Duplicate issues

Code of Conduct

Rafael2616 commented 1 year ago

I discover that this code is added in drawable path too, under the same circumstances as the bug above

Screenshot_20230804-204617

Are where I mapped, are only in these 2 places that files are generated, if they have.xml type

itsaky commented 1 year ago

The Jetpack Compose template was added only because there were lots of requests to do so. The IDE currently assumes that the project uses Android views, not Jetpack components. However, we can check module dependencies while creating new files so that it falls back to using platform views if those custom views are not accessible.