Android Studio : Adding a new java file to an existing package - "Unresolved Reference"

chaviaras michalis :

I was looking the HTML to PDF Conversion in android app

I have a problem to do the "it must be in package ".../java/android/print/" from solution number 1. How can I add the PdfConverter.java in android.print packages and the android studio recognise it ?

When I add it manually, fixing an PdfConverter.java and add it to the directory, the android studio do not recognise it and i got "Unresolved Reference : PdfConverter".

Is there another way, appropriate, to add the PdfConverter.java in the android.print package without getting the above error ?

Thank you in advance.

sela :

PdfConverter class is accessing PrintDocumentAdapter, from Android SDK's android.print package. You should made a package in project named android.print and I put PdfConverter class there and there would be no errors from lint in IDE.

Structure should be same as on this github repo https://github.com/blink22/react-native-html-to-pdf/tree/master/android

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=216410&siteId=1