[Android Studio-에러] Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin 'com.android.application' is already on the script classpath. Plugins on the script classpath cannot be applied in the plugins {} block. Add ..

2024. 4. 11. 15:17·Error
안녕하세요. 오랜만 입니다..
개발 지식을 담고자 시작한 블로그이지만, 지금 확인하니 일상 정보밖에 없네요.
반성하고자 이 포스트를 쓴 것은 아니지만
더욱 더 풍요로운 블로그를 만들기 위해 정진해야겠다고 마음먹게 됩니다.

1. 상황

평화로운 오후를 보내고 있던 도중, 깃허브에 제가 과거에 진행했던 안드로이드 프로젝트를 올리고 싶다는 생각이 들었어요.

 

그래서 삭제했던 안드로이드 스튜디오를 다시 다운로드하고, Java 8도 다시 설치하여 과거 프로젝트 파일을 'OPEN' 했지만 오류를 마주쳤습니다.

2. 문제 및 문제 원인 분석

'Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin 'com.android.application' is already on the script classpath. Plugins on the script classpath cannot be applied in the plugins {} block. Add  "apply plugin: 'com.android.application'" to the body of the script to use the plugin.'

 

오류메세지가 길지만 차근차근 뜯어볼까요? 

 

  • 'Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: 
    • InvalidPluginRequestException에서 문제가 발생한 듯 합니다.
  • Plugin 'com.android.application' is already on the script classpath.
    • 'com.android.application' Plugin이 이미 script classpath에 존재한다고 하네요.
  • Plugins on the script classpath cannot be applied in the plugins {} block. 
    • 그러나, 그 script classpath에 있는 Plugins이 plugins {} 블록 안에 적용할 수 없다고 합니다.
  • Add  "apply plugin: 'com.android.application'" to the body of the script to use the plugin.'
    • 그러므로, "apply plugin: 'com.android.application'" 이 문구를 plugins{} 블록 안에 작성하면 될 것 같습니다!

3. 해결 과정

해당 오류를 FIX하기 전에 제가 한 IDE settings

1. [File] -> [Settings] -> [Languages & Frameworks] -> [Android SDK] -> [SDK Flatforms] 에 들어가 Android 6.0 부터 Android 11.0까지 설치합니다 (시간이 꽤나 걸리니 이 점 주의하여 주세요!)

2. [File] -> [Settings] -> [Build, Execution, Deployment] -> [Build Tools] -> [Gradle] 에 들어가서, 프로젝트 당시 사용했던 JDK로 설정을 변경하여 줍니다.

 

그래서 해당 문구를 plugins 블록에 작성하려던 찰나.. 이미 build.gradle(:app) 파일에 작성이 되어 있네요.

 

무엇이 문제일지 고민하던 중.. 학부생 때 저를 꽤나 고생시켰던 plugin과 gradle의 호환 문제가 아닐까 문득 생각이 들었습니다.

 

확인해보니, 다행스럽게도 plugins 버전과 gradle 버전이 호환되지 않았습니다.

 

구글링과 안드로이드 스튜디오 공식 홈페이지를 참고하여 맞추어 주었지만....

 

에러가 하나 더 추가되었습니다 ㅠ.ㅠ

 

Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin 'com.android.internal.application'.

 

Caused by: org.gradle.api.tasks.StopExecutionException: Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory.

 

더 많은 에러는 저를 성장시켜준다는 마음가짐으로 차분하게 해결해 봅시다.

 

두 번째 에러를 확인하니 프로젝트 경로에 아스키 문자로 이루어지지 않은 경로명이 있다는 것 같네요.

 

아.. 생각해보니 수업시간에 교수님께서 프로젝트 경로를 영어로 하지 않으면 에러를 마주할 수 있으니, 프로젝트 경로명을 영어로 하는 것을 추천한다고 하셨던게 떠오르네요..

 

프로젝트 경로를 바꿔줍시다..

 

C 드라이브 하단에 영어로 된 폴더를 생성하고, 제가 열고자 하는 프로젝트를 새로 생성한 폴더에 옮겨주었습니다.

 

이후, 안드로이드 스튜디오에서 새로 생성한 폴더 안에 있는 프로젝트를 'OPEN' 하니....

 

BUILD SUCCESSFUL

 

아... 됐네요... 너무 행복합니다.

 

4. 요약

  • gradle과 plugin의 버전이 서로 호환되는 버전인지 꼭 확인합시다.
  • 안드로이드 스튜디오에서 새로 생성하거나 열람하고자 하는 프로젝트가 위치한 폴더 경로의 폴더 명을 모두 영어로 바꾸어 줍시다.

'Error' 카테고리의 다른 글

[Android Studio-에러] Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module  (0) 2024.05.10
'Error' 카테고리의 다른 글
  • [Android Studio-에러] Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.String java.io.File.path accessible: module java.base does not "opens java.io" to unnamed module
빙봉이
빙봉이
개발 관련 내용 80퍼센트, 저의 일상 내용 20퍼센트로 컨텐츠 비율을 조절하는 중입니다.
  • 빙봉이
    빙봉씨의 개발 블로그
    빙봉이
  • 전체
    오늘
    어제
    • 전체 글 (41)
      • MSA Spring Cloud (3)
      • Java (1)
      • Spring Boot (1)
      • 알고리즘 (9)
      • IDE (4)
      • Error (2)
      • Refactor (1)
      • Debug (1)
      • Front End (1)
      • New Project (9)
        • WorkSphere 360 (6)
        • 모바일 신분증 (1)
        • 나이스 페이먼츠 결제 서비스 연동 (2)
      • 취미 (9)
        • 게임 (8)
        • 애니 (1)
      • 기타 (0)
  • 블로그 메뉴

    • 홈
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    블로그
    나이스페이먼츠 결제
    요구사항 작성
    MSA
    Android Studio
    결제 개발
    결제 API 구현해보기
    Spring
    결제 API
    자료구조
    java
    롤
    데이터베이스 선정 기준
    worksphere 360
    프로젝트 생성 방법
    jira 용어 설명
    SP 서버
    알고리즘
    코딩테스트
    감성
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
빙봉이
[Android Studio-에러] Caused by: org.gradle.plugin.management.internal.InvalidPluginRequestException: Plugin 'com.android.application' is already on the script classpath. Plugins on the script classpath cannot be applied in the plugins {} block. Add ..
상단으로

티스토리툴바