By: Jason
Snell
 | Posted in: MobilePerformance
Tech Tips
Top
Post
, Jun. 7th, 2013

One of the more exciting announcements from Google
IO
 this year was the Android Team’s decision to release Android
Studio
. Android Studio isJetBrains’
IntelliJ IDEA
 with a brand new, extremely rich, Android-focused plugin. (It’s similar to Eclipse with the ADT
package
.) If you’re feeling adventurous, give it a spin by migrating one of your Eclipse apps.

Getting Started

First, you’ll need to update your SDK installation to the latest version. (Versions 22.0.0 and up will migrate your app to Android Studio.) After a few SDK Manager updates and restarts, you should see something like this:

Now you’re ready to export your application from Eclipse. Google choseGradle as
the new Android build system, so we’ll generate the necessary build files first. From the Eclipse menu, choose ‘File’ and then click ‘Export’. Under the Android folder, you’ll find ‘Generate Gradle build files’:

Choose the project you want to migrate and click ‘Finish’.  Next, exit Eclipse and fire up Android Studio. You’ll want to import an existing project. You can do it from the File menu or the wizard if you don’t have a project opened. Navigate to
the directory containing your app and double click the build.gradle file:

Now you’re almost there! Check ‘Use auto-import’ and select the Gradle wrapper. Or you can choose a Gradle distribution location if you have Gradle 1.6 installed. (This will skip the step of adding a few files to your project directory.) When you
click ‘Finish’, Android Studio will perform a few housekeeping tasks and open your shiny new Gradle project. Hurray!

Bonus Round

Now that you’re working happily in Android Studio, isn’t it time to add a little New Relic action to the mix? Don’t have a New Relic account? (Sign
up
 for one today and get a free 30-day trial!)

First, merge the following into your build.gradle file:

buildscript
{
  repositories
{
    mavenCentral()
  }
  dependencies
{
    classpath
'com.newrelic.agent.android:agent-gradle-plugin:+'
  }
}
 
repositories
{
  mavenCentral()
}
 
apply
plugin:
'android'
apply
plugin:
'newrelic'
 
dependencies
{
  compile
'com.newrelic.agent.android:android-agent:+'
}

Then add an import to your default Activity class:

import

com.newrelic.agent.android.NewRelic;

And in the onCreate() method, add this call to initialize New Relic:

NewRelic.withApplicationToken("<your
mobile app token>"
).start(this.getApplication());

That’s it! We’d love to hear about your migration stories. Let us know your experiences in the comments below.

from:http://blog.newrelic.com/2013/06/07/migrating-your-android-app-from-eclipse-to-android-studio/

最新文章

  1. 【工业串口和网络软件通讯平台(SuperIO)教程】八.SuperIO通讯机制与设备驱动对接的说明
  2. Android新权限机制 AppOps
  3. 带缓存的输入输出-bufferedinputstream类与bufferedoutputstream类
  4. PDM文件编辑
  5. linux下source命令的基本功能
  6. latex之设置字体大小
  7. OpenCV(C++接口)学习笔记1-图像读取、显示、保存
  8. 2.Add Two Numbers-两个单链表相加
  9. Linux入门(7) 脚本
  10. Django视图
  11. C# 异步上传图片案例
  12. spoj1811
  13. Go sql语句引号问题
  14. HTTP中的Get与Post
  15. java AES加密、解密(兼容windows和linux)
  16. Selenium &amp; Webdriver 远程测试和多线程并发测试
  17. .NET加密技术概述
  18. DNS域名解析协议
  19. JavaBean的概念
  20. debian系Linux中文系统目录改为英文目录的解决方法

热门文章

  1. window安装nginx
  2. [LightOJ1070]Algebraic Problem
  3. Java操作Redis小案例
  4. 笔记:JFB 部署新环境,要更改的参数清单列表
  5. leetcode-解题记录 557. 反转字符串中的单词 III
  6. iterm2简易登录服务器
  7. 如何为元组中的每个元素命名,提高程序可读性---Python数据结构与算法相关问题与解决技巧
  8. vim如何达到高效
  9. MySQL-mysql_config_editor安全登录工具
  10. Select.snippet