MasterofProject

Studio Fresco import Android

Label Android DevelopmentStudio Android
1412 people read comment(0) Collection report
Classification:

About a week before Facebook open source designed for customized Android system image download cache tool day the news on the headlines of major technology forum website, has become the main topic for each technology group discussion of the. And on the same dayStay4itQQ group inside someone trying to use Android Studio import Fresco, toss about half a day or failed, the occurrence of this situation more than one person, a lot of people have encountered such a problem, the import is not successful, the compiler can not, let alone run. Just two days before the Tomb Sweeping Day holiday, I have a curious mood also try to find a really very troublesome, but the final success of the compiler to run. First share the effect of sample run chart, seduce you:

Fresco_sample

  

Now put my import process to share with you, I hope you do not take detours. I was thinking about it.Studio Android series video courseInside and then an additional class to explain the introduction of Fresco specifically, but would like to think or decide to write a blog to share with you, the reason why we look down to know.

First introduce the system and the environment of my computer:

  • Pro Macbook
  • Yousemite
  • Studio Android 1.2 beta (just to upgrade, most people should still be 1.1 version)
  • 2.2.1-all Gradle

In addition, you need to downloadNDK Android, and the path of the NDK Android configuration to the environment variables inside, the specific download and configuration I will no longer describe here, as a good programmer these are not the problem, remember FQ oh.

Believes that the most of the friends with the windows system, but because I have abandoned windows for too long, the home windows machine has passed his sixtieth year, has also been terminally ill, so there would be no attempt on the windows system, but fromFresco on Github IssuesIn point of view, the import of Windows is still a problem, at least in my writing this article is not yet resolved. Because the Facebook team is using Mac or Linux to develop, so the Windows has not been tested, so there will be a variety of bug, there is aGithub on the open issue WindowsWe can refer to or real-time follow-up.

Well, let us continue to view on how to import Mac, first of all, willFrescoDown from clone Github.Here to remind you that the whole process is best to import FQ, because in the import and the back of the build, there is a part of the resources must be FQ to access the. And import and build process is more time consuming, you need to download a lot of relevant resources, so it is best to ensure that they are in good condition of the network to try to import. This is the main reason why I did not record video courses.Open Android Studio, select Project Import, as shown in figure:

Fresco_as_import

Fresco clone you down the path, click OK, then there is a long time download and import process, as shown in Figure:

Fresco_importing

This is a long process, this time you can do something else, play a game or at restFresco Chinese documentationAnd so on, in the process of importing the main resources to download:

  1. The project relies on the jar package (each build.gradle in the module file is dependent on the jar package, jcentral or Maven).
  2. A wide variety of plug-ins (including the gradle 1.0.1 plug-in, JVM based automated testing tools robolectric plug-ins, etc., a lot)

When you resources downloaded into the main interface of Android Studio after you have been successful in half. The next step is build,Here we have to pay special attention to, can only use the command line for build, you can not use the menu bar above the project build->make or project rebuild, because the use of the latter build will fail.I ran into a newspaper that was wrong:

Fresco_gui_build

Of course, below the situation that encounters the wrong I also tried the past search solutions, GitHub is such a issue] about [MAC into the build, there are people referred to the NDK path build.gradle imagepipeline module of the blending into the absolute path to your local, I try the look, or failed, error I will no longer put up, I think there is a bug, interested friends can look at just mentioned the issue.

Since GUI build does not work, we use the command line to build, the terminal tab Android studio in the lower left corner of the open, check the terminal path is not fresco project root directory, because gradlew and gradle wrapper in the root directory of the project. Then run clean clean will project./gradlew once, maybe you will encounter such a mistake:

Fresco_terminal_clean_failed

It doesn't matter, without him, we can manually clean, each module in the build folder to delete it, in fact, clean process. After we can run the build./gradlew, the whole process can be divided into three stages of the build:

  1. Is also a round of download, mainly imagepipeline needs some resources, such as the figure:

    Fresco_terminal_build_download

  2. All resources download will enter the clonewebp phase after the success, this phase will last for some time, and no log appears in the command line, as shown in Figure 1:

    Fresco_terminal_build_clonewebp

    Note that in the process of clonewebp, if you do not have FQ, then there may be such a mistake, as shown in figure:

    Fresco_terminal_build_clonewebp_failed

    Everybody will see why they fail, chromium related resources, from googlesource to download

  3. There is also a common problem will occur, that is, to cancel the error lint problem, as shown in figure:

    Fresco_terminal_build_linterror

    The solution is very simple, that is, in the build.gradle imagepipeline file in the Android code blocks to add as shown in the following code:

    Fresco_linterror_solution

History of the three stages, you build should succeed and build the whole process should be in about 10 minutes, to tell you the truth, I first met build such a long time of engineering. After the success of the build should be like the following figure:

Fresco_terminal_build_succeed

Well, when you get to this step, the introduction of fresco also completed the, I congratulate you on your success. Next, we're going to run about.

Fresco_sample_fresco

Fresco_sample_spinner

Everybody can through the spinner just pick a loading tool to download all the pictures and GIF, then switching loading tools were compared.You will find that the Fresco cache loading efficiency is much higher than the commonly used Picasso and imageloader, and the effect is too obvious.As for the download speed I personally feel that the difference is not large, this is related to the network environment, even if the same network environment should not be the gap between the speed of download.

This is I import the fresco of the whole process, time is limited, general ability, if where there is to explain the error, or you have a better solution, please give me a message and we discuss discussion.

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
    • Visit47492 times
    • Integral:Two thousand two hundred and fifteen
    • Grade
    • Rank:10324th name
    • Original180
    • Reproduced:37
    • Translation:1
    • Comments:13
    Latest comments