Android Studio Experience (iii)-Migrating from Eclipse to Android studio

Source: Internet
Author: User


Intermittent is the successful migration of the code on the Eclipse to Android studio, and now, my colleagues continue to use Eclipse, I use Android STUDIO,SVN or previous Eclipse project, after the successful migration, I can also happy development, two not mistaken. Just to share my little bit of work.

Take Demo4 as an example, and reference the library package appcompat_v7_8.

1, the first step, eclipse still want to have drop, and ADT to be above 22, I believe that all ADT must be above 22, otherwise also develop a hair.

(1) In Eclipse, select Flie->export–>android–>generate Gradle build Files

(2),next–> Select the item you want to guide –>next–> first check force overriding of Exeisting Files–>finish->finish

(3). Everyone, notice, there is something to change, first in the Eclipse project to see the project, add a file Build.gradle, and then directly in the face pity dorado things.

Change what the book, first on my change after the figure. HD Uncensored Big picture, show in the back

A, apply plugin: ' Android ' changed to apply plugin: ' com.android.application ' because, apply plugin: ' Android ' is not suitable for the current version of

b, add a piece of code, believe me, plus go on the line, pro-test

Buildscript {
repositories {
Mavencentral ()
}
dependencies {
Classpath ' com.android.tools.build:gradle:1.0.0′

}
}

C, the Buildtoolsversion "19.1.0″ changed to Buildtoolsversion" 21.0.2″. Notice, don't look at me this is 21.0.2, you have to see your own version of the SDK,

Ok! Ctrl+s save what has just changed, eclipse we can not see for the time being,

2, step two, we find the Eclipse workspace, which is the directory where you put your project code. Hey, you'll find a few more files.

We have to change two things, believe me, absolutely to change, do not change the pit,

(1) The first one is Build.gradle, if you are 0.8.+, change to 1.0.0 or version issue

(2). The second must be changed, Gradle\wrapper This directory inside the gradle-wrapper.properties file, the default is online loading, in the kingdom to Google download, you understand. So we're going to change the load to local. You have to have this thing first, gradle-2.2.1-all. If not, go to () download

Link: http://pan.baidu.com/s/1bnxYzmv Password: nd2l

Come on, Android studio is finally ready to play.

3, the third step, open Android Studio, select Import non-android Studio project–> Select the project Demo4 inside the Build.gradle file, do not choose the wrong, click OK. You may have a popup box, just OK. Then just wait for it to create the project. hahaha

OK, the following if this error, then it means no problem. As you can see, we didn't import the Libray package.

Come back to eclipse, select the package appcompat_v7_8 to be introduced, and, as before Demo4, generate the Build.gradle file. And then back to Android studio. Import, File–>import Module–>appcompat_v7_v8–>ok (PS: Here directly select the project on the line, do not go to select the Build.gradle file inside) notice, anyway I do, very cool,- If you also refer to other library packages, the same operation, cool.

4, and finally a little configuration is OK. Is that you originally quoted a few library packages, you have to check whether a place is not configured

dependencies {
Compile Filetree (dir: ' Libs ', include: ' *.jar ')
Compile project (': appcompat_v7_8′)
}

(PS: If you have a previous project loaded. So files, such as using the Map SDK, push the SDK, which have. so files, optical compilefiletree (dir: ' Libs ', include: ' *.jar ') useless, You also need to configure it to load the. so file. You can read this article about Android Studio usage (vi)-android Studio how to load. So files)

Read on, compile Filetree (dir: ' Libs ', include: ' *.jar ') This line will bring you the. jar package from the Lib folder in your previous eclipse, so you don't have to worry about it, compile project (" ) is your import module of the library package, you each lead one in, in

Settings.gradle this inside will have, directly to include the copy in the back of the past, because, afraid of you manually knocked wrong, resulting in an error.

5. Due to the merit, run! Hello world! is coming ...

All right... My colleagues took a nap, and I didn't hit the keyboard. Go to bed... I hope this article can help everyone. When you move the code, there are any problems can be said to discuss together, learn from each other, solve the problem.

0You may also like:
    • Android Studio Usage tips (a)---Android Studio quick master shortcut keys
    • Android Studio Usage tips (vi)---how Android studio loads. So files
    • Android Studio user Experience (ii)---packaging signature apk release
    • Android Studio Usage tips (iv)---Android Studio multi-channel packaging (II)
    • Android Studio Usage tips (v)---code obfuscation and hack apk

Android Studio Experience (iii)-Migrating from Eclipse to Android studio

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.