1

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 anything in gradle for looking for imports?

But when it says searching 0 proto paths, it makes me wonder....

My gradle is:

wire { kotlin { android = true } }

File Structure is

      -> proto
           -> testing
                -> people
                     -> person.proto
                -> tastes
                     -> tastes.proto

my import line in person.proto is: import "testing/tastes/tastes.proto";

syntax = "proto2";
package testing.people;
option java_package = "com.testing.people";

import "testing/tastes/tastes.proto";

message WirePerson {

    optional string name = 1;
    repeated string picture_urls = 2;
    optional testing.tastes.WirePersonTaste period = 5;
}
syntax = "proto2";
package testing.tastes;
option java_package = "com.testing.tastes";

message WirePersonTaste {
    optional string taste = 1;
    repeated string picture_urls = 2;
}

I would be very grateful for any assistance :)

Johnny Zen
  • 76
  • 5
  • I wasn't able to reproduce the issue. Here's a test project: https://github.com/Egorand/wire-tastes – Egor Dec 12 '19 at 12:23

1 Answers1

1

Be sure the protos are in src/main/proto. Otherwise the plugin won't detect it. If moving it around is a problem, you can specify the path as an option in the kotlin {} configuration.

oldergod
  • 15,033
  • 7
  • 62
  • 88
  • Yes the location of the proto files is ok, as if I take the import out, it works – Johnny Zen Dec 12 '19 at 09:24
  • Check the test project github.com/Egorand/wire-tastes – oldergod Dec 12 '19 at 14:11
  • this is interesting... I am getting the same issue with your test project. So it looks like something with my environment? I am using android studio.. @oldergod – Johnny Zen Dec 13 '19 at 15:44
  • 1
    an update. I suspect an issue with windows path. I can get the imports to work if I place the tastes.proto file in the *src/main/proto* folder instead of *src/main/proto/testing/tastes* folder. I have tried adding the *tastes* directory to protoPath in gradle options, but all I get when I do this is *Collection contains no element matching the predicat* error. BTW using protoPath with a empty folder location seems the only way to compile (still get *unable to resolve 1 imports* issue though :( )but then get Cannot find an example of how proto needs be structured. – Johnny Zen Dec 18 '19 at 17:35