daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

Build warnings: 'string too large to encode using UTF-8...' #93

Closed maniac103 closed 5 years ago

maniac103 commented 5 years ago

As the title says, when building an app using this library the Android Gradle plugin emits the following warning: string too large to encode using UTF-8 written instead as 'STRING_TOO_LARGE'.

When checking the APK using the following command: aapt dump --values resources <PATH_TO_BUILT_APK> | grep -B 1 'STRING_TOO_LARGE' it looks like the culprit are the license texts shipped with the library:

        resource 0x7f100ba3 org.openhab.habdroid:string/license_cc30_licenseDescription: t=0x03 d=0x000026be (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100ba7 org.openhab.habdroid:string/license_cc40_licenseDescription: t=0x03 d=0x0000260a (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100bac org.openhab.habdroid:string/license_gpl_2_0_licenseDescription: t=0x03 d=0x000026c1 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100bb1 org.openhab.habdroid:string/license_gpl_3_0_licenseDescription: t=0x03 d=0x000026c2 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
        resource 0x7f100bb2 org.openhab.habdroid:string/license_gpl_3_0_licenseDescription_2: t=0x03 d=0x000026c4 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100bb6 org.openhab.habdroid:string/license_lgpl_2_1_licenseDescription: t=0x03 d=0x000026c3 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100ba3 org.openhab.habdroid:string/license_cc30_licenseDescription: t=0x03 d=0x00002e13 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100ba7 org.openhab.habdroid:string/license_cc40_licenseDescription: t=0x03 d=0x00002d5e (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100bac org.openhab.habdroid:string/license_gpl_2_0_licenseDescription: t=0x03 d=0x00002e16 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100bb1 org.openhab.habdroid:string/license_gpl_3_0_licenseDescription: t=0x03 d=0x00002e17 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
        resource 0x7f100bb2 org.openhab.habdroid:string/license_gpl_3_0_licenseDescription_2: t=0x03 d=0x00002e19 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"
--
        resource 0x7f100bb6 org.openhab.habdroid:string/license_lgpl_2_1_licenseDescription: t=0x03 d=0x00002e18 (s=0x0008 r=0x00)
          (string8) "STRING_TOO_LARGE"

I wonder whether a better solution were shipping the license files as assets instead?

daniel-stoneuk commented 5 years ago

Gosh that's weird. I'll have a look and keep you updated

daniel-stoneuk commented 5 years ago

Have you tried clearing the build cache? It's just we've never seen this problem before - so this might fix it!

maniac103 commented 5 years ago

I doubt it ;-) as it also happens in Travis: https://travis-ci.org/openhab/openhab-android/builds/549740975#L1856

daniel-stoneuk commented 5 years ago

Yikes! Sorry!

I'll have a look at the open HAB source since the names of these strings (license_lgpl_2_1_licenseDescription) aren't in this repo. I'll check if they're in AboutLibraries

daniel-stoneuk commented 5 years ago

Yeah, looks like this is an issue with AboutLibraries

https://github.com/mikepenz/AboutLibraries/blob/21b13afc9336d9fb55a64636e4e92b63bf304631/library/src/main/res/values/license_lgpl_2_1_strings.xml

I can't see why your PR would break things? Nothing related to AboutLibraries has been changed. Weird.

maniac103 commented 5 years ago

Oops, sorry for taking too quick guesses. I checked the string files in your lib, saw some dealing with licenses and drew my conclusion :-/ Sorry for the noise, and thanks for the quick and helpful replies!

daniel-stoneuk commented 5 years ago

Haha, no problem! Hope you can get the tests passing :)