简体   繁体   中英

How to open a project in eclipse ADT and automatically import LIbrary Projects dependencies

Just started developing android apps using Eclipse ADT. I've never used Eclipse before so not sure if this is an ADT specific question or an eclipse question.

So I started by creating a new project. I have another project that I would like to use as a project library, so I copied that into the libs folder. My project now looks something like this

MyApp
  libs
    OtherProject
  res
  src
  ...

I then imported the OtherProject as an existing project and set it as a library. Now my package explorer contains two projects: MyApp, and OtherProject

I then right-clicked --> Properties on my main project, went to Android, and then added the other project as a library.

Everything works.

I pushed it to a repository and then cloned it to a separate folder to verify that everything still works.

Now, I'm not sure what to do here to open the project, so I went and imported the newly checked out project, but it says its missing the OtherProject dependency, and I can see that it wasn't automatically added to the package explorer.

What is the proper way to open a project?

我遇到了类似的问题,但是我通过将库项目和其他项目都导入到相同的工作空间中来解决了此问题(在导入时使用复选框将副本添加到工作空间中)

You dont copy projects to libs folder. It is for jar files only. Import the project you wantto use as a library into eclipse as any other project (copy project to workspace optional) and then add the imported project as a library for your project.

I'm not sure what is the artifact of the build for your OtherProject will give, but i'll assume it's a jar file.

You can copy the jar into the libs folder of your MyApp project and configure it in your build path. Once the build is successful, add the jar file to your source control (by right click on the file -> Team -> Add to Source Control) and check in BOTH the jar file and the project .classpath file (you should see them in your check in dialog).

Once this is done, you can checkout a new copy of the project, and verify that the libs folder does contains the jar and the build path is correct. Then you should be good to go.

Hope this helps.

There is no way to tell Eclipse to automatically import the library project as an Eclipse project when you import the main project. You will always need to import the main project, then import the library project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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