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:
Asked
Active
Viewed 1,211 times
2 Answers
0
if you want add LICENSE.txt into your android library (aar). you should do two things:
- add your LICENSE.txt to your project, path: src/main/resources/META-INF(other resources folders are acceptable as well)
- add "android {packagingOptions{ merge '**/LICENSE.txt'}" into your xxx(sdkname)/build.gradle file.
the keyword merge means add all matching files to your aar

Chentao Zhou
- 1
- 1
-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
-
How I can add LICENSE.txt to .jar in gradle? – Nikolay Jan 21 '20 at 16:26
-
@Nikolay, see this answer[https://stackoverflow.com/a/18533986/5705408]. – Lenoarod Jan 21 '20 at 18:15