Unable to find explicit activity class Payment act

2019-08-07 20:57发布

I am building a mobile app on xamarin and wanted to use the paypal sdk for our payment system. I took the paypal SDK at: https://github.com/paypal/PayPal-Android-SDK To use it in Xamarin I need a java binding. I previously used a library I found on Xamarin forum (sorry can't add more than 2 links) since it didn't worked I did my own java binding with the same error.

I am following this tutorial: https://github.com/paypal/PayPal-Android-SDK/blob/master/docs/single_payment.md

In the OnClickMethod, when I try to start the Payment activity I get "Unable to find explicit class exception:

Java.Lang.RuntimeException: Unable to find explicit activity class {BeamUp.BeamUp/com.paypal.android.sdk.payments.PaymentActivity}; have you declared this activity in your AndroidManifest.xml?   at at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <IL 0x00085, 0x00300>  at at Android.App.Activity.StartActivityForResult (Android.Content.Intent,int) <IL 0x000cd, 0x00513>   at BeamUp.MainActivity.<OnCreate>b__0 (object,System.EventArgs) [0x0003e] in f:\Philippe Things\Travail\BeamUp\BeamUp\MainActivity.cs:79   at at Android.Views.View/IOnClickListenerImplementor.OnClick (Android.Views.View) <IL 0x00014, 0x000bb>   at at Android.Views.View/IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (intptr,intptr,intptr) <IL 0x00013, 0x000f3>   at at (wrapper dynamic-method) object.603476f6-1d1c-4bf4-bf20-03c66e4c1830 (intptr,intptr,intptr) <IL 0x00017, 0x00043>   at --- End of managed exception stack trace ---   at android.content.ActivityNotFoundException: Unable to find explicit activity class {BeamUp.BeamUp/com.paypal.android.sdk.payments.PaymentActivity}; have you declared this activity in your AndroidManifest.xml?   at at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628) at at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424) at at android.app.Activity.startActivityForResult(Activity.java:3424)  at at android.app.Activity.startActivityForResult(Activity.java:3385)  at at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:839) at at mono.android.view.View_OnClickListenerImplementor.n_onClick(Native Method)   at at mono.android.view.View_OnClickListenerImplementor.onClick(View_OnClickListenerImplementor.java:29) at at android.view.View.performClick(View.java:4438)   at at android.view.View$PerformClick.run(View.java:18422)   at at android.os.Handler.handleCallback(Handler.java:733)   at at android.os.Handler.dispatchMessage(Handler.java:95)   at at android.os.Looper.loop(Looper.java:136)   at at android.app.ActivityThread.main(ActivityThread.java:5001)   at at java.lang.reflect.Method.invokeNative(Native Method)   at at java.lang.reflect.Method.invoke(Method.java:515)   at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785) at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)   at at dalvik.system.NativeStart.main(Native Method)

My OnClick look like this:

 Buy.Click += (sender, e) =>            {
                 PayPalPayment payment = new PayPalPayment(new Java.Math.BigDecimal("1.75"), "USD", "hipster jeans",
 PayPalPayment.PaymentIntentSale);

                Intent intent = new Intent(this, typeof(PaymentActivity));

                intent.PutExtra(PaymentActivity.ExtraPayment, payment);

                StartActivityForResult(intent, 0);          };

My Android Manifest look like this:

 <?xml version="1.0" encoding="utf-8"?> <manifest
 xmlns:android="http://schemas.android.com/apk/res/android"
 android:versionCode="1" android:versionName="1.0" package="BeamUp">
    <uses-sdk android:minSdkVersion="7" android:targetSdkVersion="16" />
    <!-- Google Maps for Android v2 requires OpenGL ES v2 -->
<uses-permission
 android:name="android.permission.INTERNET" />  <uses-permission
 android:name="android.permission.ACCESS_NETWORK_STATE"/> <!-- for
 card.io card scanning -->  <uses-permission
 android:name="android.permission.CAMERA" />    <uses-permission
 android:name="android.permission.VIBRATE" />   <uses-permission
 android:name="android.permission.ACCESS_WIFI_STATE"/>
     <service android:name="com.paypal.android.sdk.payments.PayPalService"
         android:exported="false" />

    <activity
 android:name="com.paypal.android.sdk.payments.PaymentActivity" />
    <activity
 android:name="com.paypal.android.sdk.payments.LoginActivity" />
    <activity
 android:name="com.paypal.android.sdk.payments.PaymentMethodActivity"
 />     <activity
 android:name="com.paypal.android.sdk.payments.PaymentConfirmActivity"
 />     <activity android:name="io.card.payment.CardIOActivity"
           android:configChanges="keyboardHidden|orientation" />    <activity android:name="io.card.payment.DataEntryActivity" />   

    <application android:label="@string/app_name"
 android:icon="@drawable/icon"
 android:theme="@android:style/Theme.NoTitleBar">       <activity
 android:name="com.facebook.LoginActivity"
 android:theme="@android:style/Theme.Translucent.NoTitleBar"
 android:label="@string/app_name" />
    </application>  <uses-sdk android:minSdkVersion="8" />  <meta-data
 android:name="com.facebook.sdk.ApplicationId"
 android:value="@string/app_id" /> </manifest>

1条回答
【Aperson】
2楼-- · 2019-08-07 21:28

The activities and service declarations need to appear within the <application> tag. Fix that, and everything should work.

查看更多
登录 后发表回答