Gomobile binding failing

I'm trying to get rclone for kotlin. It seems the closest I can get gomobile bind, but I'm having issue here.

PS C:\Users\Cyber\a> gomobile bind -v -target=android -javapkg=org.rclone github.com/rclone/rclone/librclone/gomobile
no exported names in the package ".rclone"
unable to import bind: no Go package in golang.org/x/mobile/bind
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
unable to import bind: no Go package in golang.org/x/mobile/bind
unable to import bind: no Go package in golang.org/x/mobile/bind
no exported names in the package ".rclone"
no exported names in the package ".rclone"
no exported names in the package ".rclone"
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
"golang.org/x/mobile/bind" is not found; run go get golang.org/x/mobile/bind: no Go package in golang.org/x/mobile/bind
C:\Users\Cyber\go\bin\gomobile.exe: C:\Users\Cyber\go\bin\gobind.exe -lang=go,java -outdir=C:\Users\Cyber\AppData\Local\Temp\gomobile-work-4167319309 -javapkg=org .rclone github.com/rclone/rclone/librclone/gomobile failed: exit status 1

Try -androidapi ${RCLONE_NDK_VERSION}

We use RCLONE_NDK_VERSION=21

We do this in the CI so it should work :crossed_fingers:

Umm, maybe I don't understand properly but tried

PS C:\Users\Cyber\a> gomobile bind -v -target=android -androidapi=21 -javapkg=org.rclone github.com/rclone/rclone/librclone/gomobile
no exported names in the package ".rclone"
unable to import bind: no Go package in golang.org/x/mobile/bind
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
unable to import bind: no Go package in golang.org/x/mobile/bind
unable to import bind: no Go package in golang.org/x/mobile/bind
no exported names in the package ".rclone"
no exported names in the package ".rclone"
no exported names in the package ".rclone"
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
no exported names in the package "github.com/rclone/rclone/librclone/gomobile"
"golang.org/x/mobile/bind" is not found; run go get golang.org/x/mobile/bind: no Go package in golang.org/x/mobile/bind
C:\Users\Cyber\go\bin\gomobile.exe: C:\Users\Cyber\go\bin\gobind.exe -lang=go,java -outdir=C:\Users\Cyber\AppData\Local\Temp\gomobile-work-953164013 -javapkg=org .rclone github.com/rclone/rclone/librclone/gomobile failed: exit status 1

and getting the same issue.
However, if you guys are already building the aar file, maybe I can just download and use it directly?

In fact it'll be easier to import with gradle

The binaries end up here testbuilds-latest

However these are binary executable rather than libraries.

You might want to check out GitHub - x0b/rcx: Rclone for Android to see how they do it. I know very little about building stuff for android - the android builds for rclone were contributed by the developer of rcx so I could know rclone builds for android at all times.

Rcx is also using binary instead of using the aar file (from gomobile). In fact I was following Rcx before I found out I could be using a library version, Rclone gomobile

I can try to look for solving this gomobile binding
But, I want ask some question regarding Rclone RPC provided by the librclone

  • Is it feature limited? (i.e. doesn't have a mount or any other features)
  • Does it also uses a config file? where's its location?
  • I didn't find much documentation about it, how to use it? Can you provide me an example, say add google drive (including making the local oauth server)

Thanks for your time and help so far.

That would be great if you could.

You could then propose a PR to update the librclone docs.

You can do everything you can do via the rc API. That includes mount! However whether mount is compiled in the library or not will depend on exactly how it was compiled.

It uses the standard rclone config file by default. You can of course set its location via the API.

Configuring rclone is quite complex! You can run the config api step by step

Read these docs first

And checkout this example code:

Rclone will run the local oauth server for you and return the URL in the text.

This isn't perfect - this area could do with some improvements which I discussed with the rcx author some time ago.

1 Like

I've requested a PR.

I also plan on publishing the Android library on Maven or Jitpack for ease of use for developers, please let me know if you're interested in publishing it in your name (it is more preferable option) or if I should do it under my account.

1 Like

Excellent work :slightly_smiling_face:Will check out the pr in due course.

An example of how to use the library would probably be helpful too.

Thank you

1 Like

Welcome.

An example of how to use the library would probably be helpful too.

That can be done eventually, as I intend to use it in a project I'm working on. But this will take a while, as I don't get much time working on things I like because of uni. So, if someone beats me to it, that's alright too.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.