Unable to load class ' org.codehaus.groovy.runtime.typehandling.ShortTypeHandling '

Source: Internet
Author: User

Exception prompt:

Unable to load class ' org.codehaus.groovy.runtime.typehandling.ShortTypeHandling '

Cause of Error:

This error is caused by inconsistencies in your Android studio Gradle plugin and Gradle version, most likely because you dumped an older version of Gradle build project in Android Studio, and it's Build.gradle The old version of the Gradle or Gradle plugin is declared, because the new version of Android Studio does not support the older version of the Gradle plugin (the following warning may appear in Android Studio:Error:the Project is Using an unsupported version of the Android Gradle plug-in (0.12.2). The recommended version is 1.2.3. , so we'd better use the latest or stable version of the Gradle plugin, and when you compile the project after modifying the declared Gradle plugin version at Build.gradle (Project level), you'll get a title exception, you use the new version of the Gradle plugin, but Gradle is still an old version.

Workaround:

Modify the Build.gradle file under Project (not under Module) to change the buildscript in the

{        classpath ‘com.android.tools.build:gradle:0.12+‘    }

Switch

{        classpath ‘com.android.tools.build:gradle:1.2.3‘    }

Then, locate the Gradle directory (not the. Gradle directory) found in the project, and follow the path of Gradle--wrapper ——. Gradle to locate the Gradle-wrapper.properties file, Distributionurl is set to Distributionurl=https\://services.gradle.org/distributions/gradle-2.3-all.zip, Rebuild the entire project now by compiling.

Precautions:
    1. The above solution is just an example, over time, the Gradle and Gradle plugins will constantly update and later encounter title exceptions, then use the stable version of Gradle and Gradle plugins based on the warnings or prompts from Android Studio, if you are not sure Grad How does the Le plugin correspond to the Gradle version, please check the article reference link "2" (Please bring your own ladder); The following table is a simple comparison:
Android Studio Android Gradle Plugin Gradle
1.0.0+ 1.0.0-1.1.3 2.2.1-2.3
1.0.0+ 1.2+ 2.2.1+

2. To re-download the Gradle or Gradle plugin in this way, if the download fails, please bring the ladder to the wall, and then rebuild, not recommended to use the local version Gradle, there may be other problems
3. Since the new version of Gradle does not support the old version of the Gradle command, replace the Gradle command that has been invalidated or replaced before compiling with the new version of Gradle, for example: Gradle Plugin 0.14.0, Runproguard renamed M Inifyenabled. Gradle Chinese documents See reference link "5"

Reference Links:

Http://stackoverflow.com/questions/28923716/getting-resolve-error-while-importing-project-in-android-studio-unable-to-load
Http://tools.android.com/tech-docs/new-build-system/version-compatibility (please bring your own ladder)
http://blog.csdn.net/u011570979/article/details/45824073
Http://www.2cto.com/kf/201505/400371.html
Http://pkaq.github.io/gradledoc/docs/userguide/userguide.html

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Unable to load class ' org.codehaus.groovy.runtime.typehandling.ShortTypeHandling '

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.