App을 새로 생성해서 테스트 하려고 하니 오류가 나옵니다.

 

Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.

 

 

Gradle을 살펴보고

 

android {
   
compileSdkVersion
31
   
buildToolsVersion "31.0.0"

   
defaultConfig {
       
applicationId
"copycoding.tistory.sample"
       
minSdkVersion 16
       
targetSdkVersion 31
       
versionCode 1
       
versionName "1.0"

       
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   
}

 

설치된 SDK Tool도 살펴봐도

 

 

 

별 문제 없는것 같은데..

 

 

1. 버전 낮추기

 

다시 설치하긴 귀찮고 전체적으로 버전을 30으로 낮추어 봅니다. 

 

android {
   
compileSdkVersion
30
   
buildToolsVersion "30.0.3"

   
defaultConfig {
       
applicationId
"copycoding.tistory.sample"
       
minSdkVersion 16
       
targetSdkVersion 30
       
versionCode 1
       
versionName "1.0"

       
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.3.1'
    implementation 'com.google.android.material:material:1.5.0'

 

 

이런.  새로운 오류가 발생 합니다.

 

 

ERROR:C:\Users\will\.gradle\caches\transforms-2\files-2.1\4eb2fc21ccc2dce4da190845bc3482ac\material-1.5.0\res\values-v31\values-v31.xml:3:5-94: AAPT: error: resource android:color/system_neutral1_1000 not found.

 

Material Component Library 버전이 업데이트 되어서 31을 사용해야 한다고 합니다.

답을 찾았네요.  material 버전을 낮추면 되는거군요.

 

android {
   
compileSdkVersion 30
   
buildToolsVersion "30.0.3"

    
defaultConfig {
       
applicationId
"copycoding.tistory.sample"
       
minSdkVersion 16
       
targetSdkVersion 30
       
versionCode 1
       
versionName "1.0"

       
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
   
}

   
buildTypes {
       
release {
           
minifyEnabled
false
           
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
       
}
    }
   
compileOptions {
       
sourceCompatibility JavaVersion.
VERSION_1_8
       
targetCompatibility JavaVersion.VERSION_1_8
   
}
}



dependencies {

   
implementation 'androidx.appcompat:appcompat:1.3.1'
   
implementation 'com.google.android.material:material:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
   
testImplementation 'junit:junit:4.+'
   
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
   
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

  

material 버전을 1.5.0에서 1.2.0으로 변경 하나 잘 됩니다.  물론 1.4.0로 낮추어도 됩니다.

 

 

 

 

2. buildToolsVersion 낮추기

 

다른건 그대로 두고 buildToolsVersion만 낮추어서 해결해 봅니다.

Android Studio에서 Gradle을 열고 오른쪽 상단을 보면 Open (Ctrl+Alt+Shift+S)가 있는데

 

 

이걸 누르면 창이 하나 뜨고

 

 

여기서 Build Tools Version을 확장하여 31.0.0 대신 하나 낮은걸 선택 합니다.

  

android {
   
compileSdkVersion
31
   
buildToolsVersion '30.0.3'

   
defaultConfig {
       
applicationId
"copycoding.tistory.test"
       
minSdkVersion 16
       
targetSdkVersion 31
       
versionCode 1
        
versionName "1.0"

 

 

 

그리고 실행하면 다른 오류가 발생 합니다.

 

Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details.

 

 

android:exported 이게 문제라는 군요.  참조하라는 링크를 따라가보면 설명이 있습니다.

https://developer.android.com/guide/topics/manifest/activity-element#exported

 

어째든 android:exportedManifest에 추가하고 값을 넣으면 됩니다.  만일 false를 넣으면 앱이 생성은 되는데 실행하려고 하면 app is’nt installed라는 토스트만 나오니 true를 적어 줍니다.

값을 설정하는 위치는 activity에 해주어야 합니다.

  

<activity android:name=".MainActivity"
   
android:exported="true"
>
    <
intent-filter>
        <
action android:name="android.intent.action.MAIN" />

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

 

이렇게 하면 앱을 잘 테스트할 수 있습니다.

 

 

이건 제가 간단한 테스트를 하려고 한것이고 실제로는 높은 버전으로 컴파일 해야 최신 핸드폰에서도 잘 돌아가는 앱을 만들 수 있겠죠.

 

- copy coding -


현재 나와있는 스프링 부트는 4버전이지만 좀 안정적인 사용을 위해서는 3버전을 설치하기로 하고 다운로드 페이지로 이동을 합니다.

https://github.com/spring-projects/toolsuite-distribution/wiki/Spring-Tool-Suite-3


Spring 사이트는 텍스트 위주로 되어 있어서 정보를 많이 얻을 수는 있지만 뭐가 찾으려면 직관적으로 찾기는 좀 어려운 사이트인것 같습니다.


spring boot download install


링크된 페이지에 가면 Spring tools 최신 4버전 부터 아래로 버전별로 리스트 되어 있고 사용하려는 버전을 선택 하면 됩니다.


spring boot download install


최신 버전은 4이지만 3버전의 마지막 배포본을 다운 받았습니다.

설치는 압축을 풀기만 하면 되기 때문에 가능하면 사용하려는 위치로 압축파일을 이동해서 풀어줍니다. 압축을 풀어줄 때 알집이 아닌 7zip을 이용하길 권장합니다.


spring boot download install


알집으로 압축을 풀면 저만 그런가 오류가 발생해서 실행은 되지만 찜찜한 기분이 들어 7zip을 이용 합니다.


spring boot download install


압축이 풀리면 3개의 폴더가 생기는데 이중 sts라고 되어 있는 폴더에 들어가 보면 


spring boot download install


사용하려는 STS를 볼 수 있습니다.

STS.exe를 실행 합니다.


spring boot download install


java를 설치하지 않았다면 JDK를 찾을 수 없다는 안내 창이 나타나고 기존에 java가 설치 되어 있다면 


spring boot download install


다음과 같은 창이 나오고 작업 폴더를 선택하고 Launch 버튼을 클릭 합니다.


spring boot download install


Spring boot 설치가 완료 되었습니다. 이제부터 좋은 프로그램을 만들기만 하면 됩니다.


- copy coding -


1

+ Recent posts