# Get android classpath jar files list

**URL:** <https://discuss.gradle.org/t/get-android-classpath-jar-files-list/38567>\
**Category:** Help/Discuss\
**Created:** [December 17, 2020, 10:05pm UTC](https://discuss.gradle.org/t/get-android-classpath-jar-files-list/38567 "2020-12-17T22:05:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AriaMoradi](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ariamoradi/32/8991_2.png) [@AriaMoradi](https://discuss.gradle.org/u/AriaMoradi)\
**Post date:** [December 17, 2020, 10:05pm UTC](https://discuss.gradle.org/t/get-android-classpath-jar-files-list/38567/1 "2020-12-17T22:05:46Z")

</div>

Inside of a android library you can define a main method and android studio prompts you to run it as a console application.

I have written a console application that generates some gradle modules, and as I said I can run said main functions using android studio and now I need to write some kind of bash script to be able to automate this generation process.

How can I write a gradle task(or anything) that prints out which local jar files I need to add to jre classpath?

The problem is discussed in this issue: [https://github.com/tachiyomiorg/tachiyomi-extensions/pull/5154#issuecomment-746929442](https://github.com/tachiyomiorg/tachiyomi-extensions/pull/5154#issuecomment-746929442)  
for more details, here is my code repo: [https://github.com/AriaMoradi/tachiyomi-extensions/tree/libthemesources](https://github.com/AriaMoradi/tachiyomi-extensions/tree/libthemesources)

and the said main class that android studio can run is: “lib/themesources/src/main/java/eu/kanade/tachiyomi/lib/themesources/GeneratorMain.kt”

The process that android studio seemingly goes through is  
1- compile sources which runs this gradle tasks: `:lib-themesources:generateDebugSources :lib-themesources:generateDebugAndroidTestSources :lib-themesources:createMockableJar :lib-themesources:compileDebugAndroidTestSources :lib-themesources:compileDebugUnitTestSources :lib-themesources:compileDebugSources`  
2- somehow It knows which jar files it should include into java classpath and it runs the main function like this:  
`/opt/android-studio/jre/bin/java -javaagent:/opt/android-studio/lib/idea_rt.jar=42159:/opt/android-studio/bin -Dfile.encoding=UTF-8 -classpath /opt/Android-SDK/platforms/android-29/android.jar:/opt/Android-SDK/platforms/android-29/data/res:/home/armor/programming/android/tachiyomi-extensions/lib/themesources/build/intermediates/javac/debug/classes:/home/armor/programming/android/tachiyomi-extensions/lib/themesources/build/intermediates/compile_r_class_jar/debug/R.jar:/home/armor/programming/android/tachiyomi-extensions/lib/themesources/build/tmp/kotlin-classes/debug:/home/armor/programming/android/tachiyomi-extensions/lib/themesources/build/generated/res/resValues/debug:/home/armor/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk8/1.4.10/998caa30623f73223194a8b657abd2baec4880ea/kotlin-stdlib-jdk8-1.4.10.jar:/home/armor/.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.10.0/7ef0f1d95bf4c0b3ba30bbae25e0e562b05cf75e/okhttp-3.10.0.jar:/home/armor/.gradle/caches/modules-2/files-2.1/org.jsoup/jsoup/1.13.1/f9577f3732bb7caa4fee8aba5053158f4010c118/jsoup-1.13.1.jar:/home/armor/.gradle/caches/modules-2/files-2.1/com.github.tachiyomiorg/extensions-lib/a596412/eaa76a7d8891fc26a3839d591d067e9d71a4aa2/extensions-lib-a596412.jar:/home/armor/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-jdk7/1.4.10/30e46450b0bb3dbf43898d2f461be4a942784780/kotlin-stdlib-jdk7-1.4.10.jar:/home/armor/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib/1.4.10/ea29e063d2bbe695be13e9d044dcfb0c7add398e/kotlin-stdlib-1.4.10.jar:/home/armor/.gradle/caches/modules-2/files-2.1/com.squareup.okio/okio/1.14.0/102d7be47241d781ef95f1581d414b0943053130/okio-1.14.0.jar:/home/armor/.gradle/caches/modules-2/files-2.1/org.jetbrains.kotlin/kotlin-stdlib-common/1.4.10/6229be3465805c99db1142ad75e6c6ddeac0b04c/kotlin-stdlib-common-1.4.10.jar:/home/armor/.gradle/caches/modules-2/files-2.1/org.jetbrains/annotations/13.0/919f0dfe192fb4e063e7dacadee7f8bb9a2672a9/annotations-13.0.jar eu.kanade.tachiyomi.lib.themesources.GeneratorMain`

---

<div class="post-metadata">

**Author:** ![AriaMoradi](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/ariamoradi/32/8991_2.png) [@AriaMoradi](https://discuss.gradle.org/u/AriaMoradi)\
**Post date:** [December 17, 2020, 10:24pm UTC](https://discuss.gradle.org/t/get-android-classpath-jar-files-list/38567/2 "2020-12-17T22:24:12Z")

</div>

One solution I found is this: [https://stackoverflow.com/questions/38139639/how-to-get-local-jar-dependency-in-gradle](https://stackoverflow.com/questions/38139639/how-to-get-local-jar-dependency-in-gradle)  
but doesn’t work in newer versions of gradle.

I also found that the solution might be related to `configurations.debugCompileOnly.files` or `configurations.debugCompileOnly.asFileTree` but again its deprecated.
