在Android Studio中将外部Android和Java项目添加到Android项目 [英] Adding external Android and Java projects to Android projects in Android Studio

查看:130
本文介绍了在Android Studio中将外部Android和Java项目添加到Android项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我们已经从Eclipse迁移到新的Android Studio IDE(知道它是早期版本)。直到昨天,当我们更新到0.1.1时,一切都非常精彩,它取消了Project Structure UI界面,并用告诉我们使用gradle的消息取而代之。

因此,我们开始阅读文档,SO帖子并观看了 Google I / O介绍。我们仍然不明白这是如何工作的。



我们已阅读本用户指南,就像我说过的,无数的SO帖子。但不能得到这个工作。



所以我们有2个项目。他们都是Android项目。两者都使用外部项目。其中一个使用Facebook Android SDK,另一个使用自定义的直接Java项目。 Java项目不断更新。

java项目是在Eclipse中创建的,并且具有该文件夹结构。

这两个Android项目都是在Android Studio中新建的。我们如何做到这一点?



库项目是否需要自己的build.gradle文件?

是否需要将库项目放置在与我们的Android项目相同的文件夹?



根据这些问题的答案,build.gradle和settings.gradle文件需要看起来如何?





澄清:

>
Android项目A需要使用Facebook SDK外部库

Android项目B需要使用我在Eclipse中创建的外部Java项目 >

项目A和B都是在Android Studio中创建的



问题:

●什么需要进入Project Build.gradle文件?

●Facebook SDK需要在哪里?

●Facebook SDK是否需要build.gradle文件?如果是这样,它需要说什么?



●需要进入Project B的build.gradle文件?

●Java在哪里项目需要去?

●这个java项目需要一个build.gradle文件吗?如果是这样,它需要说什么?



●Facebook SDK或java项目是否需要settings.gradle文件?

解决方案

请前往 http ://tools.android.com/tech-docs/new-build-system ,从名为gradle-samples-0.4.2.zip的页面底部下载zip



检查libsTest示例

设置gradle构建文件后,您需要为Android Studio做额外的工作,因为它不会从build.gradle

So, we have been migrating from Eclipse to the new Android Studio IDE (knowing that it's an early release version). Everything was splendid until yesterday when we updated to 0.1.1, which removed the Project Structure UI interface, replacing it with a message telling us to use gradle.

So we began reading documentation, SO posts and watched the Google I/O presentation. We still don't understand how this works.

We've read this user guide and, like I said, countless SO posts. But can't get this to work.

So we have 2 projects. Both of them are Android projects. Both use external projects. One of them uses the Facebook Android SDK and the other uses a custom, straight up java project. The java project is continually being updated.
The java project was created in Eclipse and has that folder structure.
Both of the Android Projects were created fresh in Android Studio. How do we do this?

Do the library projects need their own build.gradle files?
Do the library projects need to be placed in the same folder as our Android Projects?

And depending on the answer to those questions, how do the build.gradle and settings.gradle files need to look?

[EDIT]
For clarification:

Facts:
Android Project A needs to use the Facebook SDK external library
Android Project B needs to use an external java project I created in Eclipse
Projects A and B were both created in Android Studio

Questions:
● What needs to go into Project A build.gradle file?
● Where does the Facebook SDK need to be?
● Does the Facebook SDK need a build.gradle file? If so, what does it need to say?

● What needs to go into Project B build.gradle file?
● Where does the java project need to go?
● Does this java project need a build.gradle file? If so, what does it need to say?

● Does the Facebook SDK or the java project need a settings.gradle file?

解决方案

go to http://tools.android.com/tech-docs/new-build-system, download zip from the bottom of the page named gradle-samples-0.4.2.zip

check libsTest example

After you setup gradle build files you need to do extra hoop for Android Studio as it doesn't pickup changes from build.gradle

这篇关于在Android Studio中将外部Android和Java项目添加到Android项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆