【问题标题】:A problem occurred evaluating project ':tflite' No signature of method: .android() is applicable for argument types评估项目时出现问题 \':tflite\' 没有方法签名:.android() 适用于参数类型
【发布时间】:2022-11-10 02:10:31
【问题描述】:

你好,所以我尝试在颤振上使用“tflite”包构建一个对象检测应用程序,我碰巧遇到了这个错误:

这是我的 app/build.gradle 文件下面的代码:

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    
    compileSdkVersion flutter.compileSdkVersion
    ndkVersion flutter.ndkVersion
    
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    
    kotlinOptions {
        jvmTarget = '1.8'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    defaultConfig {
        applicationId "com.example.aiassistantapp"

        minSdkVersion 21
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    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
        }
    }
    aaptOptions {
        noCompress 'tflite'
        noCompress 'lite'
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

这是我的 build.gradle 文件:

buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.1.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }

    // 
 
}

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

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

我认为最初的问题是我的 kotlin 版本不兼容,但即使在更改后我也遇到了同样的错误

【问题讨论】:

    标签: android flutter tensorflow tflite


    【解决方案1】:

    遇到同样的问题你解决了吗

    【讨论】:

      猜你喜欢
      • 2022-08-09
      • 2020-04-09
      • 2022-07-16
      • 2021-05-23
      • 2021-11-02
      • 1970-01-01
      • 1970-01-01
      • 2021-04-09
      • 2017-07-05
      相关资源
      最近更新 更多