简体   繁体   中英

Android Studio how to update module

I made a library and added to my other project as module. The library is not perfect and I have to change some stuff there sometimes. But the changes are not seen in my other project and I have to delete the module and add them again. Is there an other way to hold the module up to date all time I make changes there?

I had a similar situatuon some time ago when I had to extract some code from my project and make a library which will be shared between the old and a new projects. I'm using Mercurial to store the codebase, so it was natural to use subrepositories for this purpose.
Basically, subrepository is a nested repository which is used by some main repository. Whenever I make the change in the subrepo, I commit it, push to the bitbucket repo, and after that I can run hg pull and hg update from the main repo (I prefer pressing Ctrl + T from Android Studio). Every time you update the nested repo, main repo stores the info about the subrepo revision currently used in the .hgsubstate file, so if you want to try something out in the old revision of your project, Mercurial knows which subrepo revision it has to use with this old version.
Similar functionality can be found in Git also. I don't know about other vcs with the subrepository support (wasn't interested in them).

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