[英]Android Studio reuse module library at other project
I have a module with some POJO classes that is marked at gradle as apply plugin: 'java' .Is there a way to reuse it at another project ? 我有一个带有一些POJO类的模块,该模块在gradle处标记为apply plugin:'java'。是否有办法在另一个项目中重用它? Everything i tried failed . 我尝试的一切都失败了。 (I dont want to copy pasta it) (我不想复制面食)
I was facing the same issue recently. 我最近面临着同样的问题。
This is how I resolved the code redundancy problem: 这是我解决代码冗余问题的方法:
` `
apply plugin: 'maven'
group = 'com.<example>'
version = '1.0'
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///Users/<myuser>/.m2/repository")
}
}
}
` `
Hope this helps. 希望这可以帮助。
Here are two other questions on the same matter. 这是关于同一问题的另外两个问题。
How do I add a library project to Android Studio? 如何将库项目添加到Android Studio?
How to create a library project in Android Studio and an application project that uses the library project 如何在Android Studio中创建库项目以及使用该库项目的应用程序项目
Personally I didn't use any of the two provided methods. 我个人没有使用提供的两种方法中的任何一种。 I built my project as a JAR, added it to the 'libs' folder, right clicked on it and clicked 'Add as library' and then finally added the dependency in the gradle file like so: 我将项目构建为JAR,将其添加到“ libs”文件夹中,右键单击它,然后单击“添加为库”,然后最终将依存关系添加到gradle文件中,如下所示:
dependencies {
compile files('libs/MyJAR.jar')
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.