카테고리 없음

Android Studio 첫 프로젝트 시작하는 법, 파일 구조 설명, AVD 테스팅 에뮬레이터/USB 설정

달모드 2023. 6. 14. 22:38

패키지명은 backwards 컨벤션을 따르며, 다 lowercase, space가 생략된다.

 

제일 밑 미니멈 API 레벨에서, 버전에 따라 밑에 전체 기기의 몇퍼센트를 커버할 수 있는지 수치가 나온다.

Minimum API Level은 Tradeoff라고 생각하면 된다. 버전이 낮을수록 커버를 할 수 있는 기종은 많고, 버전이 높을수록 다양한 피쳐를 활용할 수 있다.

 

API level을 고를때 밑에 있는 help me choose 를 누르면 아래와 같이 화면이 뜬다. 보고 참고하면 된다.

 

파일 구조

app > java > com.example.helloworld > MainActivity

This is the main activity. It is the entry point for our app. When we build and run our app, the system launches an instance of this Activity and loads its layout.

app > res

The res folder contains application resources, such as drawable files, layout files, and UI strings. It is used to store the values for the resources that are used in many Android projects to include features of color, styles, dimensions, etc. The benefit of having these resources separate from our Java code is so that they can be updated independently.

app > res > layout > activity_main.xml

This XML file defines the layout for the activity’s user interface (UI). It currently contains a TextView element with the text “Hello World!”

app > manifests > AndroidManifest.xml

The manifest file describes the fundamental characteristics of the app and defines each of its components.

  • Android Studio creates this file for us when we create our App.
  • Every Android app must include a file precisely named AndroidManifest.XML at the root of the project source set.
  • The manifest file describes essential information about our app to the Android build tools, the Android operating system, and Google Play.

Gradle Scripts > build.gradle

There are two files with this name: one for the project and one for the app module. Each module has its own build.gradle file, but this project currently has just one module.

When we click the run button in Android Studio, here are some of the things that Gradle does:

  • Locates and downloads the correct versions of any third-party libraries we need.
  • Calls the correct build tools in the correct sequence to turn all of our source code and resources into a deployable app.
  • Installs and runs our app on an Android device.
 

Steps to Enable USB Debugging

  1. Plug-in your Android Device to Computer via USB
  2. Open the “Settings” App on the Device
  3. Scroll down to the bottom to find “About phone” item
  4. Scroll down to the bottom to find “Build number” section
  5. Tap on “Build Number” 7 times in quick succession
  6. You should see the message “You are now a developer!”
  7. Go back to main “Settings” page
  8. Scroll down the bottom to find “Developer options” item
  9. Turn on “USB Debugging” switch and hit “OK”
  10. Unplug and re-plug the device
  11. The dialog appears “Allow USB Debugging?”
  12. Check “Always allow from this computer” then hit “OK”

 

credit to: codecademy