camera-preview icon indicating copy to clipboard operation
camera-preview copied to clipboard

resource android:attr/lStar not found build error (Android)

Open ryaa opened this issue 3 years ago • 1 comments

Describe the bug The below build error is thrown

> Task :capacitor-community-camera-preview:verifyReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':capacitor-community-camera-preview:verifyReleaseResources'.
> A failure occurred while executing com.android.build.gradle.tasks.VerifyLibraryResourcesTask$Action
   > Android resource linking failed
     ERROR:/Users/alexryltsov/Git/BOSS811-MOBILE/release-build-3.0.0/node_modules/@capacitor-community/camera-preview/android/build/intermediates/merged_res/release/values/values.xml:2530: AAPT: error: resource android:attr/lStar not found.

To Reproduce The problem is that one of the external libraries the app depends on has a dependency on androidx.core:core-ktx:+ which meant that was always compiling with the latest version. The plugin uses compile SDK 30 (https://github.com/capacitor-community/camera-preview/blob/6e1dffcad3b45beb311e2fe461fbcc0aa0c9664f/android/build.gradle#L14), but the latest version of androidx.core:core-ktx has the minimal SDK of 31, which resulted in this conflict. In the the android project android/variables.gradle file (see https://github.com/ionic-team/capacitor/blob/main/android-template/variables.gradle) I changed compileSdkVersion and targetSdkVersion to 31 however the plugin uses hardcoded compile SDK version

Expected behavior The plugin should use the compile SDK (and some other variables) version from the main project. No error and the build (APK file) is successfully created

Screenshots N/A

Additional context `Alexs-MBP:release-build-3.0.0 alexryltsov$ ionic info

Ionic:

Ionic CLI : 6.19.1 (/Users/alexryltsov/.nvm/versions/node/v16.15.0/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 6.1.8 @angular-devkit/build-angular : 13.3.7 @angular-devkit/schematics : 13.3.7 @angular/cli : 13.3.7 @ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 3.5.1 @capacitor/android : 3.5.1 @capacitor/core : 3.5.1 @capacitor/ios : 3.5.1

Utility:

cordova-res : not installed globally native-run : 1.6.0

System:

NodeJS : v16.15.0 (/Users/alexryltsov/.nvm/versions/node/v16.15.0/bin/node) npm : 8.10.0 OS : macOS Monterey`

ryaa avatar Jun 08 '22 11:06 ryaa

The PR with the fix is provided https://github.com/capacitor-community/camera-preview/pull/229

The change is for build.gradle (based on the capacitor template plugin - see https://github.com/ionic-team/create-capacitor-plugin/blob/main/assets/plugin-template/android/build.gradle) which uses the main project variables

ryaa avatar Jun 08 '22 11:06 ryaa

Closing as the PR with the fix has been merged into master and included into the release 3.1.1 - see https://github.com/capacitor-community/camera-preview/releases/tag/v3.1.1

ryaa avatar Feb 15 '23 07:02 ryaa