React-native-fast-image: Execution failed for task ':react-native-fast-image:compileDebugJavaWithJavac'.

Created on 20 Jun 2019  路  13Comments  路  Source: DylanVann/react-native-fast-image

Any solution for this?
These are my dependencies.

"react-native": "^ 0.58.6",
"react-native-fast-image": "^ 6.0.3",

Most helpful comment

I was able to work around this error by following this guide to disable the glide module, which is the module that has the erroneous generated content:

android/build.gradle

project.ext {
    excludeAppGlideModule = true
}

This is obviously not ideal, I'm unsure what side effects disabling this may cause. Would be great to update the module to support jetifier.

All 13 comments

I need this resolved too
"react-native": "^0.59.9",
"react-native-fast-image": "^6.0.3",

Same errors.
I think it is related to AndroidX issues

Same errors.
I think it is related to AndroidX issues

Yes I think so. Google introduced some change a few days ago that seems to force AndroidX compatibility. I'm going to have to drop fast-image temporarily and revert to the standard Image until this is addressed.

I just add this package to my project and it compiles without errors.
"react-native": "0.59.8",

What should I do to reproduce this error ?

May be I have an older android target sdk version ?

@JeremyBradshaw7 you could try the props fallback to use legacy Image.
https://github.com/DylanVann/react-native-fast-image#fallback-boolean

I'm not sure why but many java's file in android/build folder of react-native-fast-image still creating file with some old build artifact for example android.support.annotation.NonNull instead of androidx.annotation.NonNull

I was able to work around this error by following this guide to disable the glide module, which is the module that has the erroneous generated content:

android/build.gradle

project.ext {
    excludeAppGlideModule = true
}

This is obviously not ideal, I'm unsure what side effects disabling this may cause. Would be great to update the module to support jetifier.

same error

I get the same error if I use [email protected] with [email protected].
Probably this is due to the lack of support for AndroidX and, as @adamterlson has already said, a jetifier support is needed
@DylanVann any update on this?

A little bit of error:

> Task :react-native-fast-image:compileDebugJavaWithJavac FAILED
Gradle may disable incremental compilation as the following annotation processors are not incremental: jetified-compiler-4.7.1.jar (com.github.bumptech.glide:compiler:4.7.1).
Consider setting the experimental feature flag android.enableSeparateAnnotationProcessing=true in the gradle.properties file to run annotation processing in a separate task and make compilation incr
emental.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
66 actionable tasks: 58 executed, 8 up-to-date
Note: /Users/apple/Desktop/[APP_NAME]/node_modules/@react-native-community/slider/android/src/main/java/com/reactnativecommunity/slider/ReactSliderManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: [2] Wrote GeneratedAppGlideModule with: [com.bumptech.glide.integration.okhttp3.OkHttpLibraryGlideModule, com.dylanvann.fastimage.FastImageOkHttpProgressGlideModule]
/Users/apple/Desktop/[APP_NAME]/node_modules/react-native-fast-image/android/build/generated/source/apt/debug/com/dylanvann/fastimage/GlideOptions.java:6: error: package android.support.annotation do
es not exist
import android.support.annotation.CheckResult;

[email protected] supports AndroidX without modifications.

@DylanVann completely agreed ! But this is leading to Xcode crash.Can we have any workaround for this.

@trinadhkoya this lib crashes on ios. I ended up using react-native-web-image
much better!

For those struggling with 7.0.0, I came up with the solution to use 6.0.3 and keep Android running.
Checked with RN 0.59.10, but it should probably work with 0.60.x and above

  • Under android dir of your project add gradle.properties
android.useAndroidX=true
android.enableJetifier=true

This is required to use AndroidX and convert libraries in your project. (By the way you may also want to use https://github.com/mikehardy/jetifier for converting RN project to support AndroidX)

  • Under android dir of your project, open build.gradle and set glideVersion to 4.8.0 on your project. For example
buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 16
        compileSdkVersion = 28
        targetSdkVersion = 28
        supportLibVersion = "28.0.0"
        glideVersion = "4.8.0"  // Add this
    }
...
}

This will over write the setting in FastImage.

  • inside react-native-fast-image/android/build.gradle change below:
// Comment out this
//    implementation("com.github.bumptech.glide:annotations:${_glideVersion}") {
//        exclude group: "com.android.support", module: "annotations"
//    }
    annotationProcessor "androidx.annotation:annotation:1.1.0" // Add this

You might want to write a post install script to rewrite the setting above.

com.github.bumptech.glide:annotation is where the annotation processing is generating com.android.support.NonNull we use androidx.annotation instead.

@tomoima525
Thanks! It worked.

I used https://github.com/ds300/patch-package for patching react-native-fast-image/android/build.gradle automatically on every yarn install.
It works like a charm.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

skleest picture skleest  路  3Comments

mschipperheyn picture mschipperheyn  路  3Comments

clay-morgan picture clay-morgan  路  3Comments

jslok picture jslok  路  3Comments

NgocNamFNT picture NgocNamFNT  路  3Comments