1

Hello I haven't used Flutter and Dart in a long time and when i tried to make a new app and run it in emulator this error popped up:

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:\Users\Vedad\.gradle\caches\transforms-2\files-2.1\5f663b08eec19eef9a9d1af662d9025e\core-1.6.0\res\values\values.xml:160:5-191:25: AAPT: error: resource android:attr/fontVariationSettings not found.

     C:\Users\Vedad\.gradle\caches\transforms-2\files-2.1\5f663b08eec19eef9a9d1af662d9025e\core-1.6.0\res\values\values.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

Some other errors popped up as well but when I added the sdkverison in gradle it resolved some issues but this one stayed. Here is my gradel file:

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"
}

The rest of the app is basic flutter app when you first run command flutter create appName. So if you could give me a solution to this problem it would be great so I can revise and learn new things in flutter. Thanks in advance :)

Vedo
  • 976
  • 4
  • 21

1 Answers1

0

I m not sure. But in my app build.gradle "compileSdkVersion 30" looks like this without "()", May be problem with this

  • When I do that the problem is then as follow: * 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 AAPT: error: failed writing to 'C:\Users\Vedad\Desktop\Projects\folder\app\build\app\intermediates\runtime_symbol_list\debug\R.txt': The data is invalid. (13). – Vedo Jan 27 '22 at 22:01
  • https://stackoverflow.com/a/58112656/15342597 Did u read it? It can help. May be some problems with windows, you can try to restart your PC @Don – Temirlan Almassov Jan 27 '22 at 22:05