I am trying to download a dependancy library mylibrary.aar
from my gitlab
repository via gradle
. I understand that we dont have any closures/methods in gradle to directly get files from a http
url.
Therefore am using ant
's getmethod to download the library from gitlab
.
Here is the code am using in my gradle
file to get the library.
task downloadlib {
ant.get(src: 'https://my-git-link/mylibrary.aar', dest: 'libs', verbose: 'on')
}
dependencies {
compile(name: 'mylibrary', ext: 'aar')
}
Problem :
The files which I download via the ant's get method seems to be corrupted/does not go through the download process properly. Not sure what goes wrong. The library does not get compiled and the dependencies cannot be resolved. When I try to extract the aar
it again extracts to cgpz
file in my mac.I havent tried in windows though.
However, if I manually download the same aar
file and reference it in the libs folder it works absolutely fine.
- Any idea why does this happen?
- Is there any other way to download a
aar
file from a gitlab server apart fromant.get
?
Any help on this is much appreciated.
Note : I cannot use a locally built dependancy as all my libraries are on different repo and the project requirement mandates the same.Also, the code cannot be posted in github and thats the reason I did not choose jitpack
The same problem occurs for jar
files as well.