使用模拟器和手机的新Flutter应用程序出现渐变错误



你好,我已经很长时间没有使用Flutter和Dart了,当我试图制作一个新的应用程序并在模拟器中运行时,弹出了这个错误:

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Android resource linking failed
C:UsersVedad.gradlecachestransforms-2files-2.15f663b08eec19eef9a9d1af662d9025ecore-1.6.0resvaluesvalues.xml:160:5-191:25: AAPT: error: resource android:attr/fontVariationSettings not found.
C:UsersVedad.gradlecachestransforms-2files-2.15f663b08eec19eef9a9d1af662d9025ecore-1.6.0resvaluesvalues.xml:160:5-191:25: AAPT: error: resource android:attr/ttcIndex not found.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 15s

其他一些错误也出现了,但当我在gradle中添加sdkverison时,它解决了一些问题,但这个问题仍然存在。这是我的gradel文件:

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(27)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.app"
minSdkVersion flutter.minSdkVersion
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
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

当您第一次运行命令flutter create appName时,该应用程序的其余部分是基本的flutter应用程序。所以,如果你能给我一个解决这个问题的办法,那就太好了,这样我就可以复习和学习新东西了。提前感谢:(

我不确定。但在我的应用程序build.gradle中;compileSdkVersion 30";看起来像这样没有";((";,这个可能有问题

最新更新