다음을 통해 공유


Android용 .NET 경고 XA1028

예제 메시지

warning XA1028: The 'AndroidEnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.
error XA1011: Using ProGuard with the D8 DEX compiler is no longer supported. Please set the code shrinker to 'r8' in the Visual Studio project property pages or edit the project file in a text editor and set the 'AndroidLinkTool' MSBuild property to 'r8'.

문제

프로젝트는 현재 D8 DEX 컴파일러를 사용하도록 구성되었으며 최신 MSBuild 속성에 true 대해 AndroidLinkTool 설정된 값 없이 이전 AndroidEnableProguard MSBuild 속성이 설정되어 있습니다. ProGuard 코드 축소기가 더 이상 D8 DEX 컴파일러와 호환되지 않으므로 XA1011 오류가 발생합니다.

솔루션

  1. Visual Studio 또는 다른 텍스트 편집기에서 프로젝트 파일을 편집하고 이전 <AndroidEnableProguard> 요소를 모두 제거합니다.

  2. 프로젝트 파일을 저장한 후 평소와 같이 Visual Studio에서 열고 Visual Studio 프로젝트 속성 페이지의 코드 축소기를 r8설정하거나 텍스트 편집기에서 프로젝트 파일을 계속 편집하고 MSBuild 속성을 다음으로 r8설정합니다AndroidLinkTool.

    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
      <AndroidLinkTool>r8</AndroidLinkTool>
    </PropertyGroup>
    

경우에 따라 R8은 ProGuard에 비해 새 빌드 경고 또는 오류를 생성할 수 있으므로 프로젝트에 대한 ProGuard 규칙은 이 변경 후에 나타나는 새 경고 또는 오류를 해결하기 위해 몇 가지 업데이트가 필요할 수 있습니다.