12
Share

One of the more exciting announcements fromGoogle IOthis year was the Android Team’s decision to releaseAndroid Studio. Android Studio isJetBrains’ IntelliJ IDEAwith a brand new, extremely rich, Android-focused plugin. (It’s similar to Eclipse with theADT 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 choseGradleas 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 thebuild.gradlefile:

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 upfor one today and get a free 30-day trial!)

First, merge the following into yourbuild.gradlefile:

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. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. 在鼠标悬停事件中使用Javascript隐藏内容
  2. 【W3s学JSON】JSON入门概念学习笔记 _W3s
  3. npm 安装出现npm WARN file-explorer@0.0
  4. 图片在页面内随意飘动,遇到边界还会反弹
  5. 如何判断字符串是一个字符串化的JSON对象
  6. 可以使用不同文本框编辑的不同弹出窗口?
  7. JavaScript实现简单的四则运算
  8. 如何在JavaScript / jQuery中获取对象的
  9. Android平台上的QWebView HTML5地理定位
  10. 如何使用变量创建数组?