Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to parse template "Class"

I am trying to create class in android but i got this error

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

and in Event log I got this error

FileNotFoundException: Entry fileTemplates//code/Google Test Fixture SetUp Method.cc.ft not found in /D:/Android%20Studio/lib/idea.jar

this my app bulid gradle

apply plugin: 'com.android.application'

android
  {

compileSdkVersion 23
buildToolsVersion '25.0.0'

defaultConfig {
    applicationId "com.hh.ss.msed"
    minSdkVersion 14
    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    multiDexEnabled true


}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}


dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'

    compile 'com.android.support:appcompat-v7:23.0.0'
    compile 'com.google.firebase:firebase-core:11.0.1'
    compile 'com.google.firebase:firebase-database:11.0.1'
    compile 'com.google.firebase:firebase-crash:11.0.1'
    compile 'com.google.firebase:firebase-storage:11.0.1'
    compile 'com.android.support:recyclerview-v7:23.0.0'
    compile 'com.android.support:cardview-v7:23.0.0'
    compile 'com.firebaseui:firebase-ui-database:0.6.2'


    compile 'com.firebase:firebase-client-android:2.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.android.support:support-v4:23.0.0'


}


packagingOptions {
    exclude 'META-INF/DEPENDENCIES.txt'
    exclude 'META-INF/LICENSE.txt'
    exclude 'META-INF/NOTICE.txt'
    exclude 'META-INF/NOTICE'
    exclude 'META-INF/LICENSE'
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/notice.txt'
    exclude 'META-INF/license.txt'
    exclude 'META-INF/dependencies.txt'
    exclude 'META-INF/LGPL2.1'
   }
  }
  apply plugin: 'com.google.gms.google-services'

this bulid gradle project

// Top-level build file where you can add configuration options common to all sub-projects/modules.

  buildscript {
  repositories {
    jcenter()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:2.3.3'
    classpath 'com.google.gms:google-services:3.1.0'

    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
    }
 }

 allprojects {
  repositories {
    jcenter()
  }
}

task clean(type: Delete) {
  delete rootProject.buildDir
}

what the wrong?

like image 697
Hanan Avatar asked Aug 04 '17 02:08

Hanan


Video Answer


3 Answers

Go to File->setting->editor->file and code templates, select Class in the files tab and paste this:

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end #parse("File Header.java") public class ${NAME} { }

Screenshot of editor

like image 60
Da Man Avatar answered Oct 13 '22 08:10

Da Man


I have the same problem, and got it solved by adding in the idea.vmoptions or idea64.vmoptions the following line:

-Djdk.util.zip.ensureTrailingSlash=false

as showed in JetBrains Support by user Wojciech Fred

Seems to be a fix applied by oracle to the Java 8 Update 144

I hope it helps :D

Edit: In Android Studio, the file is called studio.vmoptions, and can be found inside the configuration directory, but it is more easy if you go to the "help>Edit custom VM options" menu: Android Studio Configuration

like image 35
Angel Castelo Avatar answered Oct 13 '22 10:10

Angel Castelo


I encountered something like this in android studio. What i did was I opened IntelliJ Idea (Since Android studio is based on it), and copied the default text of respective template and pasted in android studio respective file.

Go to File->setting->editor->file and code templates, select Class in the files tab and write this

#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME};#end #parse("File Header.java") public class ${NAME} { } 
like image 43
Semicolon Avatar answered Oct 13 '22 10:10

Semicolon