Android learning 1: Android development environment construction

Installation files:

http://www.android-studio.org/

android studio 2.0: https://dl.google.com/dl/android/studio/install/2.0.0.20/android-studio-bundle-143.2739321-windows.exe

 

installation path:

studio: D:\Program Files\Android\Android Studio2

sdk: D:\Users\Thinkpad\AppData\Local\Android\sdk

Create a new Project forder: D:\Android\hello, create a new Empty Activity

 

cellphone setting:

1. Turn on developer mode

2. Set up usb debugging

 

Run the app:

Click the run button in android studio, select the connected phone, and the program starts successfully on the phone.

When it starts up, the phone will prompt to install the apk program.

 

Generated MainActivity:

package com.example.lijingshou.myapplication4;

import android.support.v7.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, under the layout folder, there is an xml layout file corresponding to Activity:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.lijingshou.myapplication4.MainActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Hello World!" />
</RelativeLayout>

 

AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.lijingshou.myapplication4">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326923891&siteId=291194637
Recommended