Android plugin using play-services-nearby

ColeimColeim Posts: 1Member

Hello,

I am trying to create a new Android plugin that will use the play-services-nearby API.
I am working with the exe and export templates I found here: https://downloads.tuxfamily.org/godotengine/3.2/alpha0-unofficial/

When adding a simple class it works well. Then I just add the dependency to nearby api, by adding to gradle.conf:

[dependencies]
implementation 'com.google.android.gms:play-services-nearby:17.0.0'

I got then this error:

Looks like an incompatibility with the nearby api, using androidx.

So I tested several solutions, but none of them seems to works. (I'll explain below)
Does anyone have an idea how can I fix it ?

Downgrade play-services-nearby

Looking on the internet, it seems that we can downgrade the api version to have it compatible with non x android.

So I used 'play-services-nearby:16.0.0'.
Then the following error pop:

I then changed the gradle.conf to:

[dependencies]
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.gms:play-services-nearby:16.0.0'

This make gradle pass, however godot then completely crashes with the error:

ERROR: get: FATAL: Index p_index=-1 out of size (size()=62)
   At: ./core/cowdata.h:151

tools:replace

As suggested in the logs, I tried to use in the manifest:

<application
        tools:replace="android:appComponentFactory"
        android:appComponentFactory="android.support.v4.app.CoreComponentFactory">

But new error occur, and it seems that some libs are duplicated.

Use android X

I tried to migrate the build to androidx, by adding to gradle.properties:

android.useAndroidX=true
android.enableJetifier=true

Then needed some changes to migrate (looking at https://developer.android.com/jetpack/androidx/migrate/class-mappings)

android.support.v4.app.NotificationCompat => androidx.core.app.NotificationCompat
android.support.v4.content.ContextCompat => androidx.core.content.ContextCompat
android.support.annotation.Keep => androidx.annotation.Keep

The gradle build works, but then godot crashes with the same error:

ERROR: get: FATAL: Index p_index=-1 out of size (size()=62)
   At: ./core/cowdata.h:151

So I am a little bit stuck and looking for ideas.
Also, if someone knows how to copy/paste the output of the gradle build in godot (or find the log file), it will help instead of pasting images :)

If needed, I can provide the code example I am using.

Does anyone have any idea on how to use it ? Or already implement nearby plugin ?

Thanks a lot !


Tags :

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file