The error you're encountering is due to how you're trying to import FakeContext in your HelloWorld.java file. Let's break down the issue and how to fix it:
The error:
textHelloWorld.java:8: error: '.' expected import FakeContext; ^
indicates that the compiler expects a .java file or a package-qualified import, but you're trying to import FakeContext directly as if it were a package or a static import.
If FakeContext is a class in the same directory, you should import it with its package name (if it has one) or as a static import if it's a static class.
is related to thetextwarning: [options] system modules path not set in conjunction with -source 10
-source 10 flag and the Java module system. It's not the cause of your error, but you can suppress it by using a more modern -source and -target version (e.g., -source 11 -target 11).FakeContext CorrectlyIf FakeContext is a class in the same directory (no package), you should import it like this:
javaimport FakeContext;
But if it's in a package (e.g., com.example), you should import it as:
javaimport com.example.FakeContext;
If both HelloWorld.java and FakeContext.java are in the same directory, you can compile them together:
bashjavac -source 11 -target 11 -cp /opt/android-sdk/platforms/android-36/android.jar HelloWorld.java FakeContext.java
This ensures the compiler sees both files and resolves the import correctly.
If FakeContext is in a package, make sure:
FakeContext.java matches the import in HelloWorld.java.com.example, the file should be in com/example/FakeContext.java).FakeContext.java and use the correct import in HelloWorld.java.-source and -target flags to a more modern version (e.g., -source 11 -target 11).If your files are structured like this:
text. ├── HelloWorld.java └── FakeContext.java
Then your HelloWorld.java should import FakeContext as:
javaimport FakeContext;
And you should compile with:
bashjavac -source 11 -target 11 -cp /opt/android-sdk/platforms/android-36/android.jar HelloWorld.java FakeContext.java