Questions about Studio Import fresco

Source: Internet
Author: User

It took two days to import fresco into studio successfully, and there was a lot of problems in the middle of the stackoverflow and there was no useful answer.

The main problem is that the NDK is obsolete and will be supported in future releases

Solutions: 1. Install NDK (version as latest as possible) configure NDK Environment

Add ndk.path=f\:\\android-ndk-r10c(your NDK installation address) to the last line of gradle.properties in 2.imagepipeline module


3. Add ndk.dir=f\:\\android-ndk-r10c and Sdk.dir=f\:\\studio_sdk_first to the Local.properties file for the entire project


4. Run Gradlew clean in studio command line (lower left corner terminal) and run Gradlew build


The following article is a reference to http://www.cnblogs.com/stay/p/4398432.html

About a week ago, Facebook was open-source for the Android system to customize the image download Cache tool, the news that day on the major Technical Forum website headlines, but also become the main topic discussed in various technical groups. Also in the same day Stay4it QQ group inside someone tried to use Android studio to import fresco, toss a half day or failure, this situation occurs more than one person, many people have encountered such problems, import unsuccessful, compile not, let alone run. The first two days of the Ching Ming Festival holiday, I have a curious mood also tried once, found that it is really troublesome, but eventually succeeded in compiling the run. First share the sample run, seduce you:

??

Now put my import process to share to everyone, I hope you do not detours. I would have thought that in my Android Studio video course to add an additional class to specifically explain the introduction of fresco, but think about it or decide to write a blog to share to everyone, the reason we look down on the know.

First introduce my Computer system and the environment:

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

In addition you need to pre-download the Android NDK, and the path of the Android NDK to configure the environment variables inside, specific download and configuration I no longer described here, as a good programmer these are not problems, remember FQ oh.

?? I believe most of my friends are using Windows, but since I've abandoned windows for too long, my home windows machine has been wrong side and so sick that I haven't tried on windows, but from fresco issues on GitHub, There is still a problem with the import of Windows, at least not when I wrote this article. Since Facebook's teams are all developed using Mac or Linux, there are no tests on windows, so there are a variety of bugs, and there's a GitHub open issue on windows that you can refer to or follow up on in real time.

?? OK, let's continue to see how the Mac is imported, first, clone the fresco from GitHub. here to remind you that the entire import process is best FQ, because in the import and later build, some of the resources must be FQ to access. And the process of importing and build is time consuming and requires downloading a lot of related resources, so it's a good idea to make sure you try to import when the network is healthy. This is the main reason why I did not record a video course. Open Android Studio, select Import Project,

?? Choose your clone down the path of the fresco, click OK, Next is a long time to download and import process,

?? This is a long process, this time you can do something else, play a game to rest or to see Fresco's Chinese documents and the like, the import process of the main download resources are:

    1. The jar packages that are dependent on the project (the jar packages that are dependent on the Build.gradle file in each module, jcentral, or maven)
    2. A wide variety of plugins (including 1.0.1 Gradle plug-ins, JVM-based automated test tools Robolectric plugins, etc.)

?? Once you've downloaded all your resources into the main interface of Android studio, you're halfway through. The next step is build, where it is important to note that you can only build with the command line, not using Build->make project or Rebuild project on the menu bar, because using the latter build will fail. I encountered an error such as:

?? Of course, in the case of the above error I also tried to search the solution, GitHub on the [MAC import build issue], there is a reference to the Imagepipeline Module of the Build.gradle in the NDK path all into your local absolute path, I tried, or failed, the specific error I no longer posted, I think there is still a bug, interested friends can pay attention to the issue just mentioned.

?? Since the GUI build doesn't work, let's build with the command line, open the Terminal tab in the lower left corner of Android Studio and check if the terminal path is the root of the fresco project because Gradlew and Gradle Wrapper are in the root directory of the project. Then run./gradlew Clean to clean the project, you may encounter such errors:

?? It's OK, don't worry about him, we can do manual clean, the build folder in each module is deleted, in fact, the clean process is so. We can run it after we delete it./gradlew build, the entire build process can be divided into three phases:

  1. Another round of download, mainly in the imagepipeline need some resources,

  2. All resources Download successful and then enter the CLONEWEBP phase, which will last for a period of time, and no log appears at the command line,

    Note that in the process of CLONEWEBP, if you do not have FQ, there may be such a mistake,

    Everyone can see why the failure, chromium related resources, need to go from googlesource to download

  3. There is also a common problem that can occur, is to cancel the lint error,

    The solution is simply to add the code as shown in the Android code block in the Imagepipeline build.gradle file:

?? After the above three stages, your build should be successful, and the whole build should be around 10 minutes, to be honest, I've seen this project for the first time in a long build. After the build succeeds, it should be as follows:

?? Well, when you get to this step, fresco's import has also been completed, congratulations on your success, let's run a bit:

?? You can choose a loading tool by spinner to download all the pictures and GIFs, and then switch the loading tool for comparison, you will find that the fresco cache load efficiency than we commonly used Picasso and Imageloader too much, the effect is too obvious. As for the download speed I personally feel that the difference is not small, this is related to the network environment, even if the same network environment download speed should be small.

Questions about Studio Import fresco

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.