Teach you the best way to read the Open source project posture

Source: Internet
Author: User

I believe that since watching my GitHub tutorial a lot of people began to fall in love with GitHub, and some people do not brush the micro Bo, know it does not brush, changed to brush GitHub, and brush the exhilaration. This is a good thing to know more about open source projects and to improve the efficiency of your project. But what I want to tell you is that you are not in the right position to read the Open source project, today teaches you the most cock posture.

First of all, here the "reading" is a generic, for Android, in addition to reading and running the demo to see the effect of the project.

Look at the General people's reading of the Open source project posture is how:

    1. Find Project Address
    2. Click "download zip"
    3. Unzip to a directory
    4. Open Android Studio
    5. Import Project
    6. Sync Gradle
    7. Run the project
    8. Select a device to run
    9. Delete the downloaded zip file

You're not like this, are you? The efficiency is too low.

On the one hand is cumbersome, of course, there may be some people with Git to replace the download, slightly reduced the point of step, on the other hand, Android Stduio eat memory, light start up a lot of time, not to mention the import, compile, run, we actually develop is to use, but if just to read the source, Looking at the effect of running Android Stduio is too expensive, and often many times it is possible to read more than one project at the same time, opening multiple Android Stduio Windows is a big test of the computer.

Take a look at the steps of my reading source:

    1. git Clone project Address
    2. Open reading source with sublime (or Atom, vim) lightweight editor
    3. Run view effects with the Gradle command line

Is the step greatly simplified? There is also no need to open the Android Studio this memory machine, and with this lightweight editor to open how many projects to open how many projects, the third direct command line compilation, run more cool.

Many people will certainly ask the third step of the specific process, this is the key point. The following direct list of some of the key points of this step, it is not explained in detail, have seen my Gradle article should understand.

    • 1. First check the Gradle version of the Open source project, the Buildtools version, and the Compile SDK version to ensure that the three OK is good;

    • 2. Use the project's built-in Gradle wrapper to compile and package:

./gradlew Clean
./gradlew Assembledebug

These two steps can be compiled, packaged, and then manually installed yourself;

    • 3. Compile package, install can actually merge:

      ./gradlew Clean
      ./gradlew Installdebug

These two steps are installed directly on your device, do not need to install manually, is it more convenient and fast?

Then someone asked, is there a step to download, compile, package, run can be done? You're really lazy, but I have to tell you that!

There is a project on GitHub called Dryrun can meet your requirements, translated I call it "dry run", this translation is straightforward!

Just install the tool and execute a command directly:

$ dryrun [email protected]:cesarferreira/android-helloworld.git

The above Android demo can be installed directly on your device, is not a crazy cool hanging bombing days?

But it's essentially the same as my own step, except that it merges it through a ruby script.

It is worth noting that:

    1. Dryrun is a gem, it is based on Ruby, if you do not know about Ruby, the local did not install Ruby toss up quite a lot of trouble, it is easy to install:

      Gem install Ruby

    2. If you want to run an Android project on GitHub on the gradle version of the catalog, the Buildtools version and the Compile SDK version are inconsistent with your local, then the run fails;

    3. Its practical value is not so high, is used to install force, suitable for me and understand Ruby and understand Android at the same time like to pretend to force people;

    4. Interested may wish to toss under, not interested in you should learn my second way, very practical, high efficiency, you deserve to have!

Well, that's it.

The original published in the public number Androiddeveloper,id:googdev, welcome to pay attention to get more original dry!

Teach you the best way to read the Open source project posture

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.