【问题标题】:How do you include romainguy's ViewServer in Android Studio with Gradle?你如何在带有 Gradle 的 Android Studio 中包含 romainguy 的 ViewServer?
【发布时间】:2014-01-21 16:15:25
【问题描述】:

我正在尝试将 RomainGuy 的 ViewServer (https://github.com/romainguy/ViewServer) 与我使用 Gradle 的 Android Studio 项目一起使用,但我无法让它工作。

我的理解是在项目根目录('libraries')中添加一个文件夹,将 ViewServer 目录放入其中(不是完整的ViewServer 目录,而是ViewServer 中的实际库viewserver 文件夹,并在settings.gradle

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

也在我的 build.gradle 文件中

compile project(":libraries:ViewServer")

当我这样做时,我会收到一条消息

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

然后我尝试手动更新 ViewServer 中的 build.gradle 以使用最新的构建工具(发布时为 0.7.+),但我在新的 gradle 版本中遇到了同样的错误。

任何关于如何包含非 jar 第三方库的帮助和一般说明将不胜感激!

【问题讨论】:

标签: android android-studio android-library android-gradle-plugin


【解决方案1】:

您可能需要添加存储库。将gradle.build 更改为:

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

apply plugin: 'android-library'

android {
  compileSdkVersion 18
  buildToolsVersion '18.0.1'
}

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

apply plugin: 'android-library'

android {
  compileSdkVersion 18
  buildToolsVersion '18.0.1'
}

【讨论】:

  • 谢谢!我还需要将 compileSdkVersion 移动到 19 并将 buildToolsVersion 移动到 19.0.1
  • @loeschg 在同一个构建脚本中将 compileSdkVersion 更改为 19 和 buildToolsVersion '19.0.1'。确保清理你的项目 ./gradlew clean
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-09-23
  • 2016-06-07
  • 2015-09-17
  • 1970-01-01
相关资源
最近更新 更多