Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

"Error: java.lang.NoSuchMethodError: no static method" when calling a non-static method on an instance

Offen
#1,708 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

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

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NativeScript/android

Alle Issues in NativeScript/android

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.