breautek commented on issue #1070: URL: https://github.com/apache/cordova-android/issues/1070#issuecomment-712128530
The problem is in the android project, we have 2 modules, the `app` module, and the `CordovaLib` module, and it looks like the preferences only changes the min sdk for the `app` module and the `CordovaLib` remains the default min sdk of 22, which is an incompatible app config. As jcesar pointed out in the dev mailing list, I think this is something that can and should be fixed so I'll reopen this ticket. To re-iterate from previous comments, this is only to keep the `CordovaLib` and `app` module min sdks in sync so it doesn't cause the gradle error. A PR that patches this is welcome. This error could still come up via third-party libraries if they define a min sdk value. Lowering the min sdk could also make your app crash during runtime when attempting to use an API that may not exists on older devices. In the meantime, this untested workaround could suffice: __config.xml__ ```xml <widget ... xmlns:tools="http://schemas.android.com/tools"> <edit-config file="AndroidManifest.xml" target="/manifest" mode="merge"> <manifest xmlns:tools="http://schemas.android.com/tools" /> </edit-config> <edit-config file="AndroidManifest.xml" target="/manifest/uses-sdk" mode="merge"> <uses-sdk tools:overrideLibrary="<packageThatNeedsToBeOverridden>" /> </edit-config> </widget> ``` Where `packageThatNeedsToBeOverridden` should be a string of a package name. I don't quite remember exactly that this is for Cordova generally the error output for min sdk mismatches states the library package name. This can be a comma delimited list if there are multiple packages to override. Lastly, I believe `<edit-config>` targeting `uses-sdk` can fail if your `AndroidManifest.xml` has no `<uses-sdk>` tag to modify. If that's the case of your app, I think you can replace it with `config-file` instead like so: ```xml <config-file target="AndroidManifest.xml" parent="/manifest"> <uses-sdk tools:overrideLibrary="<packageThatNeedsToBeOverridden>" /> <config-file> ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
