Questions tagged [square-wire]

Wire is a Java implementation of Google's Protocol Buffers.

Resources:

15 questions
189
votes
33 answers

Android Studio inline compiler showing red errors, but compilation with gradle works fine

I've set up my project in Android Studio to use the Square Wire library, as per this question. Build -> Compile Project works fine. 2:03:10 PM Compilation completed successfully in 31 sec However, if I open one of my generated Protocol Buffer…
Dan J
  • 25,433
  • 17
  • 100
  • 173
3
votes
1 answer

Does Wire have an equivalent to io.grpc.Metadata and MetadataUtils for attaching headers to calls dynamically?

For instance, attaching Metadata to a stub as headers would look something like val stub = MetadataUtils.attachHeaders( SomeCoroutineGrpc.newStubWithContext(channel), metadata.toMetadata() …
Carter Hudson
  • 1,176
  • 1
  • 11
  • 23
3
votes
2 answers

Using protobuf imports (i.e. google/protobuf/timestamp.proto) with wire

I am trying to generate files using the square's Wire. I could run their sample all good, but as soon as I added import "google/protobuf/timestamp.proto"; to their .proto file to check how wire treats timestamps, compiler broke with this…
aleien
  • 786
  • 1
  • 9
  • 22
3
votes
1 answer

D8 exception when using Square's Wire

After adding Square's Wire library for Protobuf support in an Android project, I'm getting the following D8 exception during compilation: D8: Program type already present:…
Splash
  • 1,310
  • 12
  • 20
2
votes
1 answer

Need wire to emit interfaces for client and server in same gradle project

I want to use interfaces for both client and server in the same android app. Usecase is to run a okhttpmockwebserver serving gRPC requests within the same app the client is running in. For this i created two library projects with their own wire…
lilienberg
  • 1,252
  • 11
  • 18
2
votes
0 answers

How to generate a .proto file with Wire without using Maven?

For a project I've been using the Google protocol buffers, but now I want to switch to Wire. I want to compile my .proto file using the terminal like this protoc -I=$SRC_DIR --java_out=$DST_DIR $SRC_DIR/addressbook.proto (this is for the google…
1
vote
0 answers

Colon in grpc url while using wire

I'm trying to make a call to grpc syntax URL: https://photoslibrary.googleapis.com/v1/mediaItems:search by using Wire framework. First problem is putting /v1 in path as below configuration ignores it: GrpcClient.Builder() …
Jacek Kwiecień
  • 12,397
  • 20
  • 85
  • 157
1
vote
1 answer

How use Wire with Flow in client gRPC?

i need stream of a service gRPC with Wire and need use Flow on client, but executeBlocking() do not provide method with return via Flow, need implementation manual via flow emits?
João Eudes Lima
  • 755
  • 1
  • 11
  • 21
1
vote
1 answer

How can I generate protobuf in Kotlin for Android applications?

Anyone help me to understand how can I generate protobuf in Kotlin? I heard about gRPC, wire, KotlinPoet, but I don't understand what are the differences, which one should I use any samples, any simple documents please fill free to share with…
Artur A
  • 257
  • 3
  • 20
1
vote
1 answer

Unable to resolve x imports

I am getting (using: api 'com.squareup.wire:wire-runtime:3.0.2') Execution failed for task ':app:generateProtos'. unable to resolve 1 imports: testing/tastes/tastes.proto searching 0 proto paths: My understanding is that I do not need to define…
Johnny Zen
  • 76
  • 5
1
vote
1 answer

Proguard for Wire + Retrofit NoSuchMethodException

My brain is fried. I searched S.O. for help but it seems Proguard issues with this exception are specific to the app in question. I've been trying to use Proguard to obfucate/minify my app and when I run it in the Generated APK form my app either…
mastrgamr
  • 631
  • 1
  • 11
  • 21
1
vote
0 answers

java.lang.IllegalArgumentException: No WireType for value

use com.squareup.wire wire-runtime. code: Wire wire = new Wire(); VerifyTicketRsp ticketRsp = wire.parseFrom(moaResult.objectBytes, VerifyTicketRsp.class); error info: java.lang.IllegalArgumentException: No WireType for value 118 at…
Tony.Lu
  • 187
  • 13
0
votes
1 answer

How do I serialize with square-wire

Getting a NullPointerException when I try to serialize the result: java.lang.NullPointerException: Attempt to invoke virtual method 'byte[] com.squareup.wire.ProtoAdapter.encode(java.lang.Object)' on a null object reference Tried using…
0
votes
1 answer

Best way to add dependency for Wire using Gradle in Android Studio

I'm using Square's Wire library for my Android app, using Android Studio with Gradle. I originally added the wire-runtime-1.2.0.jar into a libs folder in my module, and added the dependency to Gradle like this in my build.gradle file: dependencies…
Dan J
  • 25,433
  • 17
  • 100
  • 173
-1
votes
1 answer

Square Wire Service Implementation

I'm trying to learn about grpc and protocol buffers while creating a test app using square's wire library. I've got to the point of generating both client and server files but I got stuck in creating a server side app. The documentation is too…
HDN
  • 93
  • 2
  • 9