Reputation: 149
I am new to protocol buffer from google so I tried the Java tutorial and everything goes well until I am trying to make an instance of the protocol class. So I tried to make my own proto file but I had the same problem. The problem lies in this piece of code:
AddressBook.Builder address = new AddressBook.newBuilder();
On the newBuilder() part I am getting a cannot find symbol error. In the comments in the file generated by protoc it says to use the newBuilder() to make an instance of the class and I can't find the problem. Does anyone know the problem and is there a solution?
Upvotes: 1
Views: 3031
Reputation: 1503539
This is the problem:
new AddressBook.newBuilder();
That syntax is half way between a method call and a constructor call. newBuilder()
is just a static method. You just need:
AddressBook.Builder builder = AddressBook.newBuilder();
Upvotes: 6