Migrate from Eclipse to Android Studio, eclipseandroid
Google officially launched Android Studio 1.0, and Android's default development tool also changed from Eclipse to intellij. There will certainly be fewer and fewer support for Eclipse. for Android Developers, it's time to change the tool.
Compared with Eclipse, Studio is more stable and has more functions. It is more like a dedicated Android development tool. As for performance, it is similar to Eclipse, and it is smoother than Eclipse on a computer with high configuration.
The first time I came into contact with Android Studio, I should first understand the engineering structure. Studio can only be opened in each windowOneProject. Each project contains a module, which can be a library or an application. In this case, the project in Studio is more like the workspace in Eclipse, and the module is more like the project in Eclipse. Although the functions are similar, the meaning is different. The Android Studio project is a resource related to the project, and the workspace is more like all the work.
It is very difficult to change an ide. It is especially difficult to get familiar with shortcuts, especially when I used Eclipse in year 34, and I have never used any other ide. So people like me who love to be lazy directly use the Eclipse shortcut keys,
Open Preferences, search for keymap, and select Eclipse to directly use the Eclipse shortcut on Android Studio. Of course, it is best to master the shortcut keys of Studio.
Android Studio uses Gradle as the build tool to open the build. gradle file under the new project app directory.
1 apply plugin: 'com.android.application' 2 3 android { 4 compileSdkVersion 21 5 buildToolsVersion "21.1.2" 6 7 defaultConfig { 8 applicationId "test.com.hellostudio" 9 minSdkVersion 1410 targetSdkVersion 2111 versionCode 112 versionName "1.0"13 }14 buildTypes {15 release {16 minifyEnabled false17 proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'18 }19 }20 }21 22 dependencies {23 compile fileTree(dir: 'libs', include: ['*.jar'])24 compile 'com.android.support:appcompat-v7:21.0.3'25 }
The content before buildTypes can be understood by everyone. The content in buildTypes can also be guessed. It is the configuration of proguard. The default value is false. If it is set to true, proguard is enabled.
Dependecies is the content of Project dependencies. The first line is to compile all jar files under the app \ libs directory, and the second line is to add support v7 dependencies. To add v7 to Studio, you only need a line of code. In Eclipse, You need to import a project, which is very different. Every time you modify the gradle file, you will be prompted to re-compile. If you have added a jar file to the libs directory and need to re-compile it, you can click the shortcut key in the toolbar.
If you want to introduce the dependent res file, you cannot simply add the jar package, and it is not uploaded to maven. You need to create a new module. You can use the import module to import the Eclipse project. Then add a sentence in dependecies
compile project(':PullToRefresh')
I don't know why the imported project is a module...
So far, we should be able to start work.