alwx/react-native-photo-view

react-native-photo-view is causing APK build failure

Opened this issue · 1 comments

rum-n commented

My react-native-photo-view version is 1.5.2
My RN version is 0.63.4

The error I'm getting when trying to create an APK:

> Task :react-native-photo-view:compileReleaseJavaWithJavac FAILED /[...]/app/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/ImageEvent.java:12: error: package android.support.annotation does not exist import android.support.annotation.IntDef; ^ /[...]/app/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/ImageEvent.java:21: error: cannot find symbol @IntDef({ON_ERROR, ON_LOAD, ON_LOAD_END, ON_LOAD_START, ON_TAP, ON_VIEW_TAP, ON_SCALE}) ^ symbol: class IntDef location: class ImageEvent /[...]/app/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/PhotoView.java:7: error: package android.support.annotation does not exist import android.support.annotation.NonNull; ^ /[...]/app/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/PhotoView.java:60: error: cannot find symbol @NonNull ResourceDrawableIdHelper resourceDrawableIdHelper) { ^ symbol: class NonNull location: class PhotoView /[...]/app/node_modules/react-native-photo-view/android/src/main/java/com/reactnative/photoview/PhotoView.java:143: error: cannot find symbol public void maybeUpdateView(@NonNull PipelineDraweeControllerBuilder builder) { ^ symbol: class NonNull location: class PhotoView Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 5 errors

Any help would be greatly appreciated.

Please Add the following two flags to true in your gradle.properties file at ProjectFolder/android/gradle.properties
android.useAndroidX=true
android.enableJetifier=true

run below command
npm install --save-dev jetifier

add the following to scripts your package.json
"postinstall" : "npx jetify"

this will solve the problem of android annotation