xujiaao / AARLinkSources

Attach sources for .aar dependencies in AndroidStudio.
140 stars 9 forks source link

AS 0.8.9 fails with NoClassDefFoundError: ShortTypeHandling #1

Closed littledot closed 9 years ago

littledot commented 9 years ago

I'm running into the following error when I apply README's Setup and Usage code:

Error:java.lang.NoClassDefFoundError: org/codehaus/groovy/runtime/typehandling/ShortTypeHandling
> org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

My build environment is as follows:

Android Studio: 0.8.9

gradle-wrapper.properties: distributionUrl=http://services.gradle.org/distributions/gradle-1.12-all.zip

build.gradle:

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

buildscript {
    repositories {
        jcenter()
        maven {
            url 'https://raw.github.com/xujiaao/mvn-repository/master/releases'
        }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.12.2'
        classpath 'com.github.xujiaao:aarLinkSources:1.0.0'

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

allprojects {
    repositories {
        jcenter()
        maven {
            url 'https://oss.sonatype.org/content/groups/public'
        }
        maven {
            url 'https://raw.github.com/xujiaao/mvn-repository/master/releases'
        }
    }
}

Module's build.gradle:

apply plugin: 'com.android.application'
apply plugin: 'aar-link-sources'

android {
    compileSdkVersion 21
    buildToolsVersion "20.0.0"

    defaultConfig {
        applicationId "com.xyz.testbed"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

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

    compile 'com.android.support:support-v4:21.+'
    aarLinkSources 'com.android.support:support-v4:21.+:sources@jar'
}
xujiaao commented 9 years ago

This plugin is wrote for gradle 2.+. You need to update your AndroidStudio, and use gradle 2.2/2.1.