【问题标题】:Failed to import project from GtiHub, No such file or directory从 GtiHub 导入项目失败,没有这样的文件或目录
【发布时间】:2015-09-09 02:21:25
【问题描述】:

我正在从here 导入 Card Scanner 项目,但是当我导入项目时,它给出了错误 2:

没有这样的文件或目录

在 build.gradle 的这一行:

"git describe --match=*[0-9]*.[0-9]*.*[0-9] --tags --dirty --always".execute().text.trim()

如果除了说没有这样的文件或目录这一行之外,我没有得到确切的含义,我也不知道是什么!

【问题讨论】:

  • 问题不够清楚。请多解释一下。
  • 您能否详细说明一下:您检查了项目并运行了“gradle”。您是否按照自述文件(克隆、子模块、属性)中的步骤进行操作?您指示的命令似乎在this gradle file
  • 我只是无法将项目导入项目。它仍然在说“没有这样的文件或目录”

标签: android android-studio stripe-payments


【解决方案1】:

使用 Android Studio (Gradle):查看这篇博文:http://blog.android-develop.com/2014/09/automatic-versioning-and-increment.html

这是博客中的实现:

android {
defaultConfig {
...
    // Fetch the version according to git latest tag and "how far are we from last tag"
    def longVersionName = "git -C ${rootDir} describe --tags --long".execute().text.trim()
    def (fullVersionTag, versionBuild, gitSha) = longVersionName.tokenize('-')
    def(versionMajor, versionMinor, versionPatch) = fullVersionTag.tokenize('.')

    // Set the version name
    versionName "$versionMajor.$versionMinor.$versionPatch($versionBuild)"

    // Turn the version name into a version code
    versionCode versionMajor.toInteger() * 100000 +
            versionMinor.toInteger() * 10000 +
            versionPatch.toInteger() * 1000 +
            versionBuild.toInteger()

    // Friendly print the version output to the Gradle console
    printf("\n--------" + "VERSION DATA--------" + "\n" + "- CODE: " + versionCode + "\n" + 
           "- NAME: " + versionName + "\n----------------------------\n")
...
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-01-13
    • 2021-05-13
    • 1970-01-01
    • 1970-01-01
    • 2021-12-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多