wakumo / flutter-wallet-connect-v2

WalletConnect V2 for Flutter
MIT License
24 stars 7 forks source link

No implementation found for method init on channel wallet_connect_v2 #13

Closed LvDj closed 1 year ago

LvDj commented 1 year ago

E/flutter (11903): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method init on channel wallet_connect_v2)

  1. android device
  2. release model. = Failed to connect
LvDj commented 1 year ago

ios is fine. The problem is only on android

LvDj commented 1 year ago

I'm running the demo just fine. But in my project, I had this problem. I don't know what the problem is.

LvDj commented 1 year ago

this my androidManifest:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://socrates.com/tools" package="xxxx">

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.SEND_SMS" />

<queries>
    <package android:name="com.instagram.android" />
</queries>
<queries>
    <package android:name="org.telegram.messenger" />
</queries>
<queries>
    <package android:name="com.twitter.android" />
</queries>

<application
    android:name="${applicationName}"
    android:icon="@mipmap/ic_launcher"
    android:label="Socrates">
    <activity
        android:name=".MainActivity"
        android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
        android:exported="true"
        android:hardwareAccelerated="true"
        android:launchMode="singleInstance"
        android:theme="@style/LaunchTheme"
        android:windowSoftInputMode="adjustResize">

        <!--
             Specifies an Android theme to apply to this Activity as soon as
             the Android process has started. This theme is visible to the user
             while the Flutter UI initializes. After that, this theme continues
             to determine the Window background behind the Flutter UI.
        -->
        <meta-data
            android:name="io.flutter.embedding.android.NormalTheme"
            android:resource="@style/NormalTheme" />

        <meta-data
            android:name="io.flutter.embedding.android.SplashScreenDrawable"
            android:resource="@drawable/launch_background" />

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <data android:scheme="socrates" />
            <action android:name="android.intent.action.VIEW" />

            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
        </intent-filter>
    </activity>
    <!--

Don't delete the meta-data below. This is used by the Flutter tool to generate GeneratedPluginRegistrant.java --> <meta-data android:name="flutterEmbedding" android:value="2" /> <activity android:name="com.yalantis.ucrop.UCropActivity" android:screenOrientation="portrait" android:theme="@style/Theme.AppCompat.Light.NoActionBar" /> <provider android:name="androidx.core.content.FileProvider" android:authorities="xxxx.com.shekarmudaliyar.social_share" android:exported="false" android:grantUriPermissions="true" tools:replace="android:authorities"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" />

LvDj commented 1 year ago

After I run(App), I initialize it

LvDj commented 1 year ago

I found this problem in the demo as well. If at initstate func, execute :

_walletConnectV2Plugin .init(projectId: projectId, appMetadata: _walletMetadata) .then((value) { _walletConnectV2Plugin.connect(); });

I can't get a pair

ludowkm commented 1 year ago

Hello @LvDj , look like you missed adding proguard to your project, please add it then you will able to build release and run as usual. https://github.com/wakumo/flutter-wallet-connect-v2/blob/main/example/android/app/proguard-rules.pro

huantd0111 commented 1 year ago

Hello @LvDj , look like you missed adding proguard to your project, please add it then you will able to build release and run as usual. https://github.com/wakumo/flutter-wallet-connect-v2/blob/main/example/android/app/proguard-rules.pro

I had a similar problem. i added proguard to the project. and the build was successful. However when I made the connection, no event was fired and I couldn't connect.

This only happens on android when build release while debug is still active

I noticed this log when running release:

W/FlutterEngineCxnRegstry(18413): Attempted to register plugin (com.walletconnect.Pl@9f5deba) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.a@568b16b).

What flutter version are you trying with? I would like to provide more information about the setting:

MainActivity:

import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity() {}

[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4 22F66 darwin-arm64, locale en-VN) [✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)

huantd0111 commented 1 year ago

When I tried to run the sample in release mode on android, I got this error:

I/flutter (22709): onEvent data = {name: connection_status, data: {isConnected: true}} I/flutter (22709): ---: CONNECTED: true I/flutter (22709): code: pair_error | message: Pair with existing pairing is not allowed

Connect URI:

wc:b9b7ea456980ad01c9652b5f14e83e1838ff5f8565a906e408b80bb4540ed52f@2?relay-protocol=irn&symKey=64a403ece705754af8689d878b077d7573e9afd8bd227780a0b628390b51da07

https://react-app.walletconnect.com/

in debug mode also doesn't work

huantd0111 commented 1 year ago

I found this problem in the demo as well. If at initstate func, execute :

_walletConnectV2Plugin .init(projectId: projectId, appMetadata: _walletMetadata) .then((value) { _walletConnectV2Plugin.connect(); });

I can't get a pair

Do you have any solution for this problem?

ludowkm commented 1 year ago

@huantd0111 The example is a simple integration, you will need to config yourself on the project. Pair with existing pairing is not allowed: you will need to listen on the session approve/reject to store connected session/quite the paring. You will also need to take a look on the WC docs to understand about their workflow then you can do integration easier.