Вопрос

I'm trying to use RomainGuy's ViewServer (https://github.com/romainguy/ViewServer) with my Android Studio project using Gradle, and I can't get it to work.

My understanding is to add a folder in project root ('libraries'), drop the ViewServer directory into it (not the full ViewServer directory but the actual library viewserver folder within ViewServer, and reference it in settings.gradle

include ':VendorSearch'
include ':libraries:ViewServer'

and also in my build.gradle file

compile project(":libraries:ViewServer")

When I do this I get a message that says

Could not find any version that matches com.android.tools.build.gradle:0.5.+

I tried then manually updating build.gradle in ViewServer to use the latest build tools (0.7.+ at the time of posting), but I get the same error with the new gradle version.

Any help and general clarification of how to include non-jar third party libraries would be appreciated!

Это было полезно?

Решение

You probably need to add the repository. Change the gradle.build from:

buildscript {
  dependencies {
    classpath 'com.android.tools.build:gradle:0.5.+'
  }
}

apply plugin: 'android-library'

android {
  compileSdkVersion 18
  buildToolsVersion '18.0.1'
}

to

buildscript {
  repositories {
    mavenCentral()
  }
  dependencies {
    classpath 'com.android.tools.build:gradle:0.7.+'
  }
}

apply plugin: 'android-library'

android {
  compileSdkVersion 18
  buildToolsVersion '18.0.1'
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top