Skip to content

Configuration MainActivity.class issue / Error 4 #29

Description

@Sulorb

Hello,

I'm struggling to install correctly the plugin. The only thing I didn't succeed from the setup is this part:

Then on your MainActivity.class file you will need to import and register the plugin in your onCreate method:
@Override public void onCreate(Bundle savedInstanceState) { registerPlugin(CapacitorGameConnectPlugin.class); super.onCreate(savedInstanceState); }

Do I have to put it in android/app/src/main/java/io/ionic/start/MainActivity.java ?

I tried like this:

`
package app.myapp.www;

import com.getcapacitor.BridgeActivity;

public class MainActivity extends BridgeActivity {
@OverRide
public void onCreate(Bundle savedInstanceState) {
registerPlugin(CapacitorGameConnectPlugin.class);
super.onCreate(savedInstanceState);
}
}
`

But when I run it to my android device it returns me this error:

symbol: class Bundle [capacitor] location: class MainActivity [capacitor] C:\Users\alexi\OneDrive\...\android\app\src\main\java\io\ionic\starter\MainActivity.java:8: error: cannot find symbol [capacitor] registerPlugin(CapacitorGameConnectPlugin.class); [capacitor] ^ [capacitor] symbol: class CapacitorGameConnectPlugin [capacitor] location: class MainActivity [capacitor] 2 errors [capacitor] [capacitor] FAILURE: Build failed with an exception.

Also without that part I succeed to run it on my phone but when I try to signIn as follows:

import { CapacitorGameConnect } from '@openforge/capacitor-game-connect'; ... const user = await CapacitorGameConnect.signIn();

It returns me this error in the inspector console:

`
ERROR Error: 4:
at returnResult (VM3:912:32)
at win.androidBridge.onmessage (VM3:887:21)
handleError @ main.2b90b40a20af0514.js:1

`

Please help me finish the setup, I don't know what the "Error 4" means and how to "register the plugin in your onCreate method". 🙏

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions