Android studio新建class文件报错

新建class文件报错

百度后,原因为:没有class模板

解决方案:在file>settings>File and Code Templates>class中添加如下代码:

#if (${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end
 
#if (${IMPORT_BLOCK} != "")${IMPORT_BLOCK}
#end
#parse("File Header.java")
 
#if (${VISIBILITY} == "PUBLIC")public #end #if (${ABSTRACT} == "TRUE")abstract #end #if (${FINAL} == "TRUE")final #end class ${NAME} #if (${SUPERCLASS} != "")extends ${SUPERCLASS} #end #if (${INTERFACES} != "")implements ${INTERFACES} #end {
}

 

posted @ 2019-05-01 16:38  zhoulonghai  阅读(1138)  评论(0编辑  收藏  举报