card-io / card.io-Android-SDK

card.io provides fast, easy credit card scanning in mobile apps
Other
1.99k stars 535 forks source link

Fatal error: requestFeature() must be called before adding content #134

Closed benadamstyles closed 6 years ago

benadamstyles commented 8 years ago

Required Information

Crash with the following log:

E/AndroidRuntime(14335): FATAL EXCEPTION: main
E/AndroidRuntime(14335): Process: com.swoonbox.dev.scanner, PID: 14335
E/AndroidRuntime(14335): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.swoonbox.dev.scanner/io.card.payment.DataEntryActivity}: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
E/AndroidRuntime(14335):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2339)
E/AndroidRuntime(14335):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2413)
E/AndroidRuntime(14335):    at android.app.ActivityThread.access$800(ActivityThread.java:155)
E/AndroidRuntime(14335):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1317)
E/AndroidRuntime(14335):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(14335):    at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime(14335):    at android.app.ActivityThread.main(ActivityThread.java:5343)
E/AndroidRuntime(14335):    at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14335):    at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(14335):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:905)
E/AndroidRuntime(14335):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:700)
E/AndroidRuntime(14335): Caused by: android.util.AndroidRuntimeException: requestFeature() must be called before adding content
E/AndroidRuntime(14335):    at com.android.internal.policy.impl.PhoneWindow.requestFeature(PhoneWindow.java:302)
E/AndroidRuntime(14335):    at android.app.Activity.requestWindowFeature(Activity.java:3615)
E/AndroidRuntime(14335):    at io.card.payment.ui.ActivityHelper.addActionBarIfSupported(ActivityHelper.java:29)
E/AndroidRuntime(14335):    at io.card.payment.DataEntryActivity.onCreate(DataEntryActivity.java:395)
E/AndroidRuntime(14335):    at android.app.Activity.performCreate(Activity.java:6010)
E/AndroidRuntime(14335):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1129)
E/AndroidRuntime(14335):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2292)
E/AndroidRuntime(14335):    ... 10 more
W/ActivityManager(  832):   Force finishing activity 1 com.swoonbox.dev.scanner/io.card.payment.DataEntryActivity
W/ActivityManager(  832):   Force finishing activity 2 com.swoonbox.dev.scanner/io.card.payment.CardIOActivity

(Using this SDK via https://github.com/vkeepe/card.io)

Any ideas on where to start debugging this? Thanks very much!

braebot commented 8 years ago

Have you tried upgrading to the latest version of card.io? 5.1.0 is over 6 months old, and quite a few bug fixes have been released since then.

lesterleong commented 8 years ago

@braebot Looks like the version being used in the vkeepe Cordova plugin linked above is 5.1.0 - the plugin author hasn't updated it since. Would it just be a matter of compiling the latest version of this SDK into a JAR file to include in the plugin?

braebot commented 8 years ago

Since we push our aar files to mavenCentral, there isn't any custom packaging required anymore. I would recommend taking a look at the PayPal Cordova SDK as a reference.

Perhaps it's worth updating the original Cordova repo at some point, rather than relying on the fork.