Android Studio development environment construction & configuration

foreword

The last time I did Android development was in the third-year Android class project " IPOD - Local Music Player "

  • Development environment: JDK
  • Development language: Java
  • Development tools: Android Studio

Now because the work requires "business-oriented programming" , I need to resume Android development. Since the computer has been changed, I decided to re-open an Android column and record learning essays at the same time. Welcome to subscribe~


JDK installation configuration

Regarding JDKthe part of installation & configuration, there are many perfect articles on the Internet, so I won’t repeat them too much.

  • Go to the official website to download and install, then "configure environment variables"
    • If you don't know how to find it, just download it here (password: @Wriprin)

java -version& javacTest whether the configuration is successful

JDK-TEST.png


Android Studio installation configuration

After the download is complete, run the program to install Android Studio Setup, modify the "installation path" and wait for the installation to complete

insert image description here

Here select "Do not import settings"

insert image description here

Next, configure the download path of regular dependencies such as SDK, etc. Here, select "Custom" , and it is recommended to configure a place other than the C drive

insert image description here

By default, it will point to the directory at the same level as the program installation path, just click Next

insert image description here

Configure the SDK installation directory

insert image description here

The installation configuration is summarized as follows:

insert image description here

  • You can switch "Global {over} proxy {filter}" to download, and then wait for the download to complete

  • If you don’t have the conditions, you can find relevant packaged SDK packages on the Internet and download them directly to the local configuration. I won’t go into too much detail about this part, and you can find relevant resources by yourself if necessary.

insert image description here

Regarding the problems AMD will encounter, solutions: Android-emulator-hypervisor-driver/issues

insert image description here


HelloWorld

Initial Welcome interface - "New Project" - create a project

insert image description here

Let's choose one here Empty Actityto do the initial project construction

insert image description here

The project configuration is related, and the specific configuration is shown in the following figure:

insert image description here

You can see that the project structure on the left has been Loading..., click Build in the lower left corner and you can see that AS is downloading Gradle and some other related dependent jar packages and other files for us, just wait patiently

insert image description here

  • If the download is complete and the project is built, you will be prompted to Errorreport an error

  • Then it is recommended to click "Try again" and try Syncagain. It may be that some dependencies were not successfully downloaded during the last build, which largely depends on your network environment. If there is no relevant proxy environment for this, then I can only say that I will do my best.

  • PS: If HelloWorldsuch an empty project can't run, it's really a ghost :-(

The first is MainActivitythe startup class: which onCreate()loads the style file activity_main.xml(used to build the page layout style)

package cc.cnix.helloworld;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {
    
    

    @Override
    protected void onCreate(Bundle savedInstanceState) {
    
    
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
}

In addition, you also need to know that AndroidManifest.xmlthe (startup) class is configured in

<application>
	<activity>
		<!-- 配置启动类 -->
    </activity>
</application>

AS default configuration modification


AVD installation configuration

Android development tests can pass:

  • Test with a real device (USB connected to an Android device (with ADB debugging enabled), MUMU, Thunderbolt...)
  • Use the built-in AVD (Android Virtual Device) Android virtual device test
  • Use Virtual Box + Genymotion to build virtual machine debugging

The smooth operation of AVD requires three hardware conditions:

  1. x64-bit CPU that supports virtualization
  2. 8 GB or more of RAM
  3. 20 GB or more of free disk space

At the same time, you also need to confirm that the virtualization function of the CPU has been turned on in the BIOS settings

First configure the Gradle JDK, using the "embedded"JDK version 11.xx.xx

insert image description here

Then select "AVD Manager"

insert image description here

Create Virtual Device, then select the AVD model configuration

insert image description here

Select the required API version and download the system image "Tested - 28 - Pie - 5.0 is valid"

insert image description here

After the download configuration is complete, start the HelloWorld project

insert image description here

So far, the environment construction and basic configuration of Android Studio have been completed~

Guess you like

Origin blog.csdn.net/Kideers/article/details/128298106