I would like to create a Jar out of an Android library project. It is set up the following way:
ProjectName
    \- lib
    |   \- lib
    |       \- armeabi
    |           \- libNativeFirst.so
    |           \- libNativeSecond.so
    \- src
        \- main
            \- java
                \- com.package.sdk
                    \- PackageSDK.java
I would like for all of this to be packaged in a Jar, but without revealing the source code present in PackageSDK.java.
I set up my build.gradle file like so:
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android-library'
repositories {
    mavenCentral()
}
android {
    compileSdkVersion 18
    buildToolsVersion "18.0.1"
    defaultConfig {
        minSdkVersion 10
        targetSdkVersion 18
    }
    sourceSets {
        main {
            java {
                srcDir 'src/main/java'
            }
            resources {
                srcDir 'src/../lib'
            }
        }
    }
}
task jar(type: Jar) {
    from android.sourceSets.main.allSource
}
When I run gradlew clean jar in the project's directory, a Jar file is created in ProjectName\build\libs called ProjectName.jar. It's structure is as follows:
ProjectName.jar
    \- lib
    |   \- armeabi
    |       \- libNativeFirst.so
    |       \- libNativeSecond.so
    \- com
        \- package
            \- sdk
                \- PackageSDK.java
I would like for the compiled PackageSDK.class to be included instead of the PackageSDK.java file when executing the jar task. What can I change to achieve this?
Edit:
Per Ben Manes's suggestion, I changed the configuration of the sourceSets to the following:
sourceSets {
    main {
        java {
            srcDir 'src/main/java'
        }
        resources {
            srcDir 'src/../lib'
        }
        output {
            classesDir 'build/classes'
            resourcesDir 'build/javaResources'
        }
    }
}
And the jar task to the following:
task jar(type: Jar) {
    from android.sourceSets.main.output
}
Gradle is now giving me this output:
Could not find method output() for arguments [build_25r1m0a3etn5cudtt5odlegprd$_run_closure2_closure9_closure10_closure13@138532dc] on source set main.