androidandroid-6.0-marshmallowcyanogenmod

Protoc not compiling automatically in android source code


Android source code doesn't generate .pb.h from .proto. What could be the problem? Should I configure anything in additional? If if install protobuf manually and compile and place it in the location needed, it is showing some redeclaration error.

    # Create java protobuf code

include $(CLEAR_VARS)

src_proto := $(LOCAL_PATH)
LOCAL_MODULE := sap-api-java-static
LOCAL_SRC_FILES := proto/sap-api.proto
LOCAL_PROTOC_OPTIMIZE_TYPE := micro

include $(BUILD_STATIC_JAVA_LIBRARY)

This is my android.mk part for protobuf.
The path of this .proto is /hardware/ril/librilutils/


Solution

  • In my case, Android.mk of the c file didn't point to the correct directory. so I have just searched for the .pb.h file and could point that directory to look for .pb.h. The prolbem was solved!
    Note: The location for compiled .pb.h was changed in source later.