facebook / litho

A declarative framework for building efficient UIs on Android.
https://fblitho.com
Apache License 2.0
7.69k stars 763 forks source link

Failed to compile with React Native #565

Open rocwind opened 5 years ago

rocwind commented 5 years ago

Version

React Native: 0.60.3 Litho: 0.29.0

configurations.all {
    exclude group: 'com.facebook.yoga', module: 'yoga'
}

dependencies {
    implementation fileTree(dir: "libs", include: ["*.jar"])
    implementation 'androidx.appcompat:appcompat:1.0.0'

    implementation "com.facebook.react:react-native:+" // From node_modules

    // Litho
    implementation 'com.facebook.litho:litho-core:0.29.0'
    implementation 'com.facebook.litho:litho-widget:0.29.0'
    annotationProcessor 'com.facebook.litho:litho-processor:0.29.0'

    // SoLoader
    implementation 'com.facebook.soloader:soloader:0.5.1'
}

Issues and Steps to Reproduce

It prompts below error message that complains conflicts on DoNotStrip

AGPBI: {"kind":"error","text":"Program type already present: com.facebook.proguard.annotations.DoNotStrip","sources":[{}],"tool":"D8"}

FAILURE: Build failed with an exception.

Screen Shot 2019-07-17 at 11 50 15

colriot commented 5 years ago

This seems like a duplicate of #224. Can you try suggested config and reach back if it works or not?

configurations.all {
    exclude group: 'com.facebook.yoga', module: 'yoga'
    exclude group: 'com.facebook.litho', module: 'litho-annotations'
}
rocwind commented 5 years ago

Thank you for looking into this issue.

By adding exclude group: 'com.facebook.litho', module: 'litho-annotations', it still doesn't work, but shows below error message instead:

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Could not instantiate annotation processor 'com.facebook.litho.specmodels.processor.ComponentsProcessor'
khatv911 commented 5 years ago

Got the same issue with

Execution failed for task ':adaptiveLitho:compileDebugJavaWithJavac'.
> Could not instantiate annotation processor 'com.facebook.litho.specmodels.processor.ComponentsProcessor'
xfumihiro commented 4 years ago

RN: 0.61.5 Litho: 0.33.0

compiles after comment out the exclusion of infef-annotation but hit with another issue

configurations.all {
  exclude group: 'com.facebook.yoga', module: 'yoga'
//   exclude group: 'com.facebook.infer.annotation', module: 'infer-annotation'
  exclude group: 'com.google.code.findbugs', module: 'jsr305'
}