Android Learning Series (41)-simple use of Android Studio, android-android

Source: Internet
Author: User

Android Learning Series (41)-simple use of Android Studio, android-android
1. Environment

UBUNTU 14.04 + Android Studio 0.8.2

2. Install jdk

Openjdk-7 is a good choice:

sudo apt-get updatesudo apt-get install openjdk-7-jdk
It is not excluded that you need to select a default version:
    sudo update-alternatives --config java    sudo update-alternatives --config javac

3. Install Android Studio

There are two ways to install UBUNTU.

(1). Add PPA.

Open the terminal and run the following command:

sudo add-apt-repository ppa:paolorotolo/android-studiosudo apt-get updatesudo apt-get install android-studio
If you want to remove PPA and delete Android Studio:
sudo apt-get install ppa-purgesudu ppa-purge ppa:paolorotolo/android-studio

(2) download and unzip the package on the official website.

:

Http://developer.android.com/sdk/installing/studio.html

To delete Android Studio, delete the folder android-studio.

Run bin/studio. sh to start Android Studio.

4. Modify settings (1). Topic.

File-Settings-Appearance-Theme-Darcula (black subject)

(2). Shortcut Key.

File-Settings-Keymap-Eclipse (for those who are used to the Eclipse shortcut keys)

5. Projects and modules

The project of Android Studio is equivalent to the workspace of Eclipse.

The module of Android Studio is equivalent to the Eclipse project.

(1). Create a Project

File-New Project

Enter the package name,

(2). Create a Module

File-New Module

Note that:

  • Application name is the Project name.
  • By default, the Module name of the newly created Project is app. On 0.8.2, I did not find the setting. After the Project is created, I can right-click "Refactor-Rename" on the app to change the Module name and Dir name.
(3) import a Project

In File-Close Project, press Del to delete the newly created ListViewSample.

We can use Open Project to Open the Project just now. In this case, there is no problem. In more cases, we need to import other projects to Android Stuio. Let's take this as an example to see the process,

Import Project-(Porject Location)

OK.

(4). Create a Module

File-New Module

Select Android Application,

The Application Name is better than the Project Name. The Module Name is named NewApp,

6. Module deletion Problems

Many of my friends find that they do not know how to delete the Module. Try the following:

7. Summary

Powerful Android Studio is coming. Why not use it? Not found.

I will add some notes in the future.


Where is android studio better than eclipse?

1. Speed. It is definitely speed !!! The startup speed of IDE is only a small part of the speed. The so-called speed here, more importantly, whether IDE can bring convenience to your coding, greatly improving the efficiency of software building. During development, the process of migrating from ADT to Android Studio is quite simple. First, Android Studio prompts that the ADT has been killed in seconds. As we all know, Android Studio is built based on IntelliJ IDEA, and IntelliJ IDEA is hailed as "the smartest Java IDE ". You can refer to this video: Instant Autocompletion in IntelliJ IDEA 10. If you want to get a prompt in the Eclipse-based ADT, you must at least keep pressing Alt +/(the smart prompts of Android Studio appear automatically ). The obtained prompts are only obtained based on text analysis. Most of them are irrelevant to your code. So at this point, ADT was defeated by Android Studio. In addition, Android App building in ADT is based on Gradle by default, as mentioned above by @ bunker. Compared with Ant, Gradle can use scripts to specify App building options. If you receive a task, you need to deliver the latest test version of the software to the tester for testing, and also need to mount the stable version of the apk file on the market, what do you do if you deliver an apk file containing the new function branch version to PM? If you are in ADT, you may need to create at least three projects to achieve this goal. The Code synchronization between different versions will make you overwhelmed. However, when Gradle is used in Android Studio, you will find things become so simple. Specifying different compilation options in build. gradle makes it easy to solve the problem ~ (Of course, Android Studio automatically identifies the Ant project imported from the ADT, but does not automatically convert it to Gradle.) In addition, the Multi-Resolution layout automatic preview feature is not an extremely appealing presence for Android Developers ~ The multi-language environment preview and UI builder features are not used much, so no comments are posted for the moment. The last and least important thing is the speed at which the software runs. This requires your own experience. 2. pleasing to the eye and extremely practical ui I use the topic Drakura. Compared with the UI of ADT, which is full of native thamet, the UI of Android Studio is quite handsome! Pai_^ is not only the visual beauty, but also the speed. In the ADT, you cannot open the project structure view (or any view) while maximizing the code editing area. You have to keep maximizing and minimizing the view. I believe you will spend a lot of time in this regard! Of course, this problem does not exist in Android Studio! Of course, Android Studio is still in beta stage, and the DDMS function still needs to use the relevant modules in ADT, the Project dependency library set in the Project Structure is not converted to the dependency part in the Gradle file by itself (you still need to modify the Gradle file by yourself ). These may be the last and least important part of the ADT, that is, the software running speed. This requires your own experience.

Android Studio cannot be enabled

1. When a project is created for the first time, something needs to be downloaded. If some errors are prompted, check the error and open the download again to run it. It may be that the download was not completely downloaded.
2. Check whether the jdk path is configured. There is no problem in both 1.6 and 1.7.
3. run Windows 7 as an administrator.
4. Find studio.exe. vmoptions in the bindirectory and remove the line containing UseCodeCacheFlushing.
5

Use NotePad to open studio. bat under the android-studio \ bin directory
SET VM_OPTIONS_FILE = % IDE_BIN_DIR % \ studio=bits=.exe. vmoptions
SET VM_OPTIONS_FILE = % IDE_BIN_DIR % \ studio1_bits0000.exe
You can use it.
6 open it with a text Tool
Studio. bat
Line25 to line 28:
Set jre = % JDK %
If exist "% JRE % \ jre" set jre = % JDK % \ jre
Set bits =
If exist "% JRE % \ lib \ amd64" set bits = 64

We can see that the number of system bits supported by the software is 64 bits, and my own computer is a 32-bit jre/lib directory with only i386 files.
Try
If exist "% JRE % \ lib \ amd64" set bits = 64
If exist "% JRE % \ lib \ i386" set bits = 32

Reference address: my.eoe.cn/..ondesknew

Related Article

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.