Android Studio中导入过程中维护的目录结构 [英] Maintaining directory structure during Android Studio import

查看:127
本文介绍了Android Studio中导入过程中维护的目录结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我克隆了一个公共的GitHub库,我试图将其导入到Android的工作室0.4.4。进口的伟大工程,但它希望所有源复制到一个新的目录,并创建为源的应用程序目录。由于我使用的是公共回购,我想用回购克隆的目录,并保留目录结构圆通这样我就可以得到更新和推送更改,而无需将文件复制各种方法。

I have cloned a public github repository and am trying to import it into Android Studio 0.4.4. The import works great, but it wants to copy all the source to a new directory and creates an 'app' directory for the source. Since I am using a public repo, I want to use the repo cloned directory and keep the directory structure in tact so I can get updates and push changes without having to copy files every which way.

有没有办法告诉Android的工作室要保持给定的目录结构上的进口?

Is there a way to tell Android Studio to keep the given directory structure on an import?

或者,换句话说,有没有办法跳过转换的gradle并导入源作为是什么?

Or, put another way, Is there a way to skip the gradle conversion and import the source as is?

感谢名单提前。

推荐答案

在present我们没有在Eclipse项目导入preserve现有的目录结构的选项。如果你有一个Eclipse的安装副本,你莫不是打开它,然后导出该项目建设摇篮的文件; ,做一个就地出口。你必须修改它导出生成文件,因为它指定了一个很老的版本的插件。特别是,你必须更新 dependencies.buildscript.classpath 语句来指定0.8 +,同时还更新 distributionUrl 物业在 gradle这个/包装/ gradle-wrapper.properties 的文件中指定摇篮1.10。

At present we don't have an option in Eclipse project import to preserve the existing directory structure. If you have a copy of Eclipse installed you could open it there and then export the project to Gradle build files; that does an in-place export. You'd have to modify the build files it exports since it specifies a very old version of the plugin. Specifically, you'll have to update the dependencies.buildscript.classpath statement to specify 0.8.+, and also update the distributionUrl property in the gradle/wrapper/gradle-wrapper.properties file to specify Gradle 1.10.

如果您还没有Eclipse,您可以使用此样板的的build.gradle 的文件,让你开始。它复制到项目的根目录:

If you don't have Eclipse, you can use this boilerplate build.gradle file to get you started. Copy it into the project's root directory:

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

dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            resources.srcDirs = ['src']
            aidl.srcDirs = ['src']
            renderscript.srcDirs = ['src']
            res.srcDirs = ['res']
            assets.srcDirs = ['assets']
        }

        // Move the tests to tests/java, tests/res, etc...
        instrumentTest.setRoot('tests')

        // Move the build types to build-types/<type>
        // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...
        // This moves them out of them default location under src/<type>/... which would
        // conflict with src/ being used by the main source set.
        // Adding new build types or product flavors should be accompanied
        // by a similar customization.
        debug.setRoot('build-types/debug')
        release.setRoot('build-types/release')
    }
}

接下来,把这个 settings.gradle 的文件在你的根目录中。

Next, put this settings.gradle file in your root directory.

include ':'

接下来,复制 gradlew gradlew.bat 的文件,并在 gradle这个从另一个项目的根目录目录您创建到安装该包装在你的项目。

Next, copy the gradlew and gradlew.bat files and the gradle directory from the root directory of another project you've created to install the wrapper in your project.

这是完整的。您现在应该能够将其导入Android Studio中并使用它。

It's complete. You should now be able to import it in Android Studio and use it.

这篇关于Android Studio中导入过程中维护的目录结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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