[Android learning notes] Android Studio development environment under Mac, android learning notes

Source: Internet
Author: User

[Android learning notes] Android Studio development environment under Mac, android learning notes

For mobile terminals, I have been developing iOS for the past, and I have never used Java. However, it entered the finals of the Google Android national mobile Internet innovation challenge for college students (entering the official website) (the project of the author's "Western Computer Education Promotion Program" was directly recommended to enter the finals ), this competition requires that the apk program be submitted, so I have to learn about Android development.

Next we will record our learning process.

1. Install Android Studio

My computer configuration is as follows:

Installing Android Studio on Mac should be simpler. You only need to download an Android Studio. dmg file and drag it to your computer.

Ii. Hello_Android Demo

After the environment is installed, create the first Android App project for testing.

The Create Project dialog box is displayed, and the app name is Hello_Android. The next steps are set by default.

Select the devices on which the App will run

Select an activity. Select a blank activity first.

Keep the default class name and page layout name

At this point, the author's first Android program has been built, as shown in!

Switch to layout File

But !!! I never expected that an error occurred when creating a new project ???

I encountered an error when I created the first Android App, and my heart collapsed.

Failed to find style 'textViewStyle' in current theme (4 similar errors not shown)
Error:Failed to resolve: com.android.support:appcompat-v7:27.+

After some attempts, I found a solution to the problem:

This is because the SDK Tools and platform versions do not match,
① Open SDK Manager and select Updates to view the version information. The SDK Tools version is 26 and the platform version is 27.

② Open the build. Gradle (Module: app) in the Project build File gradle Scripts)

Before change

After modification

Rebuild it, or click Try Again !!!

No error ,,,
Hello Android !!!

3. Run the App on the Android Simulator

Now that an executable App has been created, we will test it through the Android Virtual Device (AVD.

Now, Hello Android is running on the simulator!

4. Real machine debugging

First, I have to talk to developers of Xiaomi !!!

As a developer, using usb for installation and usb debugging makes it difficult for me to log on to my Xiaomi account. But why do I still restrict SIM card insertion ??? You cannot install usb without inserting a SIM card !!!

You cannot skip this brainless setting. After the competition, you will not use Xiaomi as a testing machine.

Let's talk about things.

 

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.