首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gradle在解析符号时不能解析符号。

Gradle在解析符号时不能解析符号。
EN

Stack Overflow用户
提问于 2019-04-16 10:05:18
回答 2查看 2K关注 0票数 2

我有以下build.gradle文件:

代码语言:javascript
复制
import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask

apply plugin: 'kotlin-multiplatform'
apply plugin: 'com.android.library'

android {
    compileSdkVersion 28
    defaultConfig {
        minSdkVersion 19
    }
    lintOptions {
        abortOnError false
    }
}

dependencies {
    testImplementation 'junit:junit:4.12'
    testImplementation 'org.jetbrains.kotlin:kotlin-test'
    testImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
    testImplementation 'com.google.truth:truth:0.42'

    androidTestImplementation 'junit:junit:4.12'
    androidTestImplementation 'org.jetbrains.kotlin:kotlin-test'
    androidTestImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
    androidTestImplementation 'com.google.truth:truth:0.42'
}

kotlin {
    targets {
        jvm("jvm")
        android("android")
        iosArm32("ios32")
        iosArm64("ios64")
        iosX64("emulator")

        configure([ios32, ios64, emulator]) {
            binaries.framework('HyModule')
        }
    }

    sourceSets {
        commonMain.dependencies {
            api 'org.jetbrains.kotlin:kotlin-stdlib-common'
        }
        jvmMain.dependencies {
            api 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
        }
        androidMain.dependencies {
            implementation 'org.jetbrains.kotlin:kotlin-stdlib'
        }
        androidMain.dependsOn jvmMain
    }

    task fatFramework(type: FatFrameworkTask) {
        // the fat framework must have the same base name as the initial frameworks
        baseName = "HyModule"

        final File frameworkDir = new File(buildDir, "xcode-frameworks")
        destinationDir = frameworkDir

        // specify the frameworks to be merged
        from(
                targets.ios32.binaries.getFramework('HyModule', 'RELEASE'),
                targets.ios64.binaries.getFramework('HyModule', 'RELEASE'),
                targets.emulator.binaries.getFramework('HyModule', 'RELEASE')
        )

        doLast {
            new File(frameworkDir, 'gradlew').with {
                text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
                setExecutable(true)
            }
        }
    }
}

// workaround for https://youtrack.jetbrains.com/issue/KT-27170
configurations {
    compileClasspath
}

tasks.build.dependsOn fatFramework

import org.jetbrains.kotlin.gradle.tasks.FatFrameworkTask标记为红色,并带有错误。

无法解析符号“FatFrameworkTask”

尽管一切都很好,但我不喜欢在我的项目中出错。

EN

回答 2

Stack Overflow用户

发布于 2020-02-14 10:43:54

试一试

代码语言:javascript
复制
import org.jetbrains.kotlin.gradle.tasks.*

我也面临着同样的问题,不知道为什么

票数 1
EN

Stack Overflow用户

发布于 2019-04-16 14:12:15

如果Gradle任务运行良好,可以是IntelliJ中的可视化错误,这通常发生在我身上。

尝试重新启动IntelliJ或Android

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55705585

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档