Solution to the problem that the old version of Android studio does not display code prompts

Problems encountered

When I was taking Android class in my junior year, the teacher suggested downloading the old version of Android studio 3.5.2 from the Android Chinese community to get started. It is said that the download speed is slightly faster than the latest version during project configuration, but after downloading, I discovered a problem. When installing the old version version of Android studio, if the Android sdk is 33, when designing the interface in xml, there will be no prompt when entering the interface code. In the Design view of the drag-and-drop control, there will be no detailed attributes of the control, only a few Several properties of it greatly affect programming efficiency.

There is no code prompt (existing tags even display unknown attributes):
No code prompt
the design interface has fewer attributes:
The properties of the design interface (right side of the picture) are also very limited

Solution

Method 1: Change the sdk version to 29

First back up the code of the problematic project, delete version 33 SDK, and change it to version 29 (Android 10) SDK. Then, close the project and delete it in the project directory (do not open the problematic project again. Otherwise, the SDK version 33 will still be automatically downloaded, it is best to delete it), and then create a new project. At this time, we can find that the default SDK of the project has become 29. When designing the interface, the code prompt comes out again. Design The properties are also fully displayed.

step:

1. Click "File" - "Settings" - "Appearance & Behavior" - "System Settings" - "Android SDK" in the upper left corner, uncheck "Android API 33" and check "Android 10 (Q)". Click "OK". Click "OK" in the pop-up prompt box.
Change SDK version
2. After waiting for the deletion of sdk33 and the installation of sdk29 to be completed (generally deletion is slow, you have to wait a while), immediately click "File" - "close Project" in the upper left corner to close the current project (don't wait, in case sdk33 is downloaded again) If it is deleted, it will need to be deleted again), just create a new Empty Activity project.
Create a new Empty Activity
Tips for restoring xml code:
Restore xml code prompt
All Attributes on the right can also be displayed:
All Attributes on the right can also be displayed

Method 2: Upgrade Android studio to the latest version

First uninstall the current version of Android studio (you can choose not to delete the configuration file), download the latest version of the installation package from the Android studio official website, open the current project after installation, and wait until the project build is completed, and then you can find that the xml code prompt appears again Now, the design properties are fully displayed. (It should be noted that the new version of gradle has a higher version, and the file structure of build.gradle and setting.gradle is different from that of the lower version of gradle; at the same time, the directory under res has also changed, style.xml has become themes.xml... For the first time, For introductory students, these problems have not been encountered very much, so it is okay, but if you study in depth, you should pay attention)

Guess you like

Origin blog.csdn.net/yang369741/article/details/130985946