"Error: java.lang.NoSuchMethodError: no static method" when calling a non-static method on an instance
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- android, java
- Bereich
- mobile-dev
Rechercherichtung
Beginne mit dem include.gradle des Plugins und dem im Issue gezeigten Aufruf von Stripe.confirmSetupIntent. Reproduziere den Aufruf mit den angegebenen NativeScript- und Stripe-Versionen und vergleiche dann die Methodensignatur zur Laufzeit mit dem fehlschlagenden Aufruf. Erledigt ist es, wenn die Instanzmethode ohne NoSuchMethodError aufgerufen werden kann und ungültige IDs den erwarteten API-Fehler erreichen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
✔ Component nativescript has 8.2.3 version and is up to date.
✔ Component @nativescript/core has 8.2.1 version and is up to date.
✔ Component @nativescript/ios has 8.2.3 version and is up to date.
✔ Component @nativescript/android has 8.2.2 version and is up to date.
Describe the bug
This problem happens with the @triniwiz/nativescript-stripe module (see https://github.com/triniwiz/nativescript-plugins/issues/110).
When calling this method:
this.stripe.confirmSetupIntent(activity, new StripeSetupIntentParams(paymentMethodId, clientSecret).native);
This error is thrown:
Error: java.lang.NoSuchMethodError: no static method "Lcom/stripe/android/Stripe;.confirmSetupIntent(Landroidx/activity/ComponentActivity;Lcom/stripe/android/model/ConfirmSetupIntentParams;)V"
I used java.util.Arrays.toString(this.stripe.getClass().getMethods())) to get this method's signature:
public final void com.stripe.android.Stripe.confirmSetupIntent(androidx.activity.ComponentActivity,com.stripe.android.model.ConfirmSetupIntentParams)
It looks totally the same (to me). There are also methods with the same name:
public final void com.stripe.android.Stripe.confirmSetupIntent(androidx.fragment.app.Fragment,com.stripe.android.model.ConfirmSetupIntentParams)
public final void com.stripe.android.Stripe.confirmSetupIntent(androidx.activity.ComponentActivity,com.stripe.android.model.ConfirmSetupIntentParams,java.lang.String)
public final void com.stripe.android.Stripe.confirmSetupIntent(androidx.fragment.app.Fragment,com.stripe.android.model.ConfirmSetupIntentParams,java.lang.String)
public static void com.stripe.android.Stripe.confirmSetupIntent$default(com.stripe.android.Stripe,androidx.activity.ComponentActivity,com.stripe.android.model.ConfirmSetupIntentParams,java.lang.String,int,java.lang.Object)
public static void com.stripe.android.Stripe.confirmSetupIntent$default(com.stripe.android.Stripe,androidx.fragment.app.Fragment,com.stripe.android.model.ConfirmSetupIntentParams,java.lang.String,int,java.lang.Object)
public final com.stripe.android.model.SetupIntent com.stripe.android.Stripe.confirmSetupIntentSynchronous(com.stripe.android.model.ConfirmSetupIntentParams) throws com.stripe.android.exception.AuthenticationException,com.stripe.android.core.exception.InvalidRequestException,com.stripe.android.core.exception.APIConnectionException,com.stripe.android.core.exception.APIException
public final com.stripe.android.model.SetupIntent com.stripe.android.Stripe.confirmSetupIntentSynchronous(com.stripe.android.model.ConfirmSetupIntentParams,java.lang.String) throws com.stripe.android.exception.AuthenticationException,com.stripe.android.core.exception.InvalidRequestException,com.stripe.android.core.exception.APIConnectionException,com.stripe.android.core.exception.APIException
public static com.stripe.android.model.SetupIntent com.stripe.android.Stripe.confirmSetupIntentSynchronous$default(com.stripe.android.Stripe,com.stripe.android.model.ConfirmSetupIntentParams,java.lang.String,int,java.lang.Object) throws com.stripe.android.exception.AuthenticationException,com.stripe.android.core.exception.InvalidRequestException,com.stripe.android.core.exception.APIConnectionException,com.stripe.android.core.exception.APIException
To Reproduce
Here is the include.gradle file of this plugin:
android {
defaultConfig {
minSdkVersion 21
}
packagingOptions {
pickFirst 'META-INF/stripe_release.kotlin_module'
}
}
dependencies {
implementation('com.stripe:stripe-android:19.0.0'){
transitive = true
}
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.2'
implementation "androidx.lifecycle:lifecycle-livedata:2.2.0"
implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
}
Maybe adding the plugin to a new project is enough (I can provide a sample project if you think this issue belongs here). Then call:
const publishableKey = 'pk_test_xxxxxxxxxxxxxxxxxxxxxxxx'
const stripe = new Stripe(publishableKey)
stripe.confirmSetupIntent('pm_xxxxxxxxxxxxxxxxxxxxxxxx', 'secret_xxxxxxxxxxxxxxxxxxxxxxxx')e
I don't know if it will work with these fake IDs, but I think it should return an API error if the method gets called.
Let me know if you need extra information.
- Vorherrschende Sprache
- C++
- Sterne
- 563
- Forks
- 144
- Ø Merge
- 10 Std. 46 Min.
- Gemergte PRs (30 T.)
- 14
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NativeScript/android
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
NativeScript/android#2039 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
NativeScript/android#2024 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 20/100
NativeScript/android#2020 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 42/100
NativeScript/android#2019 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 55/100
NativeScript/android#1986 ·
Alle Issues in NativeScript/android
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
ros2/message_filters#338 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
subsurface/subsurface#4984 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
flutter-webrtc/flutter-webrtc#2206 ·
-
litertlm-android AAR ships no consumer ProGuard rules → "mid == null" SIGABRT in minified apps Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
google-ai-edge/LiteRT-LM#3739 ·