This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+1 vote

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 !

in Engine by (13 points)

i have same error lol

1 Answer

0 votes

I was experiencing similar problems using a play services plugin with other plugins like Admob, Share and Vibration for Godot 3.2 after many modifications I managed to get everyone to work by migrating some codes to androidx. I don't know if it helps you but I can tell you what worked in my case.

The plugin I used is this: https://github.com/cgisca/PGSGP

by (25 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.