processout / processout-android

https://www.processout.com
MIT License
2 stars 5 forks source link

Process out ui sdk compilation error JVM 17 #243

Open krazykira opened 7 hours ago

krazykira commented 7 hours ago

Hello,

We have tried integrating process out ui sdk into a test project and Android Studio is complaining during compilation about JVM version. The error we get is

Cannot inline bytecode built with JVM target 17 into bytecode that is being built with JVM target 1.8
image

Here is the app/build.gradle for details:

plugins {
    id 'com.google.devtools.ksp'
    id 'com.android.application'
    id 'com.google.dagger.hilt.android'
    id 'org.jetbrains.kotlin.android'
    id 'org.jetbrains.kotlin.plugin.compose' version '2.0.21'
    id 'org.jetbrains.kotlin.plugin.serialization' version '2.0.0'
}

android {
    namespace 'com.test.task'
    compileSdk 35

    defaultConfig {
        applicationId "com.test.task"
        minSdk 24
        targetSdkVersion 35
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }
    }

    buildTypes {
        debug {
            minifyEnabled = false
            shrinkResources = false
        }
        release {
            minifyEnabled = false
            proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8.toString()
    }

    buildFeatures {
        buildConfig = true
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion "1.4.3"
    }
    packaging {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    // Prebuilt customizable UI to handle payment flows.
    implementation("com.processout:processout-android-ui:4.23.0")

    implementation "io.coil-kt:coil-compose:2.7.0"
    implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
    implementation 'com.google.dagger:hilt-android:2.52'
    implementation "com.squareup.okhttp3:okhttp:4.12.0"
    implementation "androidx.hilt:hilt-navigation-compose:1.2.0"
    ksp 'com.google.dagger:hilt-compiler:2.52'
    implementation platform("androidx.compose:compose-bom:2024.11.00")
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3'
    implementation 'com.squareup.retrofit2:retrofit:2.11.0'
    implementation 'com.jakewharton.retrofit:retrofit2-kotlinx-serialization-converter:1.0.0'
    implementation 'androidx.compose.foundation:foundation:1.7.5'
    implementation 'androidx.compose.material:material:1.7.5'
    implementation 'androidx.compose.ui:ui:1.7.5'
    implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.8.7'
    implementation 'androidx.compose.ui:ui-graphics'
    implementation 'androidx.compose.material3:material3:1.3.1'
    implementation 'androidx.compose.material3:material3-android:1.3.1'
    debugImplementation 'androidx.compose.ui:ui-tooling:1.7.5'
    debugImplementation 'androidx.compose.ui:ui-test-manifest:1.7.5'
    implementation 'androidx.compose.ui:ui-tooling-preview'
    implementation 'androidx.activity:activity-compose:1.9.3'
    implementation 'androidx.core:core-ktx:1.15.0'
    implementation 'androidx.appcompat:appcompat:1.7.0'
    implementation 'com.google.android.material:material:1.12.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
    testImplementation 'junit:junit:4.13.2'
}

Is there a way to solve this issue without downgrading the JVM version of the app?

vitalii-vanziak-cko commented 4 hours ago

Hey @krazykira,

JavaVersion.VERSION_1_8 is older, you need to upgrade to JavaVersion.VERSION_17 at least. Note it's not JavaVersion.VERSION_1_7. Here's configuration of our example app.

BTW, we provide an example app along with our SDKs that showcase some payment flows and screens. Here's how to setup it: 1) Checkout this repository. 2) Modify ProcessOutExampleApplication by setting your projectId and privateKey which refers to your ProcessOut project. Note that privateKey is used only in example app to simulate some of the backend behavior, like creating an invoice, it should never be used in production app and is hidden by @ProcessOutInternalApi annotation, you can opt-in only for testing. 3) Change Build Variant to productionDebug. 4) Run example configuration on device or emulator.