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>
3
Answers
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?
Or did you download the source code, and import it into your poroject?
In build.gradle(:app) add
in the
block.
In gradle.properties add
Adding it before or after
will be ok. That is it.
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