Basic knowledge of android studio 1

Source: Internet
Author: User

Basic knowledge of android studio 1

Recently, many android Developers around them are using android studio, so they tried to use it. In fact, I knew this development tool in 2013 and didn't use it because I was too lazy. It is found that it will be a major problem if you do not use android studio for future android development! The following are some of your problems in use.

1. Programmers who are familiar with Eclipse cannot start when they first come into contact with android Studio (hereinafter referred to as). Why? There is a workspace in Eclipse, which can be used to create many projects. However, if you are the first to use it in as, you will find that you cannot find the workspace. You can select Project or android here (after android is selected, as will merge the folders in res ). There are several options under Scopes, which readers will understand when they try.

2. The build. gradle file I read a lot about gradle when I first came into contact with the as, and it did not solve my problem. The default build. gradle file is as follows:

buildscript {    repositories {       jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:1.0.0'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {      jcenter()    }}
If you add such code to dependencies in build. gradle of a project

 

 

    compile 'com.android.support:appcompat-v7:21.0.3'    compile 'com.squareup.dagger:dagger:1.2.2'    compile 'com.squareup.dagger:dagger-compiler:1.2.2'    compile 'com.jakewharton:butterknife:6.0.0'    compile 'com.squareup.retrofit:retrofit:1.9.0'    compile 'com.android.support:support-v4:21.0.3'    compile 'com.android.support:appcompat-v7:21.0.3'
If your network can access a foreign network, or your project fails in gradle, an error will be reported (Note that if your configuration is the same as the above, you need to be able to access a foreign network when using compile ). Of course, there is another method as follows:

 

 

Buildscript {repositories {mavenCentral () maven {url file: // E: /githubrepo/releases} // or use the specified remote maven repository maven {url http://mvnrepository.com/} dependencies {classpath 'com. android. tools. build: gradle: 1.0.0 '// NOTE: Do not place your application dependencies here; they belong // in the individual module build. gradle files }} allprojects {repositories {mavenCentral ()}}
Change the preceding jcenter to mavenCenter, and add a url without accessing a foreign network, which is easy to solve.
The above is a little bit of sharing for new users who have just come into contact with the as. If it is hard to write, a large number of programmers are welcome to leave me a message! In the end, I hope that I don't want to be unwilling to accept the new things. If I am the first person to eat crabs, because I am a programmer.

 

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.