Programing

Android Studio 프로젝트를 빌드 할 때 Stacktrace 또는 디버그 옵션을 추가하는 방법

lottogame 2020. 7. 2. 07:46
반응형

Android Studio 프로젝트를 빌드 할 때 Stacktrace 또는 디버그 옵션을 추가하는 방법


콘솔 출력에서 ​​프로젝트 빌드 오류를 다음과 같이 조사하려고했습니다.

:myapp:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
...
...

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

리소스를 찾을 수 없음 오류와 관련이 있다고 생각합니다. 내 질문은 IDE 수준 에서 디버깅하기 위해 더 많은 정보를 생성 할 수 있도록 추가 --stacktrace하거나 --debug옵션을 어떻게 사용할 수 있습니까?


GUI를 사용하여 이러한 gradle 명령 줄 플래그를 추가 할 수 있습니다

File > Settings > Compiler (Gradle-based Android Project)

MacOS 사용자의 경우 여기에 있습니다

Android Studio > Preferences > Build, Execution, Deployment > Compiler

이처럼 (추가 --stacktrace또는 --debug)

여기에 이미지 설명을 입력하십시오

(주 스크린 샷은 0.8.10 앞에서 즉, 옵션은 없습니다 더 이상Compiler > Gradle그것은라는 별도의 섹션에서 현재 섹션 것 Compiler (Gradle-based Android Project))


Mac버전에서는 Android Studio Beta 1.2아래에 있습니다.

Android Studio->preferences->Build, Execution, Deployment->Compiler


Android Studios 2.1.1에서 명령 행 옵션은 "빌드, 실행, 배치"> "컴파일러"에 있습니다.

여기에 이미지 설명을 입력하십시오


스택 트레이스를 추가하려면 Android 프로젝트 화면의 오른쪽에있는 Gradle을 클릭하십시오.

  1. 설정 아이콘을 클릭하십시오. 설정 페이지가 열리고
  2. 그런 다음 컴파일러를 클릭하십시오
  3. 그런 다음 --stacktrace또는 명령을 추가하십시오 --debug.

  4. gradle 보고서를 얻으려면 응용 프로그램을 다시 실행하십시오.


디버깅 목적으로 사용하는 것은 터미널에서 직접 stacktrace로 gradle 작업을 실행하는 것입니다. 그런 다음 일반 컴파일에는 영향을 미치지 않습니다.

터미널을 통해 프로젝트 루트 디렉토리에서 다음을 사용할 수 있습니다.

./gradlew assembleMyBuild --stacktrace

(2018 년 12 월 편집 : Mac에서도 Android Studio 3.2.1)

Mac의 Android Studio 3.1.3의 경우

Android Studio-> 환경 설정-> 빌드, 실행, 배포-> 컴파일러

스택 추적을 보려면이 버튼을 누릅니다.

스택 추적을 표시하는 버튼


my solution is this:

configurations.all {
    resolutionStrategy {
        force 'com.android.support:support-v4:27.1.0'
    }
}

For Android Studio 3.1.3 it was under

File -> Settings -> Build, Execution, Deployment -> Compiler


To be able to run options like --stacktrace within a gradle command, you need to put it at the beginning, like:

./gradlew --stacktrace assembleMyBuild


In case you use fastlane, additional flags can be passed with

gradle(
   ...
   flags: "{your flags}"
)

More information here


To Increase Maximum heap: Click to open your Android Studio, look at below pictures. Step by step. ANDROID STUDIO v2.1.2

Click to navigate to Settings from the Configure or GO TO FILE SETTINGS at the top of Android Studio.

여기에 이미지 설명을 입력하십시오

check also the android compilers from the link to confirm if it also change if not increase to the same size you modify from the compiler link.

Note: You can increase the size base on your memory capacity and remember this setting is base on Android Studio v2.1.2

참고 : https://stackoverflow.com/questions/21674091/how-to-add-stacktrace-or-debug-option-when-building-android-studio-project

반응형