PayU API Integration on Android does not work Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of PayU API Integration on Android does not work without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I have had multiple issues while integrating PayU on android. I wonder what I am missing.

  1. The integration expects importing projects and then adding as dependency into my android app. But the build fails if I don’t select version Android 5.0.1. Does this mean that PayU wont support anything less than 5.0.1?

  2. Finally I integrated the API and added the project after making some changes to their code.

    During install

    [2015-09-17 17:34:24 - app] Success!
    [2015-09-17 17:34:24 - PayU] Could not find PayU.apk!
    [2015-09-17 17:34:24 - app] Starting activity com.app.SearchFlight on device 104155f6
    [2015-09-17 17:34:25 - app] Installation failed due to invalid APK file!
    [2015-09-17 17:34:25 - app] Please check logcat output for more details.
    [2015-09-17 17:34:25 - app] Launch canceled!
    [2015-09-17 17:34:27 - app] ActivityManager: Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.mcruiseon.app/com.app.SearchFlight }
    

    After launch

    09-17 17:34:44.526: E/AndroidRuntime(24140): FATAL EXCEPTION: main
    09-17 17:34:44.526: E/AndroidRuntime(24140): Process: com.mcruiseon.app, PID: 24140
    09-17 17:34:44.526: E/AndroidRuntime(24140): java.lang.NoClassDefFoundError: com.payu.sdk.PayU
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at com.app.SearchFlight.onClick(SearchFlight.java:380)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at android.view.View.performClick(View.java:4444)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at android.view.View$PerformClick.run(View.java:18457)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at android.os.Handler.handleCallback(Handler.java:733)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at android.os.Handler.dispatchMessage(Handler.java:95)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at android.os.Looper.loop(Looper.java:136)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at android.app.ActivityThread.main(ActivityThread.java:5113)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at java.lang.reflect.Method.invokeNative(Native Method)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at java.lang.reflect.Method.invoke(Method.java:515)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)
    09-17 17:34:44.526: E/AndroidRuntime(24140):    at dalvik.system.NativeStart.main(Native Method)
    09-17 17:34:46.316: I/Process(24140): Sending signal. PID: 24140 SIG: 9
    

What am I missing here? Is this their latest version?

Solution

I moved away from PayU. I wonder how companies survive with bugs in their getting started.

Answer

It might be that you overlooked this on their github page

Beware that this SDK works only in Poland

Since you seem to be located in India, it’s most likely not going to work, even if you manage to “install” it properly. It might be better to look for an alternative.

Apart from that

Does this mean that PayU wont support anything less than 5.0.1?

No, it supports Android 2.3 and up. That is stated on the page you link to.

Here is a github page with example code for an android project.

We are here to answer your question about PayU API Integration on Android does not work - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji