I have a portion of an android app that I am trying to tweak and test.
So I have pulled out two files and am trying to make a quick executable for quick test-tweak-retest turnarounds using the javac compiler.
I just want to test this one section of code with handing it separate parameters. This would be FAR quicker to work with if I could just javac compile it and then run my tests.
But I'm having a hard time getting the javac compiler to find the Android libraries.
Can anyone help me compile these two files into one executeable using javac?
FYI right now these two files really only use the main import android.os.Environment; library.
Thanks for any advice/help anyone can provide.
解决方案
But I'm having a hard time getting the javac compiler to find the Android libraries.
That would not help you anyway. Android is an operating system. It is not just a handful of Java classes. And, the Java classes that are in the android.jar files are not real implementations anyway, merely stubs that just throw a RuntimeException on every method.
Can anyone help me compile these two files into one executeable using javac?
You can't, because:
these two files... use... android.os.Environment
Instead, modify those files to remove their dependency upon Android classes, so it is just pure Java code.
Or, try Robolectric and create a unit test of those two classes using it. I cannot guarantee that your code will work (I have no idea what Robolectric's mock Environment will return for the methods you are invoking), but there's a decent chance that it will work.