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: package com.philipphecht does not exist #100

Open mghifariyusuf opened 6 years ago

mghifariyusuf commented 6 years ago

I installed it like this docs and run react-native run-android in terminal. And I got BUILD FAILED with this log in terminal:

:app:compileDebugJavaWithJavac /Users/ghifari/docviewer/android/app/src/main/java/com/docviewer/MainApplication.java:15: error: package com.philipphecht does not exist import com.philipphecht.RNReactNativeDocViewerPackage; ------------------------^ 1 error Incremental compilation of 1 classes completed in 0.442 secs. :app:compileDebugJavaWithJavac FAILED

dopey2 commented 6 years ago

@mghifariy same problem I solve this by changing import com.philipphecht.RNReactNativeDocViewerPackage; to import com.reactlibrary.RNReactNativeDocViewerPackage; I've also delete android/build & android/app/build before running react-native run-android

mghifariyusuf commented 6 years ago

@Dani93380 thanks, that was nice solution. but I didn't use this package again, recommend use RNFB file stream ^^

sabun123 commented 5 years ago

@dopey2 Just wanted to say thanks for pointing us in the right direction.

I was experiencing this issue with Android as well after manually linking following the instructions on the main page (which seem to be outdated?).

> Task :app:compileDebugJavaWithJavac FAILED
/<redacted>/MainApplication.java:18: error: package com.phil
ipphecht does not exist
import com.philipphecht.RNDocViewerPackage;
                       ^
/<redacted>/MainApplication.java:43: error: cannot find symb
ol
            new RNDocViewerPackage()
                ^
  symbol: class RNDocViewerPackage
2 errors

Changing the package name in MainApplication.java like you suggested from:

import com.philipphecht.RNDocViewerPackage;

To:

import com.reactlibrary.RNReactNativeDocViewerPackage;

fixed one error, but left the remaining one:

> Task :app:compileDebugJavaWithJavac FAILED
/<redacted>/MainApplication.java:44: error: cannot find symbol
            new RNDocViewerPackage()
                ^
  symbol: class RNDocViewerPackage
1 error

I then changed

new RNDocViewerPackage()

To this instead:

new RNReactNativeDocViewerPackage()

Now it builds just fine on Android. I'm not sure about the long term implications of these changes though as I'm not familiar with native Android development.

My project details (react-native info):

  React Native Environment Info:
    System:
      OS: macOS 10.14.1
      CPU: x64 Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
      Memory: 60.31 MB / 8.00 GB
      Shell: 3.2.57 - /bin/bash
    Binaries:
      Node: 8.11.4 - /usr/local/bin/node
      Yarn: 1.9.4 - /usr/local/bin/yarn
      npm: 4.6.1 - /usr/local/bin/npm
    SDKs:
      iOS SDK:
        Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1
      Android SDK:
        Build Tools: 23.0.1, 27.0.3, 28.0.2, 28.0.3
        API Levels: 21, 23, 25, 27, 28
    IDEs:
      Android Studio: 3.1 AI-173.4907809
      Xcode: 10.1/10B61 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.5.0 => 16.5.0
      react-native: 0.57 => 0.57.0
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
monicse09ku commented 5 years ago

I have tried all the things mentioned above. It did not work for me. Any work around please?

yannoudou commented 5 years ago

don't link manually! use:

react-native link react-native-doc-viewer

it work fine for me