MasterofProject

AndroidStudio project export third party libray package as a dependency Library

label Android DevelopmentAndroidStudioLibrary
49 people read comment(0) Collection report
Classification:

These days when doing the project, the team of colleagues in order to facilitate the development of new features, to our AndroidStudio project add the a dependent library and colleagues when submitted to the SVN code, because of the arrangement of the submitted to the block of code management, not the.Gradle documents submitted, cause I when updating the project, project error. Because beginning with AndroidStudio as a development tool also soon, so all of a sudden don't know where to start, toss for nearly an hour, to find their own way + Baidu, and now finally straightened out. In fact, just need a very simple code can be very simple, think about all feel a little ashamed.

First look at the project directory, which is already OK after the project structure, which hit the red circle of the libray Library (named after the project is not standardized) is our new addition to the library library:


Add a successful libary icon is a folder with columnar graphics, did not add success before the column is not with graphics, is an empty folder.

In the beginning I the wrong way is: File-->Project structure add module or libary. This is increased just added an external reference is used by the library dependencies, I now the situation is to update the SVN code and library dependencies have been saved. So this one doesn't work.


Later on the Internet to find the information, the original to do is not the image above, the correct and simple approach is:

1, open the entire project configuration gradle file: Settings.gradle:

Add in file:Include': library', where include is the meaning of the reference, library is our new libary dependency library file name:


2 open the build.gradle file of the main project, the configuration of the dependency Library in the file, add the following code:

Dependencies {
Project compile (': library')
}
. after adding the above Shangbu code, finally only need to click AndroidStudio the toolbar in the sync project with Gradle file button to build what you can, such as buttons below the red circle.


The completion of the above 3 steps, will be accomplished.

top
Zero
step on
Zero
Guess you're looking for
View comments
* the above user comments only represent their personal views, does not represent the views or position of the CSDN website
    personal data
    • visit50657 times
    • Integral:Two thousand three hundred and eighteen
    • Grade
    • Rank:9635th name
    • original187
    • Reproduced:37
    • Translation:1
    • Comments:13
    Latest comments