Lutz
Lutz

Reputation: 850

Where to include third party *.java files into my android app?

Possibly a very simple question, but i don't know the answer and it looks like i have not the right words to find the answer myself.

Last 2 weeks I have build my first Android app with Android Studio. Now I want to use a zxing intent for barcode scans. Zxing docs say i should use the zxing files IntentIntegrator.java and IntentResult.java for this.

I could place the files into the folder of my MainActiviy src/main/java/de/digiscales/scanbrowser. But i want to do it CORRECT, to stay able to maintain my growing app also in 2 years in an easy way! In which folder of my project should I put such third party .java files?

Or is there a function in Android Studio to include such foreign code?

I have tried to add it as dependency but Gradle says only .JAR files are ok this this.

Upvotes: 0

Views: 133

Answers (1)

Lutz
Lutz

Reputation: 850

Now i have used the package name of the files which i wanted to add com.google.zxing.integration.android to create this folder structure src/main/java/com/google/zxing/integration/android/ where I have put the two .java files into.

For me it looks like everything is correct. Android Studio shows no failure. And also using ALT + ENTER works now for importing these classes into my activity.

Upvotes: 1

Related Questions