mostafa-mansour1/previewAnyFile

Android build fails - AAPT: error: resource android:attr/lStar not found

maartenheideman opened this issue · 4 comments

Because of the android core:core:1.7.0 update I'll get an error while building an app for android. No changes on the app made but suddenly I’ll became the error Android resource linking failed. AAPT: error: resource android:attr/lStar not found. I'll started to remove plugin for plugin and when I'll remove previewAnyFile I'll be able to build again and the error disappears. I'll also tried to update from previewAnyFile version 0.2.3 to 0.2.8 and 0.2.9 but still get the same error. Hope there is a fix for this.

Full Error

> Task :app:processDebugResources FAILED
AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"/Users/username/.gradle/caches/transforms-2/files-2.1/a569d3e74eb4c0df31a2aa81dc055565/core-1.7.0-beta02/res/values/values.xml","position":{"startLine":104,"startColumn":4,"startOffset":6400,"endLine":113,"endColumn":24,"endOffset":6854}}],"original":"/Users/username/.gradle/caches/transforms-2/files-2.1/a569d3e74eb4c0df31a2aa81dc055565/core-1.7.0-beta02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar not found.\n    ","tool":"AAPT"}

Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
   > Android resource linking failed
     /Users/username/.gradle/caches/transforms-2/files-2.1/a569d3e74eb4c0df31a2aa81dc055565/core-1.7.0-beta02/res/values/values.xml:105:5-114:25: AAPT: error: resource android:attr/lStar 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.

I'll know that there is a way to force the core:core version in de app/build.gradle like down here. But unfortunately that's not suitable for my project because this doen't work / applied when building builds with ionic appflow.

configurations.all {
    resolutionStrategy {
        force "androidx.core:core:1.6.0"
    }
}

Ionic info

Ionic:

   ionic (Ionic CLI)             : 4.12.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 5.2.3
   @angular-devkit/build-angular : 0.1100.7
   @angular-devkit/schematics    : 9.1.11
   @angular/cli                  : 10.0.8
   @ionic/angular-toolkit        : 2.3.0

Capacitor:

   capacitor (Capacitor CLI) : 2.5.0
   @capacitor/core           : 2.5.0

System:

   NodeJS : v14.17.0 (/usr/local/bin/node)
   npm    : 6.14.13
   OS     : macOS

Thanx for the reply. I'll tried version 0.2.9 without luck. But I'll find out that I'll have to update the androidxAppCompatVersion from 1.1.0 to 1.3.1 to. After updating previewAnyFile to 0.2.9 and appCompat to 1.3.1 I'll be able to build for android again 😄

Major source of this issue is appcompat library. As a quick fix to run your project you can use appcompat version below 1.4.0 that is you can switch to appcompat version

implementation 'androidx.appcompat:appcompat:1.3.0'

or below.

I have encounter that error and when I have update appcompat fron 1.4.0 to 1.3.0 I got another error that was not there before which is : Invoke-customs are only supported starting with Android O (--min-api 26) so what should I do then?