Tag: Google Play Services

Problems with the new GPS Automatic License Notice Generator

Following up on my previous post, here’s a screenshot of the OSS license item for the popular Glide library as generated by version 11.2.2 of the new GPS OSS tools. There are two distinct OSS licenses for the Glide library and the GPS OSS tools finds both of them. But it concatenates the two URLs without a space or line break in between. They’re just stuck together:

To fix that, I added a gradle hack which runs after the app’s preBuild gradle task. The code block, placed at the bottom of build.gradle, carries out a specific edit within third_party_licenses (a text file generated by the OSS gradle plugin):

    String thirdPartyLicenseFilePath = 'app/src/main/res/raw/third_party_licenses'
    File thirdPartyLicenses = new File(thirdPartyLicenseFilePath)
    if (thirdPartyLicenses.exists()) {
        String contents = thirdPartyLicenses.getText('UTF-8')
        contents = contents.replace("licensehttp://", "license http://")
        thirdPartyLicenses.setText(contents, 'UTF-8')
    } else {
        println "cannot find " + thirdPartyLicenseFilePath

Sure enough, the hack adds a space between the two urls:

But there’s a new problem: the ‘t’ at the very end of the second url is no longer present. (Look closely. The url points to a ‘.tx’ file instead of a ‘.txt’ file).

On one of my android devices, it appears that there’s a 92 character length limit on that string. Or something. I have yet to discover where that limit is set.


GPS Library’s New Automatic OSS License Notice

This will save developers work and eliminate errors in the process.

Google Play Services now offers an automatic way to list the open source software an app uses. The app developer no longer has to maintain a separate list of libraries in a dialog.

Instead, the new GPS Open Source Software gradle plugin will gather info from each library for you. If you add a new OSS library, this plugin will automatically add it to the notice. It’s one less task to remember.

The actual UI displays each library’s name as an item in a ListView. This is what it looks like (as of version 11.2.0):

(Note that I set that activity’s title to a custom string.)

When the user clicks an item, it displays some detailed info for that library. In this version, the info appears to be just an http URL to the license’s main online text:

Questions are handled at StackOverflow.