philipphecht / react-native-doc-viewer

React Native Doc Viewer (Supports file formats: xls,ppt,doc,xlsx,pptx,csv,docx,png,jpg,pdf,xml,binary ...)
MIT License
94 stars 116 forks source link

Error with module when react-native run-android #132

Open uendar opened 5 years ago

uendar commented 5 years ago

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

javiersuazo commented 5 years ago

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

levenies commented 5 years ago

android x update , How to solve???

aybarsyalcin commented 5 years ago

hi, you can try

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

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

Base29 commented 4 years ago

having the same issue any solution for this?

Grewer commented 4 years ago
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

pratius commented 3 years ago

@Grewer Thanks, you save lot