[英]How do I use Clojure in Android Studio using Graclj?
My ultimate goal is to be able to write Clojure apps for Android, using Android Studio and Cursive. 我的最终目标是能够使用Android Studio和Cursive为Android编写Clojure应用程序。 I started with leiningen but found out that it is a build system that is independent of what Andoid Studio uses ie Gradle.
我从leiningen开始,但发现它是一个独立于Andoid Studio使用的构建系统,即Gradle。 So I tried leiningen with Intellij, but couldn't get Android deploys to work except from the command line.
所以我用Intellij尝试了leiningen,但除了命令行之外,无法让Android部署工作。 Since I wanted to integrate with Android Studio, I decided to try Graclj: https://github.com/graclj/graclj which is a Gradle plugin for Clojure.
由于我想与Android Studio集成,我决定尝试使用Graclj: https : //github.com/graclj/graclj这是Clojure的Gradle插件。
I can get the Graclj tutorial running in Android Studio, as per this guide: https://github.com/graclj/learning-graclj/tree/learning-0.1.0 根据本指南,我可以在Android Studio中运行Graclj教程: https : //github.com/graclj/learning-graclj/tree/learning-0.1.0
However: 然而:
So, can anyone suggest a way that I can hook into Andoid Studio's build process? 那么,任何人都可以建议一种方法,我可以挂钩Andoid Studio的构建过程吗?
I have looked at the Android Studio build process: http://developer.android.com/tools/building/configuring-gradle.html but I don't know enough about Gradle to know what I'm supposed to be doing here. 我看过Android Studio构建过程: http : //developer.android.com/tools/building/configuring-gradle.html但我不太了解Gradle知道我应该在这里做什么。
If I need to supply any more info, just ask. 如果我需要提供更多信息,请询问。
Any help appreciated! 任何帮助赞赏!
Unfortuantely, I don't have any Android (let alone Android Studio) experience. 不幸的是,我没有任何Android(更不用说Android Studio)的经验了。 However, I'll do my best to answer based on Gradle/Graclj knowledge.
但是,我会尽力根据Gradle / Graclj的知识回答。
Graclj does not require you to use the root project. Graclj不要求您使用根项目。 You can apply the plugin(s) in any of the projects that you have in your build.
您可以在构建中的任何项目中应用插件。 However, I don't know how well a model-based plugin like Graclj will work with the "traditional" Android plugin.
但是,我不知道像Graclj这样的基于模型的插件将如何与“传统”Android插件一起使用。 You could try the "experimental" one that's using the model approach, though there's a decent chance that it won't be compatible unless there's one that works with Gradle 2.12.
您可以尝试使用模型方法的“实验性”方法,尽管除非有一个适用于Gradle 2.12的方法,否则它将不太可能兼容。
Alternatively, you might be able to add a dependency to the Android app project on the JAR produced by Graclj (which you may still want to put in a project besides the root). 或者,您可以在Graclj生成的JAR上为Android应用程序项目添加依赖项(您可能仍希望将其放在除根之外的项目中)。 Not sure if there's a very good way to do this (haven't tried myself).
不确定是否有一个非常好的方法来做到这一点(没有尝试过自己)。
dependencies {
// my-other-proj being whichever one you use Graclj in
compile project(':my-other-proj')
}
Or maybe you would need to add it to a configuration first in the my-other-proj
to interop with traditional plugins: 或者您可能需要首先在
my-other-proj
中将其添加到配置中以与传统插件互操作:
artifacts {
archives createMainJar
}
It is possible that you're at a dead end (for now). 你有可能处于死胡同(现在)。 Graclj is very new, so this stuff should all be possible eventually.
Graclj非常新,所以这些东西最终都应该是可能的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.