What is the <module>/release/output.json generated by Android Studio

Sah picture Sah · May 26, 2017 · Viewed 10.8k times · Source

I recently noticed a new file generated at <module>/release/output.json by Android Studio 3 Canary 1 each time I run Build -> Generate Signed APK..., which has contents that look like following.

Can anyone confirm seeing this behavior as well? Or is it due to some local configuration on my laptop?

And can anyone explain the purpose of this file? Is it safe to add to .gitignore?

[{
  "outputType": {
    "type": "APK"
  },
  "apkInfo": {
    "type": "MAIN",
    "splits": [],
    "versionCode": 32
  },
  "outputFile": {
    "path": "/path/to/the/generated/release/filename.apk"
  },
  "properties": {
    "packageId": "com.example.android",
    "split": ""
  }
}]

Answer

Wubbalubbadubdub picture Wubbalubbadubdub · Nov 7, 2017

Android studio 3.0 is responsible for this file. You don't need to worry about the output.json file.

Let me explain this to you:

For older versions, what Android Studio did was generate a signed APK and put it in the "output" folder. Even If you had multiple flavour dimensions for your APK, all of them could be located at the same directory, which was the output folder. From the latest release of Android Studio 3.0 (canary and stable), they have organized this file structure. For every flavour dimension, whenever you sign an APK, it will have a separate folder with a corresponding output.json file in it. This file is actually nothing but a description of the source APK. As you can see, the file you shared here is describing the released APK.