List local files in libs folder in Android

android

(Rahul) #1

Hi all,

I am trying to create a json file with all the dependencies of my the projects.

Before I ask the actual question, let me tell you the reason for this:
The reason why I am doing this is, while creating Android AAR files, gradle files are removed. So when we have lot of AAR files and being used in multiple projects, its really a challenge to track and manage all version conflicts and complications of multiple dependencies.
So the plan is to create a json file for each project and put this json when ever the build/AAR is created. Later when some one use this AAR file, a gradle task will extract this json and cross check with the versions of all the dependencies and list down challenges like using of lower versions or higher versions etc…this way we can keep track of exact version usage of all dependencies across dependencies

So I am. using the following to get the list of all dependencies of a project, but its listing all those added as compile 'xyzzy.xyz,xyz' and not the jar files added locally. I have the local jars added as follows :

 compile files('libs/ormlite-android-5.0.jar')
 compile files('libs/commons-io-2.5.jar')

  project.configurations.compile.resolvedConfiguration.firstLevelModuleDependencies.each { dep ->
                def name = dep.module.id.name
                def version = dep.module.id.version
                def group = dep.module.id.group

                String value =  name + ":" + version+ ":"+group+"
               println(value)
            }

Also, I would like to get the type of the dependencies, like ‘JAR’, ‘AAR’ etc. with the above code, I could only get name, group, version

I am not sure whether I am doing this in the right way, probably its a hard way… please guide me…

help is appreciated, thanks in advance

Happy coding …