1. 프로젝트 생성
- New Project -> Empty Activity 선택
- Name : Hello, Language : Java, SDK : API 21 선택
2. 소스코드와 화면
3. 화면 디자인 및 편집
- res -> layout -> activity_main.xml 선택 후 Design 클릭
- Infer Constraints
: ConstraintLayout 은 위젯이 연결되어 있지 않으면 오류 발생하는데 이런 경우 위젯들을 자동으로 정렬해 주는 기능이다.
- 폼에 버튼을 2개 정도 올려 놓은 후 Infer Constraints로 정렬
4. 실행 하기
One or more issues found when checking AAR metadata values:
The minCompileSdk (31) specified in a
dependency's AAR metadata (META-INF/com/android/build/gradle/aar-metadata.properties)
is greater than this module's compileSdkVersion (android-27).
Dependency: androidx.appcompat:appcompat:1.4.0.
이런 오류를 만나면 다음과 같이 해결하자.
1. Gradle Scripts -> build.gradle(Module) 에서
implementation 'androidx.appcompat:appcompat:1.4.0'
을
implementation 'androidx.appcompat:appcompat:1.3.0'
으로 변경 하여 Sync now 클릭하여 적용 후 실행
2. Tools -> SDK Manage 클릭하여 Android 12.0(s) 인스톨 후 Gradle Scripts -> build.gradle(Module) 에서
android {
compileSdk 30
defaultConfig {
applicationId "com.example.hello"
minSdk 21
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
의 compileSdk 와 targetSdk 를 31로 변경 후 실행
android {
compileSdk 31
defaultConfig {
applicationId "com.example.hello"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
- 실행결과
'앱프로그래밍 > 안드로이드-자바' 카테고리의 다른 글
03-2 JAVA 기본문법(클래스와 인스턴스) (0) | 2021.12.03 |
---|---|
03-1. JAVA기본 문법 (0) | 2021.12.03 |
01-3. 프로젝트 트리의 구성 (0) | 2021.12.03 |
01-2 안드로이드 프로그램에 나만의 아이콘 출력하기 (0) | 2021.12.02 |
교재 안내 (0) | 2021.11.30 |