你如何在带有 Gradle 的 Android Studio 中包含 romainguy 的 ViewServer? [英] How do you include romainguy's ViewServer in Android Studio with Gradle?

查看:26
本文介绍了你如何在带有 Gradle 的 Android Studio 中包含 romainguy 的 ViewServer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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.

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

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'

也在我的 build.gradle 文件中

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.+

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

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.

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

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

推荐答案

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

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'
}

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

apply plugin: 'android-library'

android {
  compileSdkVersion 18
  buildToolsVersion '18.0.1'
}

这篇关于你如何在带有 Gradle 的 Android Studio 中包含 romainguy 的 ViewServer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆