Migrate from ADT (Eclipse) to Android Studio

 


NewImage


Finally, we decided to convert our project from ADT to Android Studio. At first, we kinda hate the Android Studio because of unfamiliarity of gradle functionality. After reading a few tutorial and video, we finally decided the Android Studio is a good choice. So we start by importing old eclipse project to Android Studio.


During, start up just select the import project (Eclipse ADT) to the start the import wizard. The import process does not alter orginal eclipse project but it is a good idea to make the back up of original eclipse project.


NewImage


The import wizard will automatically identify .jar and replace it with gradle dependency. Most of the time, the default setting work, but if you use previous version of your .jar library. You might need to replace the dependency manually.


You will get the following message.


ECLIPSE ANDROID PROJECT IMPORT SUMMARY


======================================


 


Manifest Merging:


-----------------


Your project uses libraries that provide manifests, and your Eclipse


project did not explicitly turn on manifest merging. In Android Gradle


projects, manifests are always merged (meaning that contents from your


libraries' manifests will be merged into the app manifest. If you had


manually copied contents from library manifests into your app manifest


you may need to remove these for the app to build correctly.


 


Ignored Files:


--------------


The following files were *not* copied into the new Gradle project; you


should evaluate whether these are still needed in your project and if


so manually move them:


 


* .DS_Store


* .gitignore


* Thumbs.db


* ic_launcher-web.png


* proguard-project.txt


 


Replaced Libraries with Dependencies:


-------------------------------------


The importer recognized the following library projects as third party


libraries and replaced them with Gradle dependencies instead. This has


the advantage that more explicit version information is known, and the


libraries can be updated automatically. However, it is possible that


the source files in your project were of an older version than the


dependency we picked, which could render the project not compileable.


You can disable the library replacement in the import wizard and try


again:


 


google-play-services_lib => [com.google.android.gms:play-services:+]


 


Moved Files:


------------


Android Gradle projects use a different directory structure than ADT


Eclipse projects. Here's how the projects were restructured:


 


* AndroidManifest.xml => app/src/main/AndroidManifest.xml


* assets/ => app/src/main/assets/


* lint.xml => app/lint.xml


* res/ => app/src/main/res/


* src/ => app/src/main/java/


 


Next Steps:


-----------


You can now build the project. The Gradle project needs network


connectivity to download dependencies.


 


Bugs:


-----


If for some reason your project does not build, and you determine that


it is due to a bug or limitation of the Eclipse to Gradle importer,


please file a bug at http://b.android.com with category


Component-Tools.


 


(This import summary is for your information only, and can be deleted


after import once you are satisfied with the results.)


 


Error:failed to find target android-17 : /Applications/adt-bundle-mac-x86_64-20140321/sdk

<a href="install.android.platform">Install missing platform(s) and sync project</a>


 

NewImage

 

You might need to install missing platform.

 

Extra Android Studio Tips 


⌥↑ (extend selection) in the editor selects the word at the caret and then selects expanding areas of the source code. For example, it may select a method name, then the expression that calls this method, then the whole statement, then the containing block, etc. You can also select the word at the caret and the expanding areas of the source code by double-clicking the target areas in the editor.  


 


You can comment or uncomment lines and blocks of code using ⌘/ and ⌥⌘/.
⌘/ comments or uncomments the current line or selected block with single line comments (//...).
⌥⌘/ encloses the selected block in a block comment (/*...*/).
To uncomment a commented block press ⌥⌘/ anywhere inside it.     


 


To open your browser with documentation for the element at the editor's caret, press ⇧F1 (View | External Documentation).You must have the path to your browser set in the File | Settings | Web Browsers options and paths to documentation files added to your project (File | Project Structure...) to use this feature.     


  


 


ECLIPSE ANDROID PROJECT IMPORT SUMMARY======================================
Manifest Merging:-----------------Your project uses libraries that provide manifests, and your Eclipseproject did not explicitly turn on manifest merging. In Android Gradleprojects, manifests are always merged (meaning that contents from yourlibraries' manifests will be merged into the app manifest. If you hadmanually copied contents from library manifests into your app manifestyou may need to remove these for the app to build correctly.
Ignored Files:--------------The following files were *not* copied into the new Gradle project; youshould evaluate whether these are still needed in your project and ifso manually move them:
* .DS_Store* .gitignore* Thumbs.db* ic_launcher-web.png* proguard-project.txt
Replaced Libraries with Dependencies:-------------------------------------The importer recognized the following library projects as third partylibraries and replaced them with Gradle dependencies instead. This hasthe advantage that more explicit version information is known, and thelibraries can be updated automatically. However, it is possible thatthe source files in your project were of an older version than thedependency we picked, which could render the project not compileable.You can disable the library replacement in the import wizard and tryagain:
google-play-services_lib => [com.google.android.gms:play-services:+]
Moved Files:------------Android Gradle projects use a different directory structure than ADTEclipse projects. Here's how the projects were restructured:
* AndroidManifest.xml => app/src/main/AndroidManifest.xml* assets/ => app/src/main/assets/* lint.xml => app/lint.xml* res/ => app/src/main/res/* src/ => app/src/main/java/
Next Steps:-----------You can now build the project. The Gradle project needs networkconnectivity to download dependencies.
Bugs:-----If for some reason your project does not build, and you determine thatit is due to a bug or limitation of the Eclipse to Gradle importer,please file a bug at http://b.android.com with categoryComponent-Tools.
(This import summary is for your information only, and can be deletedafter import once you are satisfied with the results.)


 

No comments:

Post a Comment