Coder Social home page Coder Social logo

Comments (18)

codinronan avatar codinronan commented on June 9, 2024 1

@jamesdixon hey dude so in and amongst trying to figure out why the latest Android SDK was causing a severe crash in android.support, I saw this error as well but it never actually causes the app to crash.

I believe - I don't know for sure but I believe - that this is not a real error, caused by Cordova itself and the way it marshalls the object calls back and forth between native and the webview. The reason it doesn't matter is because the Braintree Drop-In native code already knows about the class type so it is properly reconstructed on the other side; the class name cordova gives it is just a suggestion. I'm not sure the actual source of the error but I noticed that when the error occurs is long before the DropIn itself is actually invoked.

Anyway, it works beautifully with my latest changes over in the PR on Taraque's repo, so even if it continues to be thrown we can ignore it.

from braintree-android-drop-in.

codinronan avatar codinronan commented on June 9, 2024 1

Yep we recently stopped supporting anything older than Android 4.4 so that helps immensely.

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

When I analyze the APK I'm pushing to my Android device, I see the following:

image

It appears the class exists, so I'm not sure why it's having trouble finding. Thanks again!

from braintree-android-drop-in.

sdcoffey avatar sdcoffey commented on June 9, 2024

Hey @jamesdixon,

Sorry for letting this issue marinate for so long! Thanks for the detailed bug report. We don't officially support Cordova as an integration type but we can try to debug this. If you haven't already sorted the issue, can you provide a more detailed stack trace for that crash? If you have sorted the issue, can you share what fixed it for others who might be encountering the same thing? Thanks!

from braintree-android-drop-in.

sdcoffey avatar sdcoffey commented on June 9, 2024

Hey @jamesdixon,

I'm closing this issue due to inactivity. Please open a new issue if you're still seeing this exception in your app.

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@sdcoffey sorry for the delayed reply!

@codinronan awesome! looking forward to trying out your latest branch. I'll let ya know how it goes

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan I pinged you in my thread on Taraque's repo. I used your fork, but unfortunately still running into this issue. Re-reading your response above, I'm now curious if that error isn't actually what's causing my app to crash. What's odd is that this works on iOS, so not sure what the heck is going on :-(

from braintree-android-drop-in.

codinronan avatar codinronan commented on June 9, 2024

@jamesdixon hmmm it works great for me on Android - saying that - I'm using cordova 8, although for this I don't think that makes much difference.

I assume you've gone through the entire "remove the plugin, delete the platform folder, re-add android platform, re-add the plugin" steps? Shouldn't make any difference for Android, on iOS it modifies the project... Oh, one other thing - do you have this gist?

https://gist.github.com/codinronan/24e93bb7a8717e13279a43882ab5c4f2

What this does is it forces all the support & compat libraries onto the same version. For me, that was the actual source of the crash. I don't have that included in the plugin itself because that may be undesirable behavior in some circumstances but grab the gist and modify it if you need to (FYI the gist assumes you are on cordova-android@7)

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan thanks for the reply!

So buried underneath that error, was this:

 java.lang.NoSuchMethodError: No static method getFont(Landroid/content/Context;ILandroid/util/TypedValue;ILandroid/widget/TextView;)Landroid/graphics/Typeface; in class Landroid/support/v4/content/res/ResourcesCompat; or its super classes (declaration of 'android.support.v4.content.res.ResourcesCompat' appears in /data/app/com.scoutforpets.customer-1/base.apk)

Googling that led me to here: https://stackoverflow.com/questions/47113948/java-lang-nosuchmethoderror-no-static-method-getfontlandroid-content-contexti

From what I can tell, it may be the issue that your Gist fixes. GOing to give it a shot now!

from braintree-android-drop-in.

codinronan avatar codinronan commented on June 9, 2024

@jamesdixon yep that's exactly what the gist is for; I traced that same error to the same source.

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan any idea what causes it? I did have to do some weird hackery on my Mac to get the Android build env working. Basically download Android Studio and then had to replace the tools/ directory with an older version based on this SO thread: https://stackoverflow.com/a/43133647/327447

Thought that might be causing it

from braintree-android-drop-in.

codinronan avatar codinronan commented on June 9, 2024

@jamesdixon Yep so basically when the compat libraries mismatch, it's a crapshoot which will actually get included. The build system thinks it has already included one, so it doesn't include the later one you might need, which means methods aren't available. If you use several cordova plugins (like I do) they may all specify different support/appcompat library versions. In my case, between all my plugins, I end up with 4 - count them 4 - different support lib versions specified in build.gradle.

In this case, the issue is actually the braintree gradle itself: it specifies a later support version than the others so you have to make sure that one actually gets used. That's what the gist does, it takes all the references and forces them all to the same version (in this case I have the gist using the version specified by braintree).

I'm surprised you had to hack the build env. When I upgraded the android build tools recently I didn't need to do that. Gradle got confused for awhile but then I just used homebrew to install gradle 3 and all was well.

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan on an unrelated note, when you run cordova build android, how many APKs do you get? After upgrading to Cordova 7 and Cordova-android 7, I'm now getting 5!!! 1 per architecture. Used to be 2

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan thanks for the explanation. REALLY helpful!

from braintree-android-drop-in.

codinronan avatar codinronan commented on June 9, 2024

@jamesdixon that's... interesting... I only get 1 - debug or release, depending on the flags I passed to cordova. If I just do cordova build android I get the debug apk.

Let me know if you're able to get the plugin to work :)

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan yeah, I think maybe it's because I had it originally set up to output multiple APKs due to Crosswalk. Do you still use Crosswalk in your app?

from braintree-android-drop-in.

codinronan avatar codinronan commented on June 9, 2024

@jamesdixon Ohh that'll do it. Nope I never really got on the Crosswalk train, just Android webview and WKWebView for me...

from braintree-android-drop-in.

jamesdixon avatar jamesdixon commented on June 9, 2024

@codinronan Gotcha. I had originally added it to support older devices, but things are probably better now which is why the Crosswalk project stopped developing it 😄

Thanks again!

from braintree-android-drop-in.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.