react-native-doc-viewer icon indicating copy to clipboard operation
react-native-doc-viewer copied to clipboard

Error with module when react-native run-android

Open uendar opened this issue 5 years ago • 7 comments

node_modules\react-native-doc-viewer\android\src\main\java\com\reactlibrary\FileProviderClass.java:3: error: package android.support.v4.content does not exist public class FileProviderClass extends android.support.v4.content.FileProvider { ^ C:\Users\EndarUliu\Desktop\H\node_modules\react-native-doc-viewer\android\src\main\java\com\reactlibrary\RNReactNativeDocViewerModule.java:34: error: package android.support.v4.content does not exist import android.support.v4.content.FileProvider; ^ C:\Users\EndarUliu\Desktop\H\node_modules\react-native-doc-viewer\android\src\main\java\com\reactlibrary\RNReactNativeDocViewerModule.java:338: error: cannot find symbol Uri contentUri = FileProvider.getUriForFile(context, reactContext.getPackageName()+".docViewer_provider", result); ^ symbol: variable FileProvider location: class RNReactNativeDocViewerModule.FileDownloaderAsyncTask 3 errors

uendar avatar Jun 18 '19 15:06 uendar

I think this it's due the android x update. Facing the same problem.

javiersuazo avatar Jun 24 '19 15:06 javiersuazo

android x update , How to solve???

levenies avatar Jul 04 '19 14:07 levenies

hi, you can try 1. Convert your app to AndroidX via the standard AndroidX migration 2. npm install --save-dev jetifier 3. npx jetify 4. npx react-native run-android (your app should correctly compile and work) 5. Call npx jetify run in the postinstall target of your package.json (Any time your dependencies update you have to jetify again)

aybarsyalcin avatar Jul 08 '19 08:07 aybarsyalcin

@aybarsyalcin, it didnt work for me. @javiersuazo @levenies did you found a solution?

zivchen avatar Aug 14 '19 08:08 zivchen

having the same issue any solution for this?

Base29 avatar Mar 03 '20 07:03 Base29

preBuild.doFirst {
    ant.replaceregexp(match: 'android.support.v4.content', replace: 'androidx.core.content', flags: 'g', byline: true)
            {
                fileset(dir: '../../node_modules/react-native-doc-viewer/android/src/main/java/com/reactlibrary/', includes: '*.java')
            }
}

Under android/app/build.gradle file

Add between android and dependencies

Grewer avatar Mar 05 '20 11:03 Grewer

@Grewer Thanks, you save lot

pratius avatar Oct 25 '21 12:10 pratius