Closed jonassimonaitis closed 2 years ago
Hi, thanks for this report.
Mostly likely it's because you are running on Android 4.0. Unfortunately this SDK is supposed to run on Android 5 or higher.
Please, can you confirm if this happens on Android 5 or higher?
We will update the docs and take a look to enforce minimal API level.
Hey Fabricio,
I am trying to run it on Android 9 and Android 10
On Tue, Nov 10, 2020 at 5:28 PM Fabricio Vergara notifications@github.com wrote:
Hi, thanks for this report.
Mostly likely it's because you are running on Android 4.0. Unfortunately this SDK is supposed to run on Android 6 or higher. Please, can you confirm if this happens on Android 6 or higher?
We will update the docs and take a look to enforce minimal API level.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/iZettle/sdk-android/issues/11#issuecomment-724775596, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALMH4WHZ22MKK7GN6GZ2I2TSPFLYVANCNFSM4TQOVBYA .
Any news?
I didn't managed to reproduce, would be possible to provide a sample app with this specific case?
Unfortunately I cannot send you our code. I will paste some important snippets for you. Hope it helps
Manifest:
<application android:name=".XXX" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/KioskTheme" android:usesCleartextTraffic="true" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:theme" tools:targetApi="m">
<activity android:name="com.izettle.android.auth.OAuthActivity" android:launchMode="singleTask" android:taskAffinity="@string/oauth_activity_task_affinity">
Styles.xml:
<style name="KioskTheme" parent="Theme.MaterialComponents.Light.NoActionBar.Bridge">
<item name="colorAccent">@color/colorAccent</item>
<item name="colorControlNormal">@android:color/white</item>
<item name="android:homeAsUpIndicator">@drawable/ic_keyboard_arrow_left_black_24dp</item>
defaultConfig { applicationId "com.xxxx.xxxxx" minSdkVersion 21 targetSdkVersion 29 versionCode 29 versionName "1.0.2" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }
Some more code (openCardReaderSettings) crashes:
class IZettlePayments( private val context: Context, private val paymentRepository: PaymentRepository) {
fun startIZettlePayments() {
val redirectUrl = "$IZETTLE_REDIRECT_URL://$IZETTLE_HOST"
IZettleSDK.init(context, iZettleClientId, redirectUrl)
ProcessLifecycleOwner.get().lifecycle.addObserver(SdkLifecycle(IZettleSDK))
}
fun doLogin(activity: Activity) {
IZettleSDK.user.login(
activity,
ContextCompat.getColor(context, android.R.color.white)
)
}
fun openCardReaderSettings() {
val intent = CardReadersActivity.newIntent(context)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(context, intent, null)
}
private fun buildTransactionReference(orderDetails: WebOrder):
TransactionReference { val internalTraceId = orderDetails.orderId?.toString() ?: UUID.randomUUID().toString() return TransactionReference.Builder(internalTraceId) .put( PAYMENT_EXTRA_INFO, "Payment for bill no. ${orderDetails.orderId} in ${orderDetails.venue?.name}" ) .build() }
fun startPaymentForResult(activity: Activity, orderDetails: WebOrder) {
val intent = CardPaymentActivity.IntentBuilder(context)
.amount(orderDetails.total?.toLong() ?: throw
NullPointerException("Amount is not valid") ) .reference(buildTransactionReference(orderDetails)) .enableLogin(true) .enableTipping(false) .enableInstalments(true) .build()
startActivityForResult(activity, intent,
IZETTLE_PAYMENT_REQUEST_CODE, null) }
On Mon, Nov 16, 2020 at 10:30 AM Jonas Simonaitis < jonas.simonaitis@mobonapps.com> wrote:
Unfortunately I cannot send you our code. I will paste some important snippets for you. Hope it helps
Manifest:
<application android:name=".XXX" android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/KioskTheme" android:usesCleartextTraffic="true" tools:ignore="GoogleAppIndexingWarning" tools:replace="android:theme" tools:targetApi="m">
<activity android:name="com.izettle.android.auth.OAuthActivity" android:launchMode="singleTask" android:taskAffinity="@string/oauth_activity_task_affinity">
Styles.xml:
defaultConfig { applicationId "com.xxxx.xxxxx" minSdkVersion 21 targetSdkVersion 29 versionCode 29 versionName "1.0.2" vectorDrawables.useSupportLibrary = true testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" }
I understand, my idea was to create a fork from the sample in this repo and make it happen. I've create a fork and bugfix/issue-11 branch, if possible you can create a PR pointing to this branch where you can reproduce.
Hey @fabriciovergara,
We have found that one of our AAR dependencies had <style name="AppTheme"
in values.xml
and that had conflict with iZettle library. After disabling the AAR we managed to fix the issue.
Kind regards
Good to know, thanks! I'll let your design platform team to know and we will try to rename this AppTheme to something more iZettle specific to prevent future conflict. But it can take quite some time to go live.
Expected Behavior
Open CardReadersActivity
Current Behavior
CardReadersActivity crashes due to android.view.InflateException
Steps to Reproduce
startActivity(CardReadersActivity.newIntent(this))
Call CardReaderActivityContext
Failure Logs