I tried to remove my jar* libraries and add them as maven-repository-dependencies. It looks very promising, but I am not able to do it. I tested it with a single library (gson) and now my gradle.build looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}
apply plugin: 'android'
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'com.google.code.gson:gson:2.2.4'
}
android {
compileSdkVersion 18
buildToolsVersion "18.1.0"
defaultConfig {
minSdkVersion 10
targetSdkVersion 18
}
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
instrumentTest.setRoot('tests')
debug.setRoot('build-types/debug')
release.setRoot('build-types/release')
}
}
But a simple sudo gradle build
returns the following error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Failed to notify project evaluation listener.
> Could not resolve all dependencies for configuration ':_DebugCompile'.
> Could not find com.google.code.gson:gson:2.2.4.
Required by:
:android:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with
--info or --debug option to get more log output.
BUILD FAILED
Total time: 3.541 secs
I am connected to the internet and I am using ubuntu.
There is no such thing as a Gradle repository. While Maven is the name for both a build tool and a repository type, Gradle ist just a build tool.
Try to add:
repositories {
mavenCentral()
}
on the same level as apply plugin: 'android'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With