Hi when we use react-native-webview that needs to
android.useAndroidX=true
android.enableJetifier=true
fast-image build broken (errors below)
Task :react-native-fast-image:processDebugAnnotationsWithJavac FAILED
/Users/in4core/Documents/mac_prj/ednaRn/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageOkHttpProgressGlideModule.java:6: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
/Users/in4core/Documents/mac_prj/ednaRn/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageOkHttpProgressGlideModule.java:41: error: cannot find symbol
@NonNull Context context,
^
symbol: class NonNull
location: class FastImageOkHttpProgressGlideModule
/Users/in4core/Documents/mac_prj/ednaRn/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageOkHttpProgressGlideModule.java:42: error: cannot find symbol
@NonNull Glide glide,
^
symbol: class NonNull
location: class FastImageOkHttpProgressGlideModule
/Users/in4core/Documents/mac_prj/ednaRn/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageOkHttpProgressGlideModule.java:43: error: cannot find symbol
@NonNull Registry registry
^
symbol: class NonNull
location: class FastImageOkHttpProgressGlideModule
/Users/in4core/Documents/mac_prj/ednaRn/node_modules/react-native-fast-image/android/src/main/java/com/dylanvann/fastimage/FastImageRequestListener.java:34: error: package android.support.annotation does not exist
public boolean onLoadFailed(@android.support.annotation.Nullable GlideException e, Object model, Targettarget, boolean isFirstResource) {
^
We also try everything
ext { excludeAppGlideModule = true }
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "+" // default: "+"
firebaseVersion = "+" // default: "+"
excludeAppGlideModule = true
}
also
project.ext.react = [
entryFile: "index.js",
]
ext { excludeAppGlideModule = true }
project.ext { excludeAppGlideModule = true }
Error also appear
Same issue on react-native v0.60.0 RC 0
Unable to get it working on android.
same here
--- Update ---
Since rollback from old version of react-native-webview didn't work for me as well it affect the react-native-gesture-handler, I decided to use the latest version of rn-webview. What I did was manually modified all Old artifact to the latest AndroidX Migration Detail for Androidx.
Before you read the solution keep note that this is the last resort needed if you decided to go for Androidx. We still need to wait for all module owners to adapt on AndroidX for the official packages release.
For rn-fast-image I manually changes this files (NOTE: this might work or might not work for other people and still might show new errors, Please Backup your files)
\node_modules\react-native-fast-image\android\build.gradle
\node_modules\react-native-fast-image\android\src\main\java\com\dylanvann\fastimage\FastImageOkHttpProgressGlideModule.java
I manually change this code(s)
import android.support.annotation.NonNull
to
import androidx.annotation.NonNull
Also you might experience the Glide issue which still use the old code. which is why I updated the build.gradle.
First I update the Glide version to 4.9.0
def _glideVersion = safeExtGet("glideVersion", "4.9.0")
then I also add this in the dependency
annotationProcessor 'androidx.annotation:annotation:1.0.0'
this will force to use the androidx for Glide build files.
Also you need to do this to the other module packages you use on your RN project. Besure to located Old Android import and use the latest AndroidX.
thanks,
I am also experiencing this issue. It's just a matter of migrating the project to AndroidX support library.
An additional problem is that the module generates .java files at build time, which in turn make use of e.g. android.support.annotation.NonNull. This is the reason why you can't just manipulate the module's files and be done with it.
For now, as a workaround, I left the module's files untouched, created a gradle.properties inside /node_modules/react-native-fast-image/android and thus deactivated AndroidX and Jetifier for this module only:
android.useAndroidX=false
android.enableJetifier=false
I am also experiencing this issue. It's just a matter of migrating the project to AndroidX support library.
An additional problem is that the module generates .java files at build time, which in turn make use of e.g.android.support.annotation.NonNull. This is the reason why you can't just manipulate the module's files and be done with it.
For now, as a workaround, I left the module's files untouched and created agradle.propertiesinside/node_modules/react-native-fast-image/androidand deactivated AndroidX and Jetifier for this module:android.useAndroidX=false android.enableJetifier=falseIts not a workaround because more and more modules such as WebView use useAndroidX=true NOW!!!
that's why I'm currently only deactivating it for this module
@Mazzel-13 thanks for the suggested workaround. Are you using Proguard? I'm getting the following seemingly related errors after disabling AndroidX and Jetifier:
Warning: com.dylanvann.fastimage.GlideApp: can't find referenced method 'com.bumptech.glide.RequestManager with(android.support.v4.app.FragmentActivity)' in program class com.bumptech.glide.Glide
Warning: com.dylanvann.fastimage.GlideApp: can't find referenced method 'com.bumptech.glide.RequestManager with(android.support.v4.app.Fragment)' in program class com.bumptech.glide.Glide
@Mazzel-13 thanks for the suggested workaround. Are you using Proguard? I'm getting the following seemingly related errors after disabling AndroidX and Jetifier:
Warning: com.dylanvann.fastimage.GlideApp: can't find referenced method 'com.bumptech.glide.RequestManager with(android.support.v4.app.FragmentActivity)' in program class com.bumptech.glide.Glide Warning: com.dylanvann.fastimage.GlideApp: can't find referenced method 'com.bumptech.glide.RequestManager with(android.support.v4.app.Fragment)' in program class com.bumptech.glide.Glide
I am not using Proguard. Somehow I can't get it minifying to work unfortunately, but that's an issue that I'll be investigating later.
Following @Mazzel-13 suggestion worked, but it's something painful. In my case I had to create gradle.properties in 4 different libraries node_modules/{react-native-broken-lib}/android to get build work.
None of this has worked for me unfortunately
[email protected] supports AndroidX without modifications.
@DylanVann [email protected] will cause IOS crash when open the project.
@nyl9488 this lib crashes on ios. I ended up using react-native-web-image instead
much better!
@micabe @nyl9488 It's working fine on iOS and Android. Please open a new issue including the react-native version and a better description of the error.
adding this helped me:
https://github.com/DylanVann/react-native-fast-image/blob/master/docs/app-glide-module.md
Most helpful comment
@DylanVann [email protected] will cause IOS crash when open the project.