I'm currently trying to switch my project to using gradle assemblies. Using the old build system, I am tied to the Android private / internal / hidden API by compiling the source code and linking classes.jar files in front of the Android libraries. I am currently trying to do the same in gradle with no luck.
With my current build.gradle file, I get the following error:
Gradle: A problem occurred evaluating project ':Launcher2'. > Could not find method external() for arguments [file collection] on project ':Launcher2'.
If I remove these lines before "apply the plugin: android"
dependencies { compile files('libraries/classes.jar') }
I get errors regarding missing com.android.internal and com.android.common packages that are in my classes.jar file.
Here is my build.gradle file.
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:0.5.6' } } dependencies { compile files('libraries/classes.jar') } plugin: 'android' android { buildToolsVersion "17.0" compileSdkVersion 10 dependencies { compile fileTree(dir: 'libraries', include: '*.jar') compile project(':ActiveAndroid') } sourceSets { main { manifest.srcFile 'AndroidManifest.xml' java.srcDirs = ['src'] resources.srcDirs = ['src'] aidl.srcDirs = ['src'] renderscript.srcDirs = ['src'] res.srcDirs = ['res'] assets.srcDirs = ['assets'] } }
}
Edit : after reading the gradle documentation a little more, I was able to successfully link the libraries to the project, but the order of the dependencies is incorrect. As an equivalent to what I'm trying to do, is adding both .jar files to the top of the class path so that they are declared before the jar android SDK files.
I was looking for a source for the android gradle plugin, it seems like this might not be possible. The code seems incomplete and will not be built. If anyone has an understanding, I would really appreciate it. Otherwise, it seems like I will need to return to using Ant.
source share