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:
- Find Project Address
- Click "download zip"
- Unzip to a directory
- Open Android Studio
- Import Project
- Sync Gradle
- Run the project
- Select a device to run
- 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:
- git Clone project Address
- Open reading source with sublime (or Atom, vim) lightweight editor
- 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;
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:
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
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;
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;
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