android studio with Java compiler error: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'

后端 未结 16 1275
北恋
北恋 2020-12-03 06:45

When I clean the android project in android studio, the error happen, I have backed to previous commit or different branch, which works find couple days ago, but has this er

16条回答
  •  春和景丽
    2020-12-03 07:04

    You can use AAPT (from the android sdk/build-tools) to examine the APK and look for the offending string with the following command line (Linux):

    // Linux/Mac
    ./aapt dump --values resources MyAppName-regular-debug.apk | grep -B 1 'STRING_TOO_LARGE'
    
    // Windows
    aapt dump --values resources MyAppName-regular-debug.apk | grep -B 1 'STRING_TOO_LARGE'
    

    Which should point you to the culprit. In my case it was:

    resource 0x7f0f015a com.example.app:string/eula: t=0x03 d=0x00000f10 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
    

提交回复
热议问题