Note that there are some explanatory texts on larger screens.

plurals
  1. POPayPal.initWithAppID() crashes with NullPointerException
    primarykey
    data
    text
    <pre><code> FATAL EXCEPTION: Thread-5195 java.lang.NullPointerException: src == null at java.lang.System.arraycopy(Native Method) at com.paypal.android.a.g.a(Unknown Source) at com.paypal.android.a.h.c(Unknown Source) at com.paypal.android.MEP.PayPal.setLanguage(Unknown Source) at com.paypal.android.MEP.PayPal.initWithAppID(Unknown Source) at com.lonfun.pets.UnityPayMenuActivity.initLibrary(UnityPayMenuActivity.java:256) at com.lonfun.pets.UnityPayMenuActivity.access$2(UnityPayMenuActivity.java:249) at com.lonfun.pets.UnityPayMenuActivity$2$1.run(UnityPayMenuActivity.java:175) </code></pre> <p>I just use android to open paypal, everything is ok, but if I call from unity, this is happened! this is my java code:</p> <p>package com.paypal.androidpets;</p> <pre><code>import android.content.Context; import android.os.Handler; import com.lonfun.pets.UnityPayMenuActivity; import com.paypal.android.MEP.PayPal; import com.paypal.android.MEP.PayPalActivity; public class PaypalTool { Context context; PayPal pp; private static final int server = PayPal.ENV_SANDBOX; // The ID of your application that you received from PayPal private static final String appID = "APP-80W284485P519543T"; public PaypalTool(Context context) { this.context=context; } public void initLibrary(final Handler handler) { new Thread() { public void run() { PayPalActivity._paypal = null; pp = PayPal.getInstance(); // If the library is already initialized, then we don't need to initialize it again. if(pp == null) { // pp = PayPal.initWithAppID(context, "", PayPal.ENV_NONE); pp = PayPal.initWithAppID(context, appID, server); pp.setShippingEnabled(false); } if (PayPal.getInstance().isLibraryInitialized()) { handler.sendEmptyMessage(0); } else { handler.sendEmptyMessage(1); } } }.start(); } } </code></pre> <p>has anybody solve this problem,,please help me, thank you!</p> <pre><code>using UnityEngine; using System.Collections; public class PayMoneyHandler : MonoBehaviour { #if UNITY_ANDROID static AndroidJavaClass payPluginClass; static AndroidJavaClass unityPlayer; static AndroidJavaObject currActivity; #endif public static void Pay(string productID) { #if UNITY_ANDROID AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); AndroidJavaObject jo = jc.GetStatic&lt;AndroidJavaObject&gt;("currentActivity"); jo.Call("StartActivity0", "com.peten.tier2", "EGAHCNJDEJBWBIBWEXIKDEGLJECOAD.Mac", "Dog", "AndDogCn", "http://42.121.94.123/TradeWeb/AlipayTrade.aspx", "http://58.246.188.238/TradeWeb/PaypalTrade.aspx" ); #endif } } using UnityEngine; using System.Collections; public class TestForPaypal : MonoBehaviour { // Use this for initialization void Start () { } // Update is called once per frame void Update () { } public void OnClick(){ Debug.Log("Test For Paypal!"); PayMoneyHandler.Pay("test1"); } } public void StartActivity0(final String name,final String PlayerName,final String GameID,final String ZoneID,final String payUrl,final String paypalUrl) { this.runOnUiThread(new Runnable() { @Override public void run() { Log.i("Order", "name:"+name+"PlayerName:"+PlayerName+"GameID:"+GameID+"ZoneID:"+ZoneID+"payUrl:"+payUrl+"paypalUrl:"+paypalUrl); Intent payintent=new Intent(mContext,UnityPayMenuActivity.class); payintent.putExtra("name",name); payintent.putExtra("PlayerName",PlayerName); payintent.putExtra("GameID",GameID); payintent.putExtra("ZoneID",ZoneID); payintent.putExtra("payUrl",payUrl); payintent.putExtra("paypalUrl",paypalUrl); Unity3DMainActiviy.this.startActivity(payintent); } }); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload