最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

flutter - Can't use android.service.textclassifier.TextClassifierService in kotlin - Stack Overflow

programmeradmin1浏览0评论

I'm going to implement smart text selection in my flutter application.
The android project is using kotlin. so I should write a custom service that extends TextClassifierService, but I can Import it like it doesn't exists!

this is my app/build.gradle:

plugins {
    id "com.android.application"
    id "kotlin-android"
    id "dev.flutter.flutter-gradle-plugin"
}

dependencies {
    implementation "androidx.textclassifier:textclassifier:1.0.0-alpha04"
}

android {
    namespace = "com.example.app"
    compileSdk = 35
    ndkVersion = flutter.ndkVersion

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }

    defaultConfig {
        applicationId = "com.example.app"
        minSdk = 29
        targetSdk = 35
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig = signingConfigs.debug
        }
    }
}

flutter {
    source = "../.."
}

I've changed minSdk to 29 to see if it works but it didn't, is it even necessary to use api 29 for minSdk?

also this is my repositories inside build.gradle:

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

I also tried to import android.service.textclassifier.TextClassifierService in java but it didn't work too. what should I do?

发布评论

评论列表(0)

  1. 暂无评论