11

I have ported my project from Eclipse to Android Studio.But my Application class "AppController.java" alone showing as a text file.I deleted the file and created again but getting following error message.

Unable to parse template "class" Error message: Selected class file name mapped 'AppController.java' to not java file type 'Textfiles'

Note: I have double checked the file types but no luck. File->Settings->File Types the file type for Java source files, Java class files and Text files

Rajiv Manivannan
  • 504
  • 7
  • 15

5 Answers5

21

I have also encountered the same issue and from your suggestion went to File->Settings->File Types and saw the file name I am trying to create say xyz.java is registered in the "recognized file types" list. As soon as I deleted the entry from that list xyz.java is recognized properly.

2

Deleted the Android studio's ".AndroidStudio" In the following path from my system C:\Users\user.

Started the Android Studio and configured freshly. That worked for me!

Rajiv Manivannan
  • 504
  • 7
  • 15
0

I had a similar problem with a source file and a library. I had to mark the root source directory as a source directory.

For example. Your class is: com.example.test.TestFile.java where the root folder is java. In Android Studio, right click on the java folder and select Mark Directory as --> Sources root. This was on Android Studio 2.2 and 2.3 for me.

My Intellisense was then able to pick up all the library references and give intellisense suggestions in my source file(s).

Chef Pharaoh
  • 2,387
  • 3
  • 27
  • 38
0

Special file types are saved in Android studio's folder ".AndroidStudio[version]\filetypes.xml" (located at C:\Users[user] on Windows).

Close Android Studio, delete this file and open it again.

The IDE should reset to its default file types values.

Asaf Pinhassi
  • 15,177
  • 12
  • 106
  • 130
0

Right click on the file -> Override File Type -> select the type it was before.

enter image description here

NMP
  • 490
  • 1
  • 5
  • 17