gpt4 book ai didi

gradle - Gradle不能解析符号

转载 作者:行者123 更新时间:2023-12-02 12:53:05 24 4
gpt4 key购买 nike

我有以下build.gradle文件:

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用红色标记为错误

Cannot resolve symbol 'FatFrameworkTask'



即使一切正常,我也不喜欢在项目中出现错误。

最佳答案

尝试

import org.jetbrains.kotlin.gradle.tasks.*

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

关于gradle - Gradle不能解析符号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55705585/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com