简体   繁体   English

android studio 3.5:我可以将运行配置导出到jar吗?

[英]android studio 3.5: can I export run configuration to jar?

In Ecliplse we could export executable jar from any class with static main() method. 在Ecliplse中,我们可以使用静态main()方法从任何类中导出可执行jar。 I've made a lot of utilities that way, using main app engine in-place. 这样,我就可以使用主应用程序引擎来开发许多实用程序。 But in Android Studio 3.5 I didn't found an easy way to do the same. 但是在Android Studio 3.5中,我没有找到一种简单的方法来进行相同的操作。 Does it exist? 是否存在? As a temporary solution I use Application target (in Run configurations) and it works the same, but how to export it as jar? 作为一个临时解决方案,我使用“应用程序目标”(在“运行”配置中),并且其工作原理相同,但是如何将其导出为jar?

Yes, it is possible you can just go to File -> New -> New Module 是的,您可能只需要转到File-> New-> New Module

then select Java Library, choose a name and hit finish. 然后选择Java库,选择一个名称,然后单击完成。

Then you will see a new Module in your Project View. 然后,您将在项目视图中看到一个新的模块。

You can then go to your Gradle View and go under YOUR NEW CREATED MODULE -> Tasks -> build and then just double click on build. 然后,您可以转到Gradle视图并在“ 新创建的模块”下 ->“任务”->“构建”下,然后双击“构建”。

Then it should have generated a .jar file which you can easily search in Windows Explorer for just go to your Project Path \\ YOUR NEW CREATED MODULE \\ build\\libs 然后它应该已生成一个.jar文件,您可以在Windows资源管理器中轻松搜索该文件,只需转到您的项目路径\\ 您的新创建的模块 \\ build \\ libs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM