java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7

后端 未结 14 2126
南方客
南方客 2020-12-28 11:46

I am getting this exception java.lang.NoClassDefFoundError: Could not initialize class org.codehaus.groovy.vmplugin.v7.Java7 and java.lang.NoClassDefFoundError: Coul

14条回答
  •  时光取名叫无心
    2020-12-28 11:59

    If you using Android Studio 4.0 or up and having Errors like below

        Cause: invalid type code: 17
        Cause: invalid type code: fe
        Cause: invalid type code: 13
    java.lang.NoClassDefFoundError: Could not initialize class
    

    Or

    Its says that something wrong with JDK then Follow below steps to resolve the error.

    Step 1: First delete .gradle and .idea folder from project directory and restart Android Studio. Make sure it's gone from recycle bin.

    Step 2: Go to Project Structure

    Step 3: Select SDK Location from the left panel on Project Structure window.

    Step 4: Go to JDK Location and click on down arrow then select the jre instead of jdk

    C:\Program Files\Android\Android Studio\jre
    

    And it will Solve the errors. Rebuild the project

    Note: jre come with the android studio 4 installation not sure about the older version.

    This solution work for me.

提交回复
热议问题