Reputation: 21
I'am working on an app that can download, modify, read, show and share PDF. To do this, I found a youtube video that use some external libraries on github. I tried to add to my project (especially in an xml file) a PDF Viewer from a repository that the video advised to use but when I run into a problem and I don't Know why. The program says that there is an "unresolvable tag" but I don't Know how to resolve it. I attach the full code below, thanks for help.
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView android:id="@+id/tcTitle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PDF Viewer Demo"
android:textStyle="bold"
android:textSize="18sp"
android:layout_margin="10dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<com.github.barteksc.pdfviewer.PDFView
android:id="@+id/pdfView"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tcTitle"
android:background="@color/white"
android:layout_marginTop="10dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="70dp"
/>
<Button android:id="@+id/shareButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:text="SHARE PDF"
android:padding="10dp"
android:layout_margin="20dp"
/>
<ProgressBar android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
Upvotes: 0
Views: 896
Reputation: 1
Go to refactor menu and migrate to the project Android x it's working for me
And also implemented the dependency library as above comments mentioned
Upvotes: 0
Reputation: 763
In build.gradle(:app) add
implementation 'com.github.mhiew:android-pdf-viewer:3.2.0-beta.1'
in the
dependencies {}
block.
In gradle.properties add
android.enableJetifier=true
Adding it before or after
android.useAndroidX=true
will be ok. That is it.
Upvotes: 0
Reputation: 6830
It's telling you the com.github.barteksc.pdfviewer.PDFView
class isn't found, which means that you didn't import it into your project properly.
How did you include it in your project? Did you add use the following in your app gradle?
implementation 'com.github.barteksc:android-pdf-viewer:version'
Or did you download the source code, and import it into your poroject?
Upvotes: 2