简体   繁体   中英

Why am I getting `NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling` when running `./gradlew tasks`?

Looking at the docs , their example generates an ant project. But I want a gradle project...


After some mucking about, I tried,

math4tots@hal:~/git/hub/androidplayground$ android create project --target "android-22" --name Sample --path ./Sample --activity SampleActivity --package com.math4tots.sample --gradle --gradle-version 1.0.1

I guessed 1.0.1 from looking at this . Not super confident about it.

It seemed to create some sort of project in ./Sample , but when I try to run cd Sample && ./gradlew tasks --debug I get

...
00:06:34.007 [ERROR] [org.gradle.BuildExceptionReporter] * Exception is:
00:06:34.009 [ERROR] [org.gradle.BuildExceptionReporter] org.gradle.api.GradleScriptException: A problem occurred evaluating root project 'Sample'.
...
00:06:34.032 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: org.gradle.api.plugins.PluginInstantiationException: Could not create plugin of type 'AppPlugin'.
...
00:06:34.042 [ERROR] [org.gradle.BuildExceptionReporter] Caused by: java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

There's also a lot of other stuff in that message, but those 3-4 lines I showed above seemed the most relevant.

So how do I create a gradle android project using just the android sdk?

I would rather not muck about with Android Studio; eventually I just want a set of aliases I can put in my .bashrc that I can use for Android development without being tied to a particular IDE.

I'm on Ubuntu 14.10 btw if it's relevant.

Thank you!


So I've been doing more searching on the web and found this . Unfortunately, it doesn't seem to solve my problem on two accounts:

  1. How did the answerer know to use 0.10 for gradle version?
  2. Why am I getting NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling ?

As such I felt it appropriate to change the title of this question from

Creating android grade project on the command line

to

Why am I getting NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling when running ./gradlew tasks ?

I hope that is okay.

Upgrade to Gradle 2.3. I just had the same issue with an Android Parse.com project and Gradle 1.10.

Even though Android Studio ships with Gradle (in my case 2.2.1), when importing the project it was picking up my local Gradle install instead. You might want to take this into account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM