简体   繁体   English

如何将应用程序依赖项包含到Android Studio项目中?

[英]How to include app dependency to Android studio project?

I may be using the wrong terminology for what I am really asking. 对于我真正要问的内容,我可能使用了错误的术语。 But let me describe what I need. 但是,让我描述一下我所需要的。

I have two separate apps, one was made first and the second was made later, but the second app has files that I have copy+pasted over from the first app. 我有两个单独的应用程序,一个是第一个创建的,第二个是后来创建的,但是第二个应用程序具有我从第一个应用程序复制粘贴的文件。 Now, there are separate apps and projects. 现在,有单独的应用程序和项目。 But I was wondering if there is a way to to have 1 project but with 2 apps in it and be able to build/compile them as separate apps? 但是我想知道是否有办法拥有1个项目但其中有2个应用程序,并且能够将它们作为独立的应用程序进行构建/编译? This is so that I wouldn't need to have multiple copies of the same Java code in 2 separate places. 这样一来,我就不需要在2个不同的位置拥有相同Java代码的多个副本。 I want to have the second app dependent on the first one, so that if I were to make a change I wouldn't need to make a change in multiple places. 我想让第二个应用程序依赖第一个应用程序,这样,如果我要进行更改,就无需在多个地方进行更改。

I've googled and search for my problem, but I get solutions for including/adding 3rd party libraries and dependencies (which I already know how to do), but that's not what I need. 我已经在Google上搜索并搜索了我的问题,但是我得到了包括/添加第三方库和依赖项的解决方案(我已经知道该怎么做),但这不是我所需要的。

EDIT: I would need them to generate 2 separate APK files. 编辑:我需要他们来生成2个单独的APK文件。

Since you seem to not want to create your first project as a library, you could set up symbolic links from your second app to the source code of your first. 由于您似乎不想将第一个项目创建为库,因此可以设置从第二个应用程序到第一个应用程序的源代码的符号链接。 They would remain two projects, and the second would link to the source code in the first. 他们将保留两个项目,第二个将链接到第一个中的源代码。

Any shared code you changed in one, would be reflected in the other. 您在其中一个更改的任何共享代码都将反映在另一个中。

I'm assuming you are using Windows, so check this link out. 我假设您使用的是Windows,因此请检查此链接。

https://msdn.microsoft.com/en-us/library/windows/desktop/aa365680(v=vs.85).aspx https://msdn.microsoft.com/zh-CN/library/windows/desktop/aa365680(v=vs.85).aspx

OSX Link: https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/symlink.7.html OSX链接: https : //developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man7/symlink.7.html

As requested. 按照要求。 GIT can save the value of symbolic links. GIT可以保存符号链接的值。 With some configuration it can follow them if that's what's needed. 通过一些配置,可以根据需要进行配置。 Also, you could use a branch in git to accomplish the separation of projects with a shared branch. 另外,您可以在git中使用分支来使用共享分支完成项目的分离。

How does git handle symbolic links? git如何处理符号链接?

Links on branches: 分支机构上的链接:

https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches http://git-scm.com/docs/git-branch https://github.com/Kunena/Kunena-Forum/wiki/Create-a-new-branch-with-git-and-manage-branches http://git-scm.com/docs/git-branch

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

相关问题 将Github项目包含在没有jar或依赖项的Android Studio 2项目中 - Include Github Project into Android Studio 2 project without jar or dependency 将Maven项目添加到Android Studio应用程序作为依赖项 - Adding a Maven Project to an Android Studio App as a Dependency 如何将github库包含到Android Studio项目中 - How to include github library to Android Studio project 如何在Android Studio项目中包含共享库? - How to include shared libraries in android studio project? Gradle:如何将Java项目风味依赖资源包含到Android APK中? - Gradle: How to include Java project flavor dependency resources into Android APK? 如何在Android Studio中的库项目中包含库项目 - How to include library project in library project in Android Studio 如何在Android Studio中的现有Android项目中包含Java库 - How to include java library in existing Android project in Android Studio 如何将jcompilo作为gradle依赖项添加到android studio项目 - How to add jcompilo as a gradle dependency to android studio project 如何将 gradle java 项目作为依赖项添加到 Android Studio - How to add a gradle java project as dependency to Android Studio 如何将Google Core API依赖项添加到Android Studio Gradle项目? - How to add the Google Core API dependency to an Android Studio Gradle project?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM