I have two modules in Android Studio.
Main is an application, and Sub is a library module. Sub is passed from Main with compile project(':Sub') to the gradle script. This works when launched from Android Studio. But when launched from the command line, gradlew says:
Could not create plugin of type 'LibraryPlugin'. Caused by: java.lang.NoClassDefFoundError: org/gradle/api/artifacts/result/ResolvedComponentResult
These are the important parts in the Main build.gradle file:
apply plugin: 'android' buildscript { repositories { mavenCentral() maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { classpath 'com.android.tools.build:gradle:0.9.+' } } repositories { mavenCentral() maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } task wrapper(type: org.gradle.api.tasks.wrapper.Wrapper) { gradleVersion = '1.11' } android { buildToolsVersion '19.0.3' } dependencies { compile 'com.android.support:support-v4:13.0.+' compile project (':Sub') }
The sub gradle file is more or less identical, but has
apply plugin: 'android-library'
instead of 'android'
I tried with gradle 1.9 and 1.10, but the same result.
Does anyone know how to solve this?
android-studio gradle
Roar skullestad
source share