-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Description
Please answer these questions before submitting your issue.
What version of gRPC are you using?
Currently i'm using gRPC 1.3.0
What JVM are you using (java -version)?
Using openjdk 1.8.0, Android version 25
What did you do?
If possible, provide a recipe for reproducing the error.
I'm trying to create a secured server on an android device. To do so i created the following method:
` public ServerAndroid(LogicInfo infoManager, GroupInfo groupInfo) {
this.infoManager = infoManager;
this.groupInfo = groupInfo;
this.serverListener = ServerListener.NO_LISTENER;
InputStream certificate = infoManager.getContext().getResources().openRawResource(R.raw.cert);
InputStream key = infoManager.getContext().getResources().openRawResource(R.raw.key);
try {
this.keyserver = File.createTempFile("key", "pem");
this.cert = File.createTempFile("cert","pem");
FileUtils.copyInputStreamToFile(certificate, this.cert);
FileUtils.copyInputStreamToFile(key, this.keyserver);
} catch (IOException e) {
e.printStackTrace();
}
this.server = ServerBuilder.forPort(LogicConstants.DEFAULT_SERVER_PORT)
.useTransportSecurity(this.cert, this.keyserver)
.addService(new InnerServer()).build();
}`
The thing is, when I compile the project it returns an error "java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured."
I searched everywhere, and everyone says to run -Xbootclasspath/p:<alp-boot-version.jar>. but I can't do that on Android.
I tried to insert a compile dependencie on gradle ( compile 'org.mortbay.jetty.alpn:alpn-boot:8.1.11.v20170118' ) but when I try to run the project it gives the error:
Error converting bytecode to dex: Cause: Dex cannot parse version 52 byte code. This is caused by library dependencies that have been compiled using Java 8 or above. If you are using the 'java' gradle plugin in a library submodule add targetCompatibility = '1.7' sourceCompatibility = '1.7' to that submodule's build.gradle file. ...while parsing org/eclipse/jetty/alpn/ALPN.class
What did you expect to see?
No error.
What did you see instead?
java.lang.IllegalArgumentException: Jetty ALPN/NPN has not been properly configured.