Android Studio imports the project and module downloaded from github, androidgithub

Source: Internet
Author: User

Android Studio imports the project and module downloaded from github, androidgithub

In the previous eclispe era, we often went to github to browse third-party open-source resources, download them, run samples, and learn third-party Android libraries that we did not have access to. However, in Android Studio, the project downloaded from github, after being imported using as, is prone to many problems and errors, leading to program running failure. (In this article, we will only discuss how the downloaded project runs successfully using as for import, not using maven)

1. Current Environment Description

As description:
Android Studio1.4.1
Buildtools -- 23.0.1
Windows 64bit

Database description:
Android-Universal-Image-Loader 1.9.5 +
(The current download time is)

1. Import the as Library Project downloaded from github. 1. Create a new project on the as, and run it all over the mobile phone or simulator. Then open the project directory we just created.
Create a new project to run successfully. PNG 2. Copy the replacement File

Because the development environment of the library author (as version, sdk version, buildtool, and so on are different from the development environment of our local machine, therefore, the files and folders related to gradle are very different)

What we need to do is try to make the downloaded third-party projects run well in our current environment. Next, let's start.

  • Before proceeding, let's take a look at the files and folders we mainly operate on.

The four files or folders circled below

  • Gradle folder (required)
  • Build. gradle (required)
  • Gradle. properties (required)
  • . Gradle folder (not required) (note the previous .)

Several files/folders to be operated. PNG

Next, let's take a look at the file structure after the downloaded library is decompressed:


Remove the project file structure from github.png

After reading these two images, we will officially work.

We need to copy the 4 files/folders generated by the locally created project mentioned above to the folder decompressed from github for replacement. (I have always deleted it and copied it again)

Note: The gradle folder (required), build. gradle (required), and gradle. properties (required) must be copied.
However, the. gradle folder (the folder with. above) does not need to be copied if it is unzipped from github. Of course, you can copy it and no error will be reported.


Replace file/folder .png

Replace it with that.

3. as import Project

The replaced project can be smoothly imported.

There are two methods:

  • First: Program Interface Import Project
  • Type 2: Open an existing project

File -- New -- Import Project


Import project.png

Welcome to Open an existing project


Open an existing project.png

The two methods have the same effect. The project name is not selected, but the build. gradle file of the selected project, for example:


Select build.gradlefile .png

In this way, you can introduce the project.
However, if such an error is reported after the introduction,

The error is as follows:


Error .png

This is actually a very good solution,
Click Open File
Delete or comment out the bottom apply sentence.
Recompile the program. You can.


Resolution error. PNG

At this time, we can see that the module changes the display app of the app, and the display library of the library is changed.

The successful import has the following results:


Successful import.png

Sample runs successfully


Samplesucceeded in running .png import module

There is nothing to say about this.

File -- New -- Import Module.


Direct import to module.png

Find the library we want to introduce (the Library is also a module concept in)

The module is not as delicate as the project, so it is very convenient to introduce it.

This article is complete.



Text/a min (simplified author)
Link: http://www.jianshu.com/p/1b7209bf0c76
Copyright belongs to the author. For reprinted content, contact the author for authorization and mark "author of simplified book ".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.