My main file to generate has these import :
import "protos/google_annotations.proto";
import "protos/nakama_annotations.proto";
import "protos/nakama_api.proto";
The folder structure :
├── lib
├── protos
├── google_annotations.proto
├── nakama_annotations.proto
├── nakama_api.proto
├── apigrpc.proto <--- this is the file to generate.
The highlight syntax is ok.(Android studio)
The 2 cases that i got error are :
1.
Command run in
protosdirectoryRun
protoc apigrpc.proto --java_out=. --proto_path=.Get this error
protos/google_annotations.proto: File not found. protos/nakama_annotations.proto: File not found. protos/nakama_api.proto: File not found.
- Specify all import files
Command run in
protosdirectoryRun
protoc apigrpc.proto --java_out=. --proto_path=google_annotations.proto --proto_path=nakama_annotations.proto --proto_path=nakama_api.protoGet this error
apigrpc.proto: File does not reside within any path specified using --proto_path
What did i do wrong?
I just found what's wrong. It's about
import.I have to remove the prefex
protosbecause the import file is in the same level of directory.So the import become this :
The reason that I put
protosin front before because the Android Studio plugin doesn't show red highlight when I put like that. Now After remove that, it highlight red, but it works.