项目迁移-从Eclipse到Android Studio

最近做的比较多的事情就是把公司的eclipse项目转入Android Studio中。很多问题的解决其实凭直觉瞎捣鼓即可,但是总还是能形成一些操作习惯和步骤,记录下来。

1、在AS中新建空项目。具体做法看个人喜好,但我比较偷懒,喜欢一开始就有完整的结构,所以在新建选项中选择自带Empty Activity,因此AndroidManifest.xml也会被一并创建。

2、文件拷贝。尽管Android Studio中已有工具号称协助从Eclipse中Import工程并尝试自动转换为AS项目,但实践证明它并没有足够智能地处理冲突,并且挺容易把原本清晰的文件结构和配置弄的混乱。因此我的做法是,在Android Studio中新建项目B,并从Eclipse项目A文件夹中将文件逐步拷贝过来。具体的,src、res、assets等目录可以手动逐个拷贝,其中res和assets两个目录在AS中应位于src/main中,这点应注意。

3、项目设置。Eclipse项目中的AndroidManifest.xml文件内容可以先全部拷贝,然后将部分内容挪至AS项目的build.gradle文件,主要是compileSdkVersion,buildToolsVersion,minSdkVersion,targetSdkVersion,versionCode,versionName这几个。

4、依赖处理。通常有jar包、aar包、library依赖等。当然,首先应先检查依赖包是否可从线上各种maven库中取得,这种幸福的方式不应错过,直接以compile语句形式添加到app的build.gradle中即可。本地文件例如jar或aar,可以直接放入本地文件夹,例如libs。

jar包的引入方式:

如果是本地aar文件,则需在module层的build.gradle中加入:

然后类似:

如果是library形式,则在module的settings里边新建模块,导入相应工程,并在自己的app的dependengcies里通过添加Library denpendency的方式将其加入。

5、处理文件重复。例如:Duplicate files copied in APK META-INF/LICENSE,在Module:app的build.grade文件中的android节点中增加packagingOptions选项,并用exclude关键字添加相应文件的路径,例如:

6、不要忘了删除此前新建AS项目时的java文件,例如EmptyActivity.java之类,以及其资源和Manifest配置。

关于其他一些细节,刚发现知乎上有位仁兄的这篇专栏总结的不错。

108 thoughts on “项目迁移-从Eclipse到Android Studio

  1. Discover More说道:

    I simply want to tell you that I am beginner to blogging and site-building and actually savored your blog site. Almost certainly I’m planning to bookmark your blog post . You definitely come with excellent posts. With thanks for revealing your web site.

  2. kumahasiaweh说道:

    Hello there, I found your web site via Google even as searching for a similar matter, your site came up, it seems good. I have bookmarked it in my google bookmarks.

  3. *MetrocLick.com说道:

    MetroClick specializes in building completely interactive products like Photo Booth for rental or sale, Touch Screen Kiosks and Digital Signage, and experiences. With our own hardware production facility and in-house software development teams, we are able to achieve the highest level of customization and versatility for Photo Booths, Touch Screen Kiosks and Digital Signage. MetroClick, 121 Varick St, #301, New York, NY 10013, +1 646-843-0888

  4. Faytech North America is a touch screen Manufacturer of both monitors and pcs. They specialize in the design, development, manufacturing and marketing of Capacitive touch screen, Resistive touch screen, Industrial touch screen, IP65 touch screen, touchscreen monitors and integrated touchscreen PCs. Contact them at http://www.faytech.us, 121 Varick Street,3rd Floor,New York, NY 10013,+1 646 205 3214

  5. dentysta gorzów说道:

    Thanks a ton as my own teacher for this subject. My spouse and i enjoyed the content greatly and the best part is preferred how you completed the aspect I widely known as controversial. You are always quite kind to readers including me and aid me in doing my living. Thank you. NAME

  6. Good – I should definitely pronounce, impressed with your site. I had no trouble navigating through all the tabs and related information ended up being truly easy to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or something, site theme . a tones way for your customer to communicate. Excellent task.

  7. Extraordinarily enlightening points that you have said, a big heads up for adding.

  8. dentysta gorzów说道:

    Wonderful beat ! I would like to apprentice while you amend your site, how can i subscribe for a blog website? The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast provided bright clear idea

  9. It’s actually nearly unthinkable to encounter well-qualified individual on this matter, unfortunately you come across as like you are familiar with which you’re writing on! Many Thanks

  10. I’ll right away seize your rss as I can not find your email subscription link or newsletter service. Do you have any? Please permit me realize in order that I may subscribe. Thanks.

  11. You can definitely see your enthusiasm within the paintings you write. The world hopes for more passionate writers such as you who are not afraid to mention how they believe. Always go after your heart. “We may pass violets looking for roses. We may pass contentment looking for victory.” by Bern Williams.

  12. nike shoes说道:

    Starting today, hurry & get a suitable piece linked with paper!
    Some associated the classic physicians secondhand
    hemp compared to medicine too; W.B. These items can often be harvested up to now Autumn.

  13. dentysta gorzów说道:

    Great goods from you, man. I’ve understand your stuff previous to and you’re just extremely wonderful. I really like what you’ve acquired here, really like what you’re saying and the way in which you say it. You make it enjoyable and you still care for to keep it sensible. I can not wait to read much more from you. This is actually a great web site.

  14. Thank you, I have just been searching for info about this topic for a while and yours is the greatest I have found out till now. However, what concerning the conclusion? Are you certain about the source?

  15. have a peek here说道:

    I really need to advise you that I am new to online blogging and very much valued your information. Very possible I am most likely to remember your blog post . You really have wonderful article content. Love it for sharing with us the best blog post

  16. fuck说道:

    My family all the time say that I am wasting my time here at web,
    however I know I am getting know-how all the time by reading
    such fastidious articles or reviews.

  17. It is most suitable time to make some goals for the extended term. I have digested this blog entry and if I have the ability to, I desire to suggest you couple of intriguing recommendations.

  18. dentysta gorzów说道:

    Fantastic post but I was wanting to know if you could write a litte more on this subject? I’d be very grateful if you could elaborate a little bit more. Appreciate it!

  19. go now说道:

    Remarkably entertaining advice you’ll have stated, many thanks for adding.

  20. Thank you for sharing superb informations. Your website is very cool. I am impressed by the details that you’ve on this website. It reveals how nicely you understand this subject. Bookmarked this website page, will come back for extra articles. You, my pal, ROCK! I found simply the info I already searched all over the place and simply could not come across. What an ideal site.

  21. Flowers ireland说道:

    Hello there! This post could not be written any better! Going through this article reminds me of my previous roommate! He always kept preaching about this. I’ll send this article to him. Fairly certain he’ll have a great read. Many thanks for sharing!

  22. Florists Cork说道:

    I just couldn’t depart your site prior to suggesting that I really enjoyed the standard information a person provide in your guests? Is going to be back often in order to check out new posts

  23. My husband and i were really thankful when Jordan managed to finish up his inquiry from the ideas he obtained from your own blog. It’s not at all simplistic just to choose to be giving away ideas which some others could have been making money from. We figure out we have the writer to give thanks to because of that. The explanations you’ve made, the easy web site menu, the friendships you give support to instill – it’s most awesome, and it’s really helping our son in addition to our family reckon that this subject matter is excellent, which is incredibly essential. Thank you for the whole thing!

  24. Dublin Flowers说道:

    Hello, I log on to your blog like every week. Your humoristic style is witty, keep it up!

  25. cunt说道:

    I don’t even know the way I finished up right here, but I
    thought this submit was once great. I do not realize who you are
    however definitely you’re going to a famous blogger in the event you are
    not already. Cheers!

  26. fantastic points altogether, you just gained a new reader. What could you suggest in regards to your post that you just made a few days in the past? Any sure?

  27. I just couldn’t depart your web site prior to suggesting that I really loved the usual information an individual supply on your visitors? Is going to be back steadily to investigate cross-check new posts

  28. Very nice article and straight to the point. I don’t know if this is really the best place to ask but do you folks have any ideea where to get some professional writers? Thanks in advance 🙂

  29. Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you could do with a few pics to drive the message home a little bit, but other than that, this is great blog. A fantastic read. I will definitely be back.

  30. sex说道:

    Since the admin of this website is working, no hesitation very shortly
    it will be well-known, due to its quality contents.

  31. I precisely needed to thank you so much again. I’m not certain what I could possibly have undertaken in the absence of the entire points provided by you relating to such a area. This has been the fearsome case in my view, but seeing this specialized way you dealt with the issue forced me to weep for fulfillment. I’m thankful for the service and thus trust you comprehend what a powerful job that you are carrying out educating the rest through your web blog. Most probably you have never encountered any of us.

  32. I just hope to show you that I am new to posting and completely loved your information. Very likely I am most likely to store your blog post . You certainly have great article materials. Be Grateful For it for swapping with us your main website post

  33. As I site possessor I believe the content matter here is rattling fantastic , appreciate it for your efforts. You should keep it up forever! Best of luck.

  34. Nice blog right here! Also your web site quite a bit up very fast! What web host are you the use of? Can I get your affiliate link in your host? I want my site loaded up as fast as yours lol

  35. I have been checking out many of your stories and it’s pretty nice stuff. I will surely bookmark your website.

  36. It¡¦s really a great and helpful piece of info. I am satisfied that you simply shared this helpful information with us. Please keep us up to date like this. Thanks for sharing.

  37. Well I definitely enjoyed studying it. This subject provided by you is very effective for correct planning.

  38. You made a number of fine points there. I did a search on the topic and found a good number of folks will have the same opinion with your blog.

  39. campervan hire说道:

    Its like you read my mind! You appear to know a lot about this,
    like you wrote the book in it or something. I think that you can do with a
    few pics to drive the message home a bit, but instead of that, this is great blog.

    A fantastic read. I’ll definitely be back.

  40. It is in point of fact a nice and helpful piece of info. I am satisfied that you simply shared this useful info with us. Please stay us up to date like this. Thank you for sharing.

  41. Check This Out说道:

    MichaelJemery.com is a site with many hypnosis downloads. Whether you are looking for free hypnosis downloads, self hypnosis download for mp3, video and any audio files, Michael Jemery has the downloads for you. You can download hypnosis from apps, audio, mp3 and even youtube !

  42. Health & Fitness说道:

    What i don’t understood is if truth be told how you’re not really much more neatly-favored than you may be now. You’re very intelligent. You know therefore significantly relating to this matter, produced me in my opinion imagine it from a lot of varied angles. Its like men and women are not involved until it¡¦s one thing to accomplish with Girl gaga! Your personal stuffs outstanding. At all times maintain it up!

  43. Excellent blog here! Also your web site loads up fast! What web host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as fast as yours lol

  44. Superb blog! Do you have any recommendations for aspiring writers? I’m hoping to start my own website soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m completely confused .. Any suggestions? Thank you!

  45. biocentro.cl说道:

    Biocentro.cl en PROVIDENCIA, Santiago Chile es el mejor en impartir cursos de masajes, cursos de masajes, cursos de masaje, cursos de masajista

  46. Automotive说道:

    Nice blog here! Also your website loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my website loaded up as fast as yours lol

  47. fuck说道:

    I’m not sure where you’re getting your information, but good topic.

    I needs to spend some time learning more or understanding more.
    Thanks for great info I was looking for this information for
    my mission.

  48. Pretty section of content. I just stumbled upon your blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts. Any way I will be subscribing to your feeds and even I achievement you access consistently quickly.

  49. Excellent blog here! Also your web site loads up very fast! What host are you using? Can I get your affiliate link to your host? I wish my web site loaded up as quickly as yours lol

  50. Travel & Leisure说道:

    You actually make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complex and extremely broad for me. I’m looking forward for your next post, I will try to get the hang of it!

  51. Emeryeps is a SEO(Search Engine optimzation) and Internet Marketing company. They help businesses to get traffic from various search engine and online community. They have seo experts and consultants with many years of SEO Experiences. No matter where your business is located, EmeryEPS.com can help your business to secure your highly convertible leads online.

  52. Hiya, I am really glad I have found this information. Nowadays bloggers publish just about gossips and internet and this is actually frustrating. A good blog with exciting content, that’s what I need. Thanks for keeping this web-site, I will be visiting it. Do you do newsletters? Can’t find it.

  53. Hello.This article was really motivating, especially because I was looking for thoughts on this matter last Sunday.

  54. Thanks for another informative website. Where else could I am
    getting that type of information written in such
    a perfect means? I have a venture that I’m just now running on,
    and I’ve been at the look out for such information.

  55. excellent publish, very informative. I ponder why the other specialists of this sector do not understand this. You must continue your writing. I’m sure, you’ve a great readers’ base already!

  56. It’s truly a nice and useful piece of information. I am happy that you simply shared
    this useful info with us. Please stay us up to date like this.
    Thank you for sharing.

  57. Enjoyed reading through this, very good stuff, thankyou . “Hereafter, in a better world than this, I shall desire more love and knowledge of you.” by William Shakespeare.

  58. Very fantastic info can be found on website . “You don’t get harmony when everybody sings the same note.” by Doug Floyd.

  59. You can definitely see your skills in the work you write. The sector hopes for even more passionate writers such as you who aren’t afraid to say how they believe. All the time go after your heart. “What power has law where only money rules.” by Gaius Petronius.

  60. You are my intake , I have few web logs and infrequently run out from to post .

  61. hey there and thank you for your information – I have certainly picked up anything new from right here. I did however expertise some technical points using this web site, as I experienced to reload the site a lot of times previous to I could get it to load correctly. I had been wondering if your hosting is OK? Not that I’m complaining, but slow loading instances times will sometimes affect your placement in google and could damage your high quality score if ads and marketing with Adwords. Well I am adding this RSS to my email and can look out for much more of your respective fascinating content. Ensure that you update this again soon..

  62. I have been browsing online more than three hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. Personally, if all site owners and bloggers made good content as you did, the internet will be a lot more useful than ever before.

  63. We’re a group of volunteers and starting a new scheme in our community. Your website offered us with valuable information to work on. You’ve done a formidable job and our entire community will be thankful to you.

  64. I’ve learn several excellent stuff here. Definitely worth bookmarking for revisiting. I surprise how a lot effort you place to make one of these fantastic informative web site.

  65. I simply wished to thank you so much again. I’m not certain what I would have taken care of in the absence of the type of hints shown by you over my industry. It seemed to be the difficult concern for me, but considering this professional manner you treated that forced me to cry with gladness. Now i am happy for this information and have high hopes you know what a great job you have been doing educating some other people by way of a web site. Most likely you have never got to know all of us.

  66. Hi, Neat post. There’s a problem with your site in web explorer, may check this… IE still is the market leader and a big part of other folks will miss your great writing due to this problem.

  67. But wanna say that this is very helpful , Thanks for taking your time to write this.

  68. I really like your writing style, wonderful info , thanks for posting : D.

  69. Can I simply just say what a comfort to uncover an individual who genuinely understands what they are talking about online.
    You definitely understand how to bring a problem to light and make it important.
    A lot more people ought to read this and understand this side of the story.

    I was surprised you aren’t more popular since you
    surely have the gift.

  70. It’s perfect time to make some plans for the future and it is time to be happy. I’ve read this post and if I may just I want to recommend you some interesting issues or advice. Perhaps you could write next articles regarding this article. I want to read more issues approximately it!

  71. Rattling fantastic information can be found on website . “I don’t know what will be used in the next world war, but the 4th will be fought with stones.” by Albert Einstein.

  72. Good – I should certainly pronounce, impressed with your website. I had no trouble navigating through all tabs and related info ended up being truly simple to do to access. I recently found what I hoped for before you know it at all. Reasonably unusual. Is likely to appreciate it for those who add forums or anything, web site theme . a tones way for your customer to communicate. Excellent task.

  73. of course like your website but you have to take a look at the spelling on quite a few of your posts. A number of them are rife with spelling issues and I in finding it very bothersome to inform the reality however I’ll definitely come back again.

  74. Simply wanna admit that this is invaluable , Thanks for taking your time to write this.

  75. You could certainly see your expertise in the work you write. The world hopes for more passionate writers such as you who are not afraid to say how they believe. Always go after your heart. “He never is alone that is accompanied with noble thoughts.” by Fletcher.

  76. 2018 nissan 370z说道:

    Hi, I do think this is a great web site. I stumbledupon it 😉 I’m going to return yet again since I saved as a favorite it. Money and freedom is the greatest way to change, may you be rich and continue to guide others.

  77. It’s perfect time to make a few plans for the longer term and it’s time to be happy. I have read this put up and if I could I wish to suggest you some fascinating issues or tips. Maybe you can write subsequent articles relating to this article. I want to learn more things about it!

  78. I really appreciate this post. I have been looking everywhere for this! Thank goodness I found it on Bing. You have made my day! Thank you again!

  79. dang ky logo说道:

    It’s actually very difficult in this active life to listen news on Television, so I simply
    use internet for that reason, and obtain the hottest news.

  80. M88说道:

    It’s very straightforward to find out any topic on net
    as compared to textbooks, as I found this piece of writing at this web site.

  81. Awesome! Its genuinely amazing post, I have got much clear idea
    concerning from this paragraph.

  82. suba me说道:

    NP1TSD Wow, this piece of writing is good, my sister is analyzing these things, therefore I am going to convey her.

  83. Woah! I’m really digging the template/theme of this blog. It’s simple, yet effective. A lot of times it’s difficult to get that “perfect balance” between superb usability and appearance. I must say you’ve done a excellent job with this. Also, the blog loads extremely quick for me on Firefox. Exceptional Blog!

  84. Home Improvement说道:

    You have mentioned very interesting details! ps decent web site.

  85. essay writers说道:

    Fantastic web site. Lots of helpful info here. I’m sending
    it to some buddies ans also sharing in delicious. And of course, thank you on your effort!

  86. Google.Com/Maps说道:

    Right here is the right web site for anybody who wanfs to understand this topic.
    You know a whole lot its almost hard to aregue with you (not thwt I really will need to…HaHa).
    You certainly put a new spin oon a subject that has been written about for decades.

    Great stuff, just excellent!

  87. Hi, I do believe this is an excellent website. I stumbledupon it 😉 I will return once again since I bookmarked it. Money and freedom is the best way to change, may you be rich and continue to guide others.

  88. Health说道:

    I like this post, enjoyed this one regards for posting .

  89. Does your blog have a contact page? I’m having a tough time locating it but, I’d like to shoot you an email. I’ve got some recommendations for your blog you might be interested in hearing. Either way, great site and I look forward to seeing it grow over time.

  90. poker site说道:

    Howdy this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if
    you have to manually code with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get
    advice from someone with experience. Any help would be enormously appreciated!

  91. Greetings! This is my first comment here so I just wanted to give a quick shout out
    and say I really enjoy reading through your blog posts.
    Can you suggest any other blogs/websites/forums that go
    over the same topics? Thanks a lot!

  92. poker说道:

    Way cool! Some very valid points! I appreciate you penning this article plus the rest of the website is
    also very good.

  93. Business说道:

    Hi, i think that i saw you visited my site so i came to “return the favor”.I’m attempting to find things to improve my website!I suppose its ok to use some of your ideas!!

  94. Women说道:

    Very interesting topic, thanks for putting up.

  95. essay writers说道:

    I have read so many articles about the blogger lovers however
    this paragraph is truly a pleasant piece of writing, keep it up.

  96. Career And Jobs说道:

    Utterly written content, Really enjoyed studying.

  97. Fashion说道:

    I’ve been absent for a while, but now I remember why I used to love this web site. Thanks, I’ll try and check back more often. How frequently you update your web site?

  98. Greetings from Carolina! I’m bored to tears at
    work so I decided to browse your website on my iphone during lunch break.
    I enjoy the knowledge you provide here and can’t wait to take a look when I get home.
    I’m surprised at how quick your blog loaded on my cell phone ..
    I’m not even using WIFI, just 3G .. Anyhow, fantastic blog!
    Is it OK to share on Twitter? Keep up the great work!

  99. Psycholog Gorzow说道:

    As soon as I discovered this internet site I went on reddit to share some of the love with them.

  100. Technology说道:

    wonderful issues altogether, you just won a brand new reader. What may you suggest about your post that you made some days in the past? Any certain?

  101. I view something really special in this web site.

  102. Pets说道:

    Hello my friend! I wish to say that this article is awesome, nice written and come with almost all important infos. I’d like to see extra posts like this.

  103. Jewelry说道:

    Hello very nice site!! Guy .. Excellent .. Superb .. I will bookmark your web site and take the feeds also…I’m satisfied to find numerous useful information right here within the put up, we want work out more techniques on this regard, thanks for sharing.

  104. I needed to thank you for this very good read!! I
    certainly loved every little bit of it. I have got you
    book-marked to check out new stuff you post…

  105. Eartha说道:

    how much time it takes to notice change madam

  106. This piece of writing gives clear idea in support of the new people of blogging, that actually how to do blogging and site-building.

  107. Control units说道:

    Thanks for sharing your thoughts on Conveyor system closures.
    Regards

发表评论

电子邮件地址不会被公开。