For the past 48 hours, I have been struggling to build my Cordova app for Android. Every time I attempt to open my project in Android Studio, I encounter an error during the gradle sync process in the run tasks phase:
ERROR: Manifest merger failed : uses-sdk:minSdkVersion 1 cannot be smaller than version 19 declared in library [__tested_artifact__::CordovaLib]/Users/userName/Downloads/MyApp(1.2.5)/platforms/android/CordovaLib/build/intermediates/library_manifest/debug/AndroidManifest.xml as the library might be using APIs not available in 1
Suggestion: use a compatible library with a minSdk of at most 1, or increase this project's minSdk version to at least 19, or use tools:overrideLibrary="org.apache.cordova" to force usage (may lead to runtime failures)
I have explored various solutions but none have resolved the issue. I have made adjustments in the manifests of my built project and in the cordova.android
node_modules
folder by adding the following values:
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
I have also included the specified values in my config.xml file:
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="28"/>
Furthermore, I have directed Cordova to build specific versions:
cordova platform add <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f899969c8a97919cb8cfd6c8d6c8">[email protected]</a>
Despite these efforts, I continue to encounter the same error message even when altering the numeric values (19 and 1).
In addition, I created a new empty project and attempted to build it with identical results. The project builds without issues on an older machine of mine, however, the Play Store indicates that it is outdated and poses a security risk.
Another detail worth mentioning is that during the Cordova build process, I notice the following information:
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=/Users/userName/Library/Android/sdk (DEPRECATED)