About Android studio cannot create Java Class and interface problem solution.

   Xiaobai, joined a new company, reconfigured the studio's working environment, finished pulling the code, everything was normal at first, and it was no problem to change bugs in the project, and then add java classes and interfaces to add requirements. There is a problem. When creating a new one, it will report an error:

Unable to parse template "Interface" Error message: This template did not produce a Java class or an interface

This is very embarrassing. What is the problem? According to the template error report, open file->setting->file and templates and find that the templates in it are all empty, and the class has no template, so I took a test from someone else. Paste it, and find that you can create a new class, ok, the problem is solved.
But after a few days, I found that there was a problem again. I opened the studio again and found that the templates were empty again. I can't copy it every time I open the IDE.

Similar problem happened to myself, I am using Android studio version 3.1.1

Clicking OK has no response at all, and various methods of changing settings on the Internet have also been tried to no avail. The following method is a perfect solution.


The final solution is as follows:

Open the folder where the studio is located (please close the studio before this),
Find this file studio.exe.vmoptions in the bin folder
Open this file with notepad
Add the following sentence:
-Djdk.util.zip.ensureTrailingSlash=false
Save, ok, restart studio, open file and templates, and find that all templates exist, the problem is solved.

============================== I am a slow programmer ============= =============

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325851823&siteId=291194637