facebook/fresco

Adding Fresco source into a react-native-maps project to debug it

Open

#2,059 opened on Feb 26, 2018

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Java (3,750 forks)batch import
help wanted

Repository metrics

Stars
 (17,072 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Description

Image component of react-native can be used in react-native-maps projects when adding custom markers.

However, it cannot render custom markers on Android API 25 and later. (It means that markers [Image components] are rendered on Android 7.0 and connot be rendered on Android 7.1)

I realized that onError, onLoad and onLoadEnd events are never fired on Android 7.1 although they are fired on Android 7.0. (The events are emitted in com.facebook.drawee.controller classes)

To track these clues I need to add Fresco source on a react-native-maps project and to build it. However I got stuck at this step.

When trying to build from source it throws the following exception:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':ReactAndroid'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':ReactAndroid:_debugPublish'.
      > Configuration with name 'default' not found.
   > Could not resolve all dependencies for configuration ':ReactAndroid:compile'.
      > Configuration with name 'default' not found.

I wonder that is there any chance to overcome this issue?

Original react-native-maps issue is over here.

Also a question has been opened on stackoverflow days ago.

I'm really not good at gradle.

Reproduction

  1. Download Fresco 1.3.0 repo into the root directory of the project
  2. Add Fresco into a react-native-maps project by following steps:
  • modifiying settings.gradle file
include ':fresco'
project(':fresco').projectDir = new File(rootProject.projectDir, '../fresco')
  • adding fresco project into dependencies section of the project's build.gradle file
compile project(':fresco')
  • modifying react-native/ReactAndroid/build.gradle file (Also tried to add sub-projects of Fresco directly as is in samples )
dependencies {
    ...
    //compile 'com.facebook.fresco:fresco:1.3.0'
    //compile 'com.facebook.fresco:imagepipeline-okhttp3:1.3.0'

    compile project(':fresco')

    // The lines below shows how sub-projects are being added directly but I could not manage
    //include ':drawee' 
    //project(':drawee').projectDir = new File(rootProject.projectDir, '../fresco/drawee')
    //include ':fbcore'
    //project(':fbcore').projectDir = new File(rootProject.projectDir, '../fresco/fbcore')
    //include ':imagepipeline'
    //project(':imagepipeline').projectDir = new File(rootProject.projectDir, '../fresco/imagepipeline')
    //include ':imagepipeline-base'
    //project(':imagepipeline-base').projectDir = new File(rootProject.projectDir, '../fresco/imagepipeline-base')
    //include ':imagepipeline-okhttp3'
    //project(':imagepipeline-okhttp3').projectDir = new File(rootProject.projectDir, '../fresco/imagepipeline-backends/imagepipeline-okhttp3')
}
  1. Build the project by using the command of react-native run-android.
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':ReactAndroid'.
> Failed to notify project evaluation listener.
   > Could not resolve all dependencies for configuration ':ReactAndroid:_debugPublish'.
      > Configuration with name 'default' not found.
   > Could not resolve all dependencies for configuration ':ReactAndroid:compile'.
      > Configuration with name 'default' not found.

Solution

[OPTIONAL: Do you know what needs to be done to address this issue? Ideally, provide a pull request which fixes this issue.]

Additional Information

  • Fresco version: 1.3.0
  • Fresco 1.3.0 gradle version: 2.3.0
  • The project gradle plugin version: 2.2.3
  • Platform version: Android 7.1 on Samsung J5 (6) and Android Emulator

Contributor guide