• EnglishEspañol日本語한국어Português
  • 로그인지금 시작하기

사용자의 편의를 위해 제공되는 기계 번역입니다.

In the event of any inconsistency between the English version and the translated version, the English versionwill take priority. Please visit this page for more information.

문제 신고

Android 앱용 ProGuard 또는 DexGuard 구성

Android 에이전트로 ProGuard 또는 DexGuard를 지원하려면 다음 지침을 따르십시오. Android 호환성 및 요구 사항을 확인하고 이전에 Android 에이전트 SDK를 설치한 경우 ProGuard 또는 DexGuard를 사용하여 최신 버전으로 업그레이드하기 전에 단계를 따르세요.

ProGuard 구성

ProGuard 에 대한 지원을 추가하려면:

  1. 앱에 제외를 추가합니다. 예를 들어:

    • New Relic 계측을 지원하려면 keep class 를 추가하십시오.
    • 해결되지 않은 문제와 관련된 경고를 비활성화하려면 dont warn 을 추가합니다.
    • 충돌 보고를 위해 줄 번호를 유지하려면 LineNumberTable 을 추가합니다.
    • 처리된 예외에 대한 스택 정보를 보존하려면 SourceFile 를 추가하고 EnclosingMethod.
  2. ProGuard 구성 파일 ( proguard.cfg , proguard-android.txt , proguard-rules.pro 등)에 다음을 추가합니다.

    -keep class com.newrelic.** { *; }
    -dontwarn com.newrelic.**
    -keepattributes Exceptions, Signature, InnerClasses, LineNumberTable, SourceFile, EnclosingMethod
    ##
    ## NewRelic Gradle plugin 7.x may require the following additions:
    ##
    # Retain generic signatures of TypeToken and its subclasses if R8 version 3.0 full-mode is enabled.
    # https://r8.googlesource.com/r8/+/refs/heads/master/compatibility-faq.md#r8-full-mode
    -keepattributes Signature
    -keep class com.newrelic.com.google.gson.reflect.TypeToken { *; }
    -keep class * extends com.newrelic.com.google.gson.reflect.TypeToken
    # For using GSON @Expose annotation
    -keepattributes *Annotation*
  3. 프로젝트를 정리하고 다시 빌드하십시오.

  4. 에뮬레이터나 기기에서 앱을 실행하여 모바일 앱의 개요 페이지 에서 데이터를 확인하세요.

  5. 선택사항:모바일 앱을Settings [맞춤설정할 수] 있는 설정 페이지입니다.

데이터가 표시되지 않으면 logcat 출력에서 오류를 검토하세요.

이 문서가 설치하는데 도움이 되셨나요?

네트워크 라이브러리 지원

ProGuard가 코드를 난독화하기 전에 New Relic 계측이 발생합니다. 이러한 라이브러리를 적절하게 계측하려면 해당 클래스가 ProGuard에 의해 난독화되어서는 안 됩니다.

다음은 이러한 클래스를 보존하기 위해 적용할 규칙의 예입니다. 이것은 완전한 목록이 아닙니다. 라이브러리 또는 버전에 따라 다른 규칙이 필요합니다.

도서관

규칙

아파치 HTTP

-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**

OkHttp 2

-keep class com.squareup.okhttp.* { *; }
-dontwarn com.squareup.okhttp.**
-dontwarn okio.**

OkHttp 3

-keep class okhttp3.** { *; }
-dontwarn okhttp3.**
-dontwarn okio.**

개조 2

-keep class retrofit2.** { *; }
-dontwarn retrofit2.**

DexGuard 구성

DexGuard는 ProGuard와 동일한 구성 옵션을 사용하며 기존 ProGuard 구성 파일을 읽을 수 있습니다. 또한 DexGuard에는 자체 추가 구성 옵션 세트가 있으며 많은 공통 앱 프레임워크에 대한 샘플 구성을 제공합니다.

DexGuard 에 대한 지원을 추가하려면:

  1. 앱에 DexGuard를 추가하고 DexGuard의 지시에 따라 Gradle 플러그인을 설정합니다.

  2. 특정 DexGuard 구성 옵션을 보관할 dexguard-project.txt 파일을 만들고 다음을 추가합니다.

    -dontnote com.newrelic.agent.android.NewRelic
    -dontnote com.newrelic.agent.android.harvest.crash.Crash
  3. DexGuard 플러그인을 구성한 후 다음을 확인하십시오.

    DexGuard 8.x: 앱의 buildTypes 구성이 다음과 유사한지 확인합니다.

    buildTypes {
    release {
    minifyEnabled false
    shrinkResources false
    proguardFile getDefaultDexGuardFile('dexguard-release.pro')
    proguardFile 'proguard-rules.pro'
    proguardFile 'dexguard-project.txt'
    }
    ...
  4. 프로젝트를 정리하고 다시 빌드하십시오.

  5. 에뮬레이터나 기기에서 앱을 실행하여 모바일 앱의 개요 페이지 에서 데이터를 확인하세요.

  6. 선택 사항: 모바일 모니터링 설정 페이지를 사용 하여 모바일 앱을 사용자 지정합니다 .

데이터가 표시되지 않으면 logcat 출력에서 오류를 검토하세요.

Copyright © 2024 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.