Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix for #417 breaks the build for any apps targeting sdk 28 and lower. #424

Closed
1 of 3 tasks
mkdillard opened this issue Sep 28, 2020 · 5 comments · Fixed by #439
Closed
1 of 3 tasks

Fix for #417 breaks the build for any apps targeting sdk 28 and lower. #424

mkdillard opened this issue Sep 28, 2020 · 5 comments · Fixed by #439

Comments

@mkdillard
Copy link

mkdillard commented Sep 28, 2020

Bug Report

Problem

android:requestLegacyExternalStorage="true" is only supported starting at sdk 29
When using this plugin on Cordova Android 9.0.0 and targeting an older (But still supported) sdk the cordova build is failing.

What is expected to happen?

The build should succeed on older still supported versions of the sdk.

What does actually happen?

> Task :app:processReleaseResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> Android resource linking failed
  /Users/MKD5LA4/gitRepos/github.homedepot.com/DAP/FP_DeviceTracker/platforms/android/app/build/intermediates/merged_manifests/release/AndroidManifest.xml:23: AAPT: error: attribute android:requestLegacyExternalStorage not found.

  error: failed processing manifest.

Information

https://cordova.apache.org/announcements/2020/06/29/cordova-android-9.0.0.html
The minimum SDK version is set to 22.
The non default android sdk versions should not break.

Command or Code

cordova build android

Environment, Platform, Device

In linux and osx, builds failing on all developer machines and linux ci servers.

Version information

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above
@breautek
Copy link
Contributor

What build tools version are you using?

@mkdillard
Copy link
Author

Yep sorry hit enter instead of shift+enter, edited more information in now
We're using cordova cli 9.0.0, cordova android 8.1.0 and targeting sdk 28. We can't move to cordova android 9.0.0 because we still need to support Android 4.4 devices (unfortunately).

@breautek
Copy link
Contributor

Sorry, I meant in the android SDK, what build tools version do you have installed/using? You'll be able to see installed using the android SDK manager GUI.

But to see specifically which one you're using, you'd probably have to look at your system environment PATH variable. You should have something like: /path/to/android/sdk/build-tools/29.0.2. However if you're using cordova-android@8 then your build tools version should be 28.0.3.

If it's not working on 28.0.3, then I would try upgrading to 29.0.2 You should be able to use build tools 29.0.2 and still build on cordova-android@8 targeting API 28 (do note that google will start requiring target API 29 soon however). If it works in build tools 29, then it does point out that adding the legacy flag is a breaking change and cordova-plugin-file should probably have a major version bump.

@sithwarrior
Copy link

As @breautek mentions, you should still be able to build the app with latest buildtools and target lower api versions.

However starting 2/11, 8 days ago, min target sdk level for the playstore is 29.

@breautek
Copy link
Contributor

breautek commented Nov 25, 2020

I just bumped the version of this plugin to target a major release and to force cordova-android@9.

Just a reminder for those who run into this issue. This isn't a target sdk problem, it's a build tools version issue. So in addition to upgrading to cordova-android@9, you must also update your android sdk build tools as well, as documented in Developing for Android

With cordova-android@9 and the proper build tools, you can still target SDK lower than 29, even with the requestLegacyExternalStorage flag set.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants