We might provide an automatic migration option in Android Studio in the future.
 
For now, to migrate your IntelliJ project to an Android Gradle project (which can then be imported into IntelliJ and supported directly in IntelliJ), follow the following steps:
  • Create a basic "build.gradle" file. Unlike the default Gradle file created by Android Studio when you create a new project, the following gradle file will point the source code directories to the existing folders (e.g. res/src/) instead of the default new directory structure used for Gradle projects (src/main/java/src/main/res/, etc). A sample gradle file is given below.
  • Identify which library projects you are using (such as ActionBarSherlock). In Gradle you no longer need to add in these libraries as source code projects; you can simply refer to them as dependencies, and the build system will handle the rest; downloading, merging in resources and manifest entries, etc. For each library, look up the corresponding AAR library dependency name (provided the library in question has been updated as a android library artifact), and add these to the dependency section.
  • Test your build by running gradle assembleDebug in your project. If you have not built with Gradle before, install it from http://www.gradle.org/downloads. Note that when you create new projects with Studio, we create a gradle wrapper script ("gradlew" and "gradlew.bat") in the project root directory, so any users of the project can just run "gradlew assembleDebug" etc in your project and gradle is automatically installed and downloaded. However, your existing IntelliJ projects presumably does not already have the gradle scripts.)
  • Note that IntelliJ projects for Android generally follow the same structure as Eclipse ADT projects, so the instructions in the Eclipse migration guide might be helpful.
build.gradle:
 
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.+'
    }
}
apply plugin: 'android'
 
dependencies {
    compile fileTree(dir: 'libs', include: '*.jar')
}
 
android {
    compileSdkVersion 18
    buildToolsVersion "18.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')
    }
}
For more information on customizing your build once you have the basics set up, see the new build system user guide. For additional information, see the build system overview page.

http://tools.android.com/tech-docs/new-build-system/migrating-from-intellij-projects

Migrating from IntelliJ Projects的更多相关文章

  1. Android官方技术文档翻译——IntelliJ 项目迁移

    本文译自Android官方技术文档<Migrating from IntelliJ Projects>,原文地址:http://tools.android.com/tech-docs/ne ...

  2. Intellij IDEA连接Spark集群

    1. 首先安装Scala插件,File->Settings->Plugins,搜索出Scla插件,点击Install安装: 2. File->New Project->mave ...

  3. Android Studio 和 Gradle

    由于以前没做过什么java项目,在使用Android Studio时遇到了Gradle,真是一头雾水,决定总结一下. 具体的使用方法请参看:http://www.cnblogs.com/youxilu ...

  4. Android官方技术文档翻译——Eclilpse项目迁移

    本文译自Android官方技术文档<Migrating From Eclipse Projects>,原文地址:http://tools.android.com/tech-docs/new ...

  5. Android官方技术文档翻译——新构建系统概述

    本文译自Android官方技术文档<New Build System>,原文地址:http://tools.android.com/tech-docs/new-build-system. ...

  6. [2018.05].NET Core 3 and Support for Windows Desktop Applications

    .NET Core 3 and Support for Windows Desktop Applications Richard 微软官网的内容...net 3.0 升级任务 任重道远 https:/ ...

  7. What’s Brewing for .NET Developers

    Microsoft hosted its premier fall developer event – Connect(); // 2016 in New York on November 16-17 ...

  8. Spark机器学习(12):神经网络算法

    1. 神经网络基础知识 1.1 神经元 神经网络(Neural Net)是由大量的处理单元相互连接形成的网络.神经元是神经网络的最小单元,神经网络由若干个神经元组成.一个神经元的结构如下: 上面的神经 ...

  9. Spark机器学习(11):协同过滤算法

    协同过滤(Collaborative Filtering,CF)算法是一种常用的推荐算法,它的思想就是找出相似的用户或产品,向用户推荐相似的物品,或者把物品推荐给相似的用户.怎样评价用户对商品的偏好? ...

随机推荐

  1. DNS加速之“智能DNS”跟“双线加速”、“CDN加速”的区别

    “智能DNS”跟“双线加速”.“CDN加速”的区别相信,很大部分IDC用户可能还没弄清楚状况,有人觉得智能DNS跟双线加速.CDN加速是类似的技术.其实不然,它们在工作方式上有着本质的区别,但它们又可 ...

  2. 面试相关的技术问题---java基础

    最近在准备秋季校招,将一些常见的技术问题做一个总结!希望对大家有所帮助! 1.面向对象和面向过程的区别是什么? 面向对象是把构成问题的事务分解成各个对象,建立对象的目的不是为了完成一个步骤,而是为了描 ...

  3. 经典SQL语句大全(绝对的经典)

    ”,start为起始位置,length为字符串长度,实际应用中以len(expression)取得其长度3,right(char_expr,int_expr) 返回字符串右边第int_expr个字符, ...

  4. iOS开发——扫描二维码——工具类

    (代码已测试好,空闲时间更新……)

  5. Codevs 1697 ⑨要写信

    1697 ⑨要写信 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 传送门 题目描述 Description 琪露诺(冰之妖精)有操控冷气的能力.能瞬间冻结小东西,比 ...

  6. GitCam一款Gif动画制作软件

    本篇文章由:http://www.sollyu.com/gitcam-a-gif-animation-software/ 说明 GifCam是一款小巧.免费的录制电脑屏幕并制作成GIF动画的软件,具有 ...

  7. Flash Professional CS6 安装zxp插件

    说明 头两天因工作原因需要使用DragonBones,他的工作方式是的Flash Professional CS5.5以上的环境. DragonBones提供的是一个文件名为:xzp的文件,在Wind ...

  8. 使用CPA4破解经典密码算法

    下面是一段经过经典密码算法加密的密文(加密算法未知): yvvnerujjvnywhbdvkpchfgvjtzwqsuporqfzpoekkjgziicdwwkeejdsruef   whwseyej ...

  9. Scala - error: not found: value SortedMap

    先 IMPORT!!!! scala> import scala.collection._import scala.collection._ scala>  SortedMap(" ...

  10. webbench

    Webbench Webbench是一个在linux下使用的非常简单的网站压测工具.它使用fork()模拟多个客户端同时访问我们设定的URL,测试网站在压力下工作的性能,最多可以模拟3万个并发连接去测 ...