question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android fails (Unable to find a Capacitor plugin to handle requestCode)

See original GitHub issue

Hi all.

I’m on Capacitor 3 and Vue 2 (quasar framework).

In iOs all works fine.

In android, when I click on the button shows the gmail accounts. Then select the account and notching happens .

I can see in the log:

V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 115059358, pluginId: GoogleAuth, methodName: signIn
V/Capacitor: callback: 115059358, pluginId: GoogleAuth, methodName: signIn, methodData: {}
D/Capacitor: App paused
D/Capacitor: Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 578501389
E/Capacitor/Plugin: Something went wrong
    com.google.android.gms.common.api.ApiException: 10: 
...

It’s like the plugin are not present in android target.

But If I run npx cap sync android:

[info] Found 1 Cordova plugin for android:
       onesignal-cordova-plugin@2.11.4
✔ copy android in 301.38ms
✔ Updating Android plugins in 10.24ms
[info] Found 4 Capacitor plugins for android:
       @capacitor-community/facebook-login@3.1.1
       @capacitor/camera@1.0.5
       @capacitor/geolocation@1.1.0
       @codetrix-studio/capacitor-google-auth@3.0.2
⠙ update android [info] Found 1 Cordova plugin for android:
       onesignal-cordova-plugin@2.11.4
✔ update android in 103.05ms

In androidClientId I set the name of de app: domain.name

I set server_client_id as google-services.json and copy this file into android/app/

I register the plugin in MainApplication.java

import com.codetrixstudio.capacitor.GoogleAuth.GoogleAuth;

public class MainActivity extends BridgeActivity {
  @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        registerPlugin(com.getcapacitor.community.facebooklogin.FacebookLogin.class);
        registerPlugin(GoogleAuth.class);
    }
}

But doesn’t work in android.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11

github_iconTop GitHub Comments

3reactions
websystems-devcommented, Dec 17, 2021

After many hours with SHA1, keys, clients ID, etc… I finally found (here) the solution that worked for me. I simply added <string name="server_client_id">REPLACEME.apps.googleusercontent.com</string> in this file: android/app/src/main/res/values/strings.xml Now sign-in progress is OK and no more console error shown. I did other tests, and I figure out that google-services.json file seems to be useless. If I remove it, everything keeps to work fine. Even in the capacitor.config.json the value for androidClientId seems to be ininfluent. I tried with a foo value, and I still have no errors. I report this just for reference - i.e: I will keep anyway json file and androidClientId in their places. I’m using Capacitor 3

0reactions
mmarifatcommented, Mar 26, 2022

@sjdrew Thanks man. Saved my day. Though I didn’t follow the whole procedure. I just copy-paste the “type: 3” id instead of “type: 1”

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to find Capacitor plugin to handle requestcode : r/ionic
I'm trying to use the BarcodeScanner plugin from Ionic Native but it doesn't work. I have both the phonegap-plugin-barcodescanner plugin and the ...
Read more >
Ionic Vue using Capacitor - Not finding Cordova Plugin
Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins. That means Capacitor didn't find a Capacitor plugin to ...
Read more >
Ionic6 Capacitor: After adding "cordova-plugin-advanced-http ...
Go to this location on your file explorer <android\capacitor-cordova-android-plugins\src\main\java\org\apache\cordova\file> the location ...
Read more >
Troubleshooting Android Issues | Capacitor Documentation
If you have installed a new Plugin from npm and are unable to use or see the plugins in your Android build, try...
Read more >
Unable to find a Capacitor plugin to handle requestCode ...
Unable to find a Capacitor plugin to handle requestCode, trying Cordova plugins 9972 ... How I can fix this? 1 post - 1...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found