Android谷歌电视配对协议不起作用
当我尝试使用这段代码执行android程序时,我使用google协议缓冲区得到了这个错误列表。问题出在哪里 我在app.gradle文件中使用protobuf-gradle插件版本0.8.8和com.google.protobuf:protoc版本3.0.0和com.google.protobuf:protoc-gen-javalite依赖项 polo.proto文件 错误列表Android谷歌电视配对协议不起作用,android,proto,Android,Proto,当我尝试使用这段代码执行android程序时,我使用google协议缓冲区得到了这个错误列表。问题出在哪里 我在app.gradle文件中使用protobuf-gradle插件版本0.8.8和com.google.protobuf:protoc版本3.0.0和com.google.protobuf:protoc-gen-javalite依赖项 polo.proto文件 错误列表 错误:类型GeneratedMessageLite不接受参数 错误:类型GeneratedMessageLite不接受
错误:类型GeneratedMessageLite不接受参数
错误:类型GeneratedMessageLite不接受参数
错误:类型GeneratedMessageLite不接受参数
错误:类型GeneratedMessageLite不接受参数
错误:类型GeneratedMessageLite不接受参数
错误:类型GeneratedMessageLite不接受参数
错误:类型GeneratedMessageLite不接受参数
错误:找不到符号类MethodToInvoke
错误:找不到符号类MethodToInvoke
错误:找不到符号类ProtobufList
错误:找不到符号类MethodToInvoke
错误:找不到符号类MethodToInvoke
错误:找不到符号类MethodToInvoke
错误:找不到符号变量未知字段
错误:找不到符号变量未知字段
错误:找不到符号方法parseFrom(OuterMessage,ByteString)
错误:找不到符号方法parseFrom(OuterMessage,字节[])
错误:找不到符号方法parseFrom(OuterMessage,InputStream)
错误:不兼容的类型:OuterMessage无法转换为InputStream
错误:找不到符号方法parseFrom(OuterMessage,CodedInputStream)
错误:找不到toBuilder()的符号方法
错误:类型参数OuterMessage不在类型变量MessageType的范围内
其中MessageType是一个类型变量:
MessageType扩展了在类生成器中声明的GeneratedMessageLite
错误:类生成器中的构造函数生成器无法应用于给定类型;
必需:无参数
找到:OuterMessage
原因:实际参数列表和正式参数列表长度不同
其中MessageType、BuilderType是类型变量:
MessageType扩展了在类生成器中声明的GeneratedMessageLite
BuilderType扩展类生成器中声明的生成器
错误:找不到符号变量实例
错误:找不到符号变量实例
错误:找不到符号变量实例
错误:找不到符号变量实例
错误:找不到符号变量实例
错误:找不到符号变量实例
错误:找不到符号变量实例
问题是我实现了一个旧版本的ProtoBuf,并且使用了.jar lib文件
我删除了.jar文件,升级了protobuf版本,它就工作了。救了我的命!哈哈
// Copyright 2009 Google Inc. All Rights Reserved.
package polo.wire.protobuf;
option java_outer_classname = "PoloProto";
option java_package = "com.google.polo.wire.protobuf";
option optimize_for = LITE_RUNTIME;
// OuterMessage - base outer message type used in the protocol.
message OuterMessage {
// MessageType indicates the type of the enclosed message (serialized in the
// `payload` field)
enum MessageType {
// Initialization phase
MESSAGE_TYPE_PAIRING_REQUEST = 10;
MESSAGE_TYPE_PAIRING_REQUEST_ACK = 11;
// Configuration phase
MESSAGE_TYPE_OPTIONS = 20;
MESSAGE_TYPE_CONFIGURATION = 30;
MESSAGE_TYPE_CONFIGURATION_ACK = 31;
// Pairing phase
MESSAGE_TYPE_SECRET = 40;
MESSAGE_TYPE_SECRET_ACK = 41;
}
// Protocol status states.
enum Status {
STATUS_OK = 200;
STATUS_ERROR = 400;
STATUS_BAD_CONFIGURATION = 401;
STATUS_BAD_SECRET = 402;
}
required uint32 protocol_version = 1 [default = 1];
// Protocol status. Any status other than STATUS_OK implies a fault.
required Status status = 2;
// Encapsulated message. These fields are required if status is STATUS_OK.
optional MessageType type = 3;
optional bytes payload = 4;
}
//
// Initialization messages
//
message PairingRequest {
// String name of the service to pair with. The name used should be an
// established convention of the application protocol.
required string service_name = 1;
// Descriptive name of the client.
optional string client_name = 2;
}
message PairingRequestAck {
// Descriptive name of the server.
optional string server_name = 1;
}
//
// Configuration messages
//
message Options {
message Encoding {
enum EncodingType {
ENCODING_TYPE_UNKNOWN = 0;
ENCODING_TYPE_ALPHANUMERIC = 1;
ENCODING_TYPE_NUMERIC = 2;
ENCODING_TYPE_HEXADECIMAL = 3;
ENCODING_TYPE_QRCODE = 4;
}
required EncodingType type = 1;
required uint32 symbol_length = 2;
}
enum RoleType {
ROLE_TYPE_UNKNOWN = 0;
ROLE_TYPE_INPUT = 1;
ROLE_TYPE_OUTPUT = 2;
}
// List of encodings this endpoint accepts when serving as an input device.
repeated Encoding input_encodings = 1;
// List of encodings this endpoint can generate as an output device.
repeated Encoding output_encodings = 2;
// Preferred role, if any.
optional RoleType preferred_role = 3;
}
message Configuration {
// The encoding to be used in this session.
required Options.Encoding encoding = 1;
// The role of the client (ie, the one initiating pairing). This implies the
// peer (server) acts as the complementary role.
required Options.RoleType client_role = 2;
}
message ConfigurationAck {
}
//
// Pairing messages
//
message Secret {
required bytes secret = 1;
}
message SecretAck {
required bytes secret = 1;
}
error: type GeneratedMessageLite does not take parameters
error: type GeneratedMessageLite does not take parameters
error: type GeneratedMessageLite does not take parameters
error: type GeneratedMessageLite does not take parameters
error: type GeneratedMessageLite does not take parameters
error: type GeneratedMessageLite does not take parameters
error: type GeneratedMessageLite does not take parameters
error: cannot find symbol class MethodToInvoke
error: cannot find symbol class MethodToInvoke
error: cannot find symbol class ProtobufList
error: cannot find symbol class MethodToInvoke
error: cannot find symbol class MethodToInvoke
error: cannot find symbol class MethodToInvoke
error: cannot find symbol variable unknownFields
error: cannot find symbol variable unknownFields
error: cannot find symbol method parseFrom(OuterMessage,ByteString)
error: cannot find symbol method parseFrom(OuterMessage,byte[])
error: cannot find symbol method parseFrom(OuterMessage,InputStream)
error: incompatible types: OuterMessage cannot be converted to InputStream
error: cannot find symbol method parseFrom(OuterMessage,CodedInputStream)
error: cannot find symbol method toBuilder()
error: type argument OuterMessage is not within bounds of type-variable MessageType
where MessageType is a type-variable:
MessageType extends GeneratedMessageLite declared in class Builder
error: constructor Builder in class Builder<MessageType,BuilderType> cannot be applied to given types;
required: no arguments
found: OuterMessage
reason: actual and formal argument lists differ in length
where MessageType,BuilderType are type-variables:
MessageType extends GeneratedMessageLite declared in class Builder
BuilderType extends Builder declared in class Builder
error: cannot find symbol variable instance
error: cannot find symbol variable instance
error: cannot find symbol variable instance
error: cannot find symbol variable instance
error: cannot find symbol variable instance
error: cannot find symbol variable instance
error: cannot find symbol variable instance