-1

I have a .java class which uses imports from google play services. I want to put this class in a .jar to package with my project, but using javac filename.java in the terminal gives me a bunch of errors e.g.

androidSCAR.java:3: error: package android.content does not exist import android.content.Context;

How do I include these imports while creating a .class?

The .java file is in an android studio project which all works fine

minimal example code:

myClass.java file:

import android.content.Context;

public class myClass
{

private static Context context;

}

Run javac myClass.java in terminal

Results:

test.java:1: error: package android.content does not exist
import android.content.Context;
                      ^
test.java:6: error: cannot find symbol
private static Context context;
               ^
  symbol:   class Context
  location: class myClass

1 Answers1

0

I found a work around - I built the android project using the .java class and grabbed the .class files from app\build\intermediates\javac\debug\classes\module-name, and used those to create my .jar file.