1

I've built Fresco and copied the created *.jar packages into libs folder that is placed in the root directory of ReactAndroid project like the following:

directory setup:

- node_modules
  - ReactAndroid
    - libs
      - drawee-1.3.0-sources.jar
      - fbcore-1.3.0-sources.jar
    - src
      - main
        - java
        - libraries
    - build.gradle

build.gradle file:

...
dependencies {
    ...
    compile (name:'drawee-1.3.0-sources', ext:'jar')
    compile (name:'fbcore-1.3.0-sources', ext:'jar')
    ...
}

allprojects {
    repositories {
        flatDir {
            dirs 'libs', './libs'
        }
    }
}
...

When trying to run the command of ./gradlew installDebug it throws errors for the all classes that are added in *.jar packages like the below:

/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java:13: error: package com.facebook.common.logging does not exist

import com.facebook.common.logging.FLog;

However FLog class is present in fbcore-1.3.0-sources.jar package. (at com/facebook/common/logging/FLog.java path)

Is there any chance to overcome this issue?


Edit:

Using *.aar packages instead of *.jar has solved the issue.

efkan
  • 12,991
  • 6
  • 73
  • 106
  • You can't use `sources` jars (with `.java` files) as dependencies. Either add the jar with the compiled library (with `.class` files) or add the source files to a source set to compile them. – Lukas Körfer Feb 27 '18 at 07:12
  • @lu.koerfer thank you very much. Could you please show me an example? It could be an answer if you prefer. – efkan Feb 27 '18 at 08:11
  • Is this what you meant? -> https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javac.html – efkan Feb 27 '18 at 08:15
  • Is there any specific reason for you to build Fresco from source instead of using the [provided compiled version](http://frescolib.org/docs/index.html)? Did you modify Fresco source code? – Lukas Körfer Feb 27 '18 at 08:16
  • Yes exactly I have a big reason (https://github.com/react-community/react-native-maps/issues/1870) unfortunately... – efkan Feb 27 '18 at 08:18
  • If I can use *.jar files in a project I can show some console logs I put. Maybe I'll figure the issue out. Hopefully... – efkan Feb 27 '18 at 08:22
  • Well, the main problem is that you are simply using the wrong `.jar` files. If you execute `gradlew build`, it should create compiled versions of the libraries, you can either copy them manually to your project, include the projects into your own Gradle project or use a [composite build](https://docs.gradle.org/current/userguide/composite_builds.html). – Lukas Körfer Feb 27 '18 at 08:33
  • Amm.. After building these folders have been created `generated`, `intermediates`, `libs` (contains jar files `fbcore-debug.aar` and `fbcore-release.aar`), `outputs` (contain __`aar`__ file), `reports`, `test-results` and `tmp`. So, should I use `aar` file instead `jar` in this case? – efkan Feb 27 '18 at 08:37
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/165875/discussion-between-lu-koerfer-and-efkan). – Lukas Körfer Feb 27 '18 at 08:44

0 Answers0