I'm using Square's Wire library for my Android app, using Android Studio with Gradle.
I originally added the wire-runtime-1.2.0.jar
into a libs
folder in my module, and added the dependency to Gradle like this in my build.gradle
file:
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
}
That worked fine.
I'm new to Gradle and Android Studio, but based on the way I'm depending on the Google Support and Play Services libraries, I thought I might be able to remove the wire-runtime-1.2.0.jar
library from my repository and just declare a dependency like this (the line is from the Maven repository):
dependencies {
compile 'com.squareup.wire:wire:1.0.0'
}
But if I do that then I hit this error:
Gradle: package com.squareup.wire does not exist
Is there a way to set up this dependency without importing the JAR file directly? Or does that only work for libraries that you can install through the SDK Manager?
+
notation, or something. Also, thewire-runtime
artifact, not thewire
artifact, would appear to be the equivalent of the JAR you were using. And, do you havemavenCentral()
inrepositories
inbuildscript
? – ZebadamavenCentral()
in mybuildscript
repositories
section. ...but you are right about the artifact - it should bewire-runtime
instead ofwire
. Please add that as the answer and I will accept it! – Nourish