Merott / nativescript-pdf-view

A basic PDF viewer plugin for NativeScript. Now maintained by @madmas: github.com/madmas/nativescript-pdf-view
Other
32 stars 35 forks source link

Error on Android #6

Closed dpdragnev closed 8 years ago

dpdragnev commented 8 years ago

Hello,

I am trying to display a PDF file on both iOS and Android. The iOS version looks great, however, when I load the page on an Android device, I am getting:

Module '/data/data/com.someurl/files/app/tns_modules/nativescript-pdf-view' not found for element 'nativescript-pdf-view:PDFView'. Cannot read property 'barteksc' of undefined

Here is my declaration:

In the Page declaration: xmlns:pdf="nativescript-pdf-view" In the markup: <pdf:PDFView src="{{ pdfUrl }}" />

Any idea of what I might be doing wrong?

Thank you.

Merott commented 8 years ago

It looks like it can't find the AndroidPdfView library, which should be installed via Gradle. Can you re-add the Android platform by running tns platform remove android followed by tns platform add android?

dpdragnev commented 8 years ago

This is what I thought as well, but since the iOS version, which was deployed at the same time, works well, i thought i was doing something wrong.

I am actually using the AppBuilder. I added the module via Visual Studio. I will try uninstalling the app and redeploying it again. I will let you know if this fixed the issue.

Thank you for the quick response.

On Sep 7, 2016 3:45 PM, "Merott Movahedi" notifications@github.com wrote:

It looks like it can't find the AndroidPdfView library, which should be installed via Gradle. Can you re-add the Android platform by running tns platform remove android followed by tns platform add android?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Merott/nativescript-pdf-view/issues/6#issuecomment-245442792, or mute the thread https://github.com/notifications/unsubscribe-auth/AK0awM4bCxtaQnnudPlcqWnBAx0q81tAks5qnz6DgaJpZM4J3bZ0 .

dpdragnev commented 8 years ago

ok, so I reinstalled the app and I am still getting the same error. Could this be related to the fact that I am using AppBuilder?

dpdragnev commented 8 years ago

I can confirm that this only happens if you are using the AppBuilder. Using the CLI everything works well.

I have opened a ticket with Telerik. I suspect that this has something to do with the whitelist requirements AppBuilder has for all plugins.

I am closing this ticket, but will reopen if they come up with a solution to this problem.

Thank you.

Merott commented 8 years ago

Thank you for confirming this @dpdragnev

dpdragnev commented 8 years ago

For those using the AppBuilder, the fix is to create a file called app.gradle in app/App_Resources/Android (if you don't already have it) and in it to enter:

dependencies { compile 'com.github.barteksc:android-pdf-viewer:2.0.3' }

Compile and you should be able run the app without a problem.