mostafa-mansour1 / previewAnyFile

Cordova Plugin to preview any file in native mode by providing the local or external URL
MIT License
33 stars 31 forks source link

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

Closed maartenheideman closed 2 years ago

maartenheideman commented 2 years ago

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
mostafa-mansour1 commented 2 years ago

We already fixed this Kindly use the latest version Remove the plugin and add it again

Regards,


Mostafa Mansour Software Engineer 00971 524988466

On 15 Oct 2021, at 8:57 AM, Maarten Heideman @.***> wrote:



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.

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" //This is stable version right now. } }

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/mostafa-mansour1/previewAnyFile/issues/39, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABSFOBYCZM3RQQRKAWPGLALUG6YDHANCNFSM5GBERYSA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

maartenheideman commented 2 years ago

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 😄

Mudit063 commented 2 years ago

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.

Mohamed7422 commented 2 years ago

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?