Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start AuthorizingPaymentActivity #53

Closed
annchar opened this issue Apr 25, 2019 · 9 comments
Closed

Unable to start AuthorizingPaymentActivity #53

annchar opened this issue Apr 25, 2019 · 9 comments

Comments

@annchar
Copy link

annchar commented Apr 25, 2019

Unable to start activity
java.lang.ClassCastException: co.omise.android.ui.AuthorizingPaymentActivity cannot be cast to androidx.appcompat.app.AppCompatActivity

@nuxzero
Copy link
Contributor

nuxzero commented Apr 25, 2019

From what I see from the exception, AuthorizingPaymentActivity didn't use AppCompatActivity. I'm not sure how you start the activity.
Could you share the code that you use to start AuthorizingPaymentActivity activity?

@annchar
Copy link
Author

annchar commented Apr 25, 2019

fun showAuthorizingPaymentForm(activity: FragmentActivity, authorizeUri: String) {
		val intent = Intent(activity, AuthorizingPaymentActivity::class.java)
		intent.putExtra(AuthorizingPaymentActivity.EXTRA_AUTHORIZED_URLSTRING, authorizeUri)
		intent.putExtra(AuthorizingPaymentActivity.EXTRA_EXPECTED_RETURN_URLSTRING_PATTERNS, arrayOf(BuildConfig.WEB_URL))
		activity.startActivityForResult(intent, REQUEST_CODE_AUTHORIZING_PAYMENT)
	}

@annchar
Copy link
Author

annchar commented Apr 25, 2019

Call from activity extend AppCompatActivity
this project use androidX all file

@nuxzero
Copy link
Contributor

nuxzero commented Apr 25, 2019

From your code look correct to start AuthorizingPaymentActivity. For now, I check from the project using AndroidX, but we cannot reproduce the exception. Would be great if you can give us for more information example Where do start Activity from Fragment or Activity? or create a project to reproduce the issue that will help us to investigate the issue.

@annchar
Copy link
Author

annchar commented Apr 25, 2019

CheckoutActivity.kt
class CheckoutActivity : AppCompatActivity(){
	override fun onCreate(savedInstanceState: Bundle?) {
		super.onCreate(savedInstanceState)
		setContentView(R.layout.activity_checkout)
...
			navigator.showAuthorizingPaymentForm(this, authorizedUri)
...

}
}

Navigator.kt
class Navigator(){
fun showAuthorizingPaymentForm(activity: FragmentActivity, authorizeUri: String) {
		val intent = Intent(activity, AuthorizingPaymentActivity::class.java)
		intent.putExtra(AuthorizingPaymentActivity.EXTRA_AUTHORIZED_URLSTRING, authorizeUri)
		intent.putExtra(AuthorizingPaymentActivity.EXTRA_EXPECTED_RETURN_URLSTRING_PATTERNS, arrayOf(BuildConfig.WEB_URL))
		activity.startActivityForResult(intent, REQUEST_CODE_AUTHORIZING_PAYMENT)
	}
}

@nuxzero
Copy link
Contributor

nuxzero commented Apr 25, 2019

Could you give us full stacktrace from the exception?

@annchar
Copy link
Author

annchar commented Apr 25, 2019

2019-04-25 15:21:47.781 16196-16196/com.kpc.hisdev E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.kpc.hisdev, PID: 16196
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.kpc.hisdev/co.omise.android.ui.AuthorizingPaymentActivity}: java.lang.ClassCastException: co.omise.android.ui.AuthorizingPaymentActivity cannot be cast to androidx.appcompat.app.AppCompatActivity
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
        at android.app.ActivityThread.-wrap14(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6682)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
     Caused by: java.lang.ClassCastException: co.omise.android.ui.AuthorizingPaymentActivity cannot be cast to androidx.appcompat.app.AppCompatActivity
        at com.smartlook.sdk.smartlook.analytics.c.b.f(SourceFile:150)
        at com.smartlook.sdk.smartlook.analytics.c.b.a(SourceFile:146)
        at com.smartlook.sdk.smartlook.analytics.c.b$1.onActivityStarted(SourceFile:92)
        at android.app.Application.dispatchActivityStarted(Application.java:231)
        at android.app.Activity.onStart(Activity.java:1270)
        at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1256)
        at android.app.Activity.performStart(Activity.java:6959)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2890)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
        at android.app.ActivityThread.-wrap14(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6682) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 

@nuxzero
Copy link
Contributor

nuxzero commented Apr 29, 2019

We were trying to reproduce the issue with the information you provided, unfortunately we couldn't reproduce it. This issue might be caused by some configuration that we don't aware of.

We would like to help you solve this issue but we need your help. Could you provide a small project that can reproduce this issue? That will help us to investigate and find a solution quickly.

Thank you

@annchar
Copy link
Author

annchar commented May 1, 2019

I found the cause of the problem It's because I installed a library called smart look.
Thank you for your help.

@annchar annchar closed this as completed May 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants