0

I Have aar project and I want to add license to jar file. I add licence to .pom file, but I want add it to jar and get structure like this:

enter image description here Is it possible add LICENSE.txt to .jar by gradle?

Nikolay
  • 344
  • 1
  • 15

2 Answers2

0

if you want add LICENSE.txt into your android library (aar). you should do two things:

  1. add your LICENSE.txt to your project, path: src/main/resources/META-INF(other resources folders are acceptable as well)
  2. add "android {packagingOptions{ merge '**/LICENSE.txt'}" into your xxx(sdkname)/build.gradle file.

the keyword merge means add all matching files to your aar

-1

here is the jar document describes:

JAR file is a file format based on the popular ZIP file format and is used for aggregating many files into one. A JAR file is essentially a zip file that contains an optional META-INF directory

the META_INF function is that:

The META-INF directory, if it exists, is used to store package and extension configuration data, including security, versioning, extension, and services.

so I think you should put it int the META_INF files. you can see this answer get some solution.

Lenoarod
  • 3,441
  • 14
  • 25