Search code examples
javasignalsprotocol-buffers

Problems with accessing .proto files in Java


Recently I've been trying to implement the Signal Protocol (by Open Whisper Systems) into my messaging app written in Java so that it can use end-to-end encryption. I've downloaded all the required files from the GitHub repository website (I will mention the link below) and added them into my Java project. I haven't yet utilised any of the Signal Protocol's functions, because it gives me an error in the library which I added.

When I tried to see what the error was, it showed me that an import cannot be resolved. The same error with the same import occured in several files. The thing is, I could not find any .java file in the entire libary which was called as the one in the import statement.

After searching for a while, I found 3 .proto files containing lines which as far as I realised, try to add them into a Java package by giving them the names of the files which were mentioned in the import statements.

So, if possible, could anyone explain how I can use these .proto files, and how I could solve the import problem? It would be of great help to me.

Kind regards.

Here are some additional pieces of information:

The GitHub website from where I got the files: https://github.com/signalapp/libsignal-protocol-java/tree/master

Pictures of the problem:

The import error

The .proto files

The name of the file which was mentioned in the import inside of the .proto file


Solution

  • Protocol buffers come with a protocol buffer compiler that generates the Java interface to the protocol buffers. You will need to use that on the proto files to generate Java files.