【问题标题】:Why do I get an error with missing ProtocolStringList in google protobuf?为什么在 google protobuf 中缺少 ProtocolStringList 会出错?
【发布时间】:2016-01-15 20:27:19
【问题描述】:

我刚刚遇到了对ProtocolStringList 的引用导致在protoc 创建的生成代码中出现类未找到错误的问题。

在这种情况下,我遇到了 Eclipse 错误:

com.google.protobuf.ProtocolStringList cannot be resolved to a type

我希望它也可以显示为:

java.lang.NoClassDefFoundError: com/google/protobuf/ProtocolStringList

【问题讨论】:

    标签: java protoc


    【解决方案1】:

    我在 Stack Overflow 上找不到这个问题的答案,所以我在这里发布。

    事实证明,这是由于使用较新版本的 protoc(在本例中为 2.6.1)和较旧版本的 protobuf-java*.jar 造成的。 (在这种情况下为 2.5.0)。

    【讨论】:

    • 您能详细说明一下吗?那么你做了什么来解决这个问题?升级还是降级?
    • @ThariqNugrohotomo 是的。只需确保您的 jar 和 protoc 的版本相同,只要您使用与运行代码的 jar 相同的版本运行 protoc,您就可以朝任一方向移动。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-21
    • 2012-04-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-08
    相关资源
    最近更新 更多