Closed aaarichter closed 1 year ago
post your config.xml
please
android-targetSdkVersion
preference if set will influence/override the defaults. If you do not explicitly set it, then I'd scan your plugin's plugin.xml
files to see if they set it (which they shouldn't but I see some plugins do)
@breautek
<?xml version='1.0' encoding='utf-8'?>
<widget android-versionCode="${ANDROID_VERSION_CODE}" id="de.raps.myrazept" ios-CFBundleVersion="${IOS_BUNDLE_VERSION}" version="1.0.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android">
<name>myRAzept</name>
<author email="info@raps.com" href="https://www.raps.de/">
RAPS GmbH & Co. KG
</author>
<content src="index.html" />
<access origin="*" />
<allow-navigation href="https://*.k8s.incloud.de/*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<preference name="DisallowOverscroll" value="true" />
<preference name="BackgroundColor" value="0xffffffff" />
<preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#ffffff" />
<preference name="StatusBarDefaultScrollToTop" value="true" />
<preference name="HeaderColor" value="#ffffff" />
<preference name="ShowSplashScreenSpinner" value="false" />
<icon src="res/icon/ios/Icon-1024.png" />
<platform name="android">
<icon density="mdpi" src="res/icon/android/mipmap-mdpi/ic_launcher.png" />
<icon density="hdpi" src="res/icon/android/mipmap-hdpi/ic_launcher.png" />
<icon density="xhdpi" src="res/icon/android/mipmap-xhdpi/ic_launcher.png" />
<icon density="xxhdpi" src="res/icon/android/mipmap-xxhdpi/ic_launcher.png" />
<icon density="xxxhdpi" src="res/icon/android/mipmap-xxxhdpi/ic_launcher.png" />
<preference name="AndroidWindowSplashScreenAnimatedIcon" value="res/screen/android/splash.png" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="StatusBarStyle" value="default" />
<preference name="android-targetSdkVersion" value="28" />
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<icon height="20" src="res/icon/ios/Icon-20.png" width="20" />
<icon height="29" src="res/icon/ios/Icon-29.png" width="29" />
<icon height="40" src="res/icon/ios/Icon-40.png" width="40" />
<icon height="58" src="res/icon/ios/Icon-58.png" width="58" />
<icon height="60" src="res/icon/ios/Icon-60.png" width="60" />
<icon height="76" src="res/icon/ios/Icon-76.png" width="76" />
<icon height="80" src="res/icon/ios/Icon-80.png" width="80" />
<icon height="87" src="res/icon/ios/Icon-87.png" width="87" />
<icon height="120" src="res/icon/ios/Icon-120.png" width="120" />
<icon height="152" src="res/icon/ios/Icon-152.png" width="152" />
<icon height="167" src="res/icon/ios/Icon-167.png" width="167" />
<icon height="180" src="res/icon/ios/Icon-180.png" width="180" />
<icon height="1024" src="res/icon/ios/Icon-1024.png" width="1024" />
<splash src="res/screen/ios/Default@2x~universal~anyany.png" />
<config-file parent="ITSAppUsesNonExemptEncryption" target="*-Info.plist">
<false />
</config-file>
<config-file mode="replace" parent="CFBundleDevelopmentRegion" target="*-Info.plist">
<array>
<string>de-DE</string>
</array>
</config-file>
<config-file mode="replace" parent="CFBundleLocalizations" target="*-Info.plist">
<array>
<string>de</string>
</array>
</config-file>
<preference name="StatusBarStyle" value="default" />
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
I removed the <plugin>
and <engine>
settings for testing purpose. With or without those tags, which were reflecting the versions from the package.json, the issue occurred.
There is
<preference name="android-targetSdkVersion" value="28" />
in your android's <platform>
block. That's what's overriding the SDK_VERSION in the gradle config and causing the app to target & compile using SDK 28.
I'd recommend removing it to let it default to cordova-android default, which on version 11.x is API 32.
If there is a need to target API 31 for whatever reason, then I'd suggest doing:
<preference name="android-targetSdkVersion" value="31" />
<preference name="android-compileSdkVersion" value="32" />
This is so that the code will still compile using API 32, but your app will target API 31.
Note that targeting API 33 is not supported on cordova-android@11 (may or may not work, API 33 support is coming in our next release)
Please let me know if this solves your issue.
oh I totally missed this . thank you so much @breautek :octocat: - it worked perfectly.
I'm resolving this issue.
One more question. I uploaded the generate apk file to the play console and there is a warning saying that there isn't a file that discloses obfuscated code (R8/ProGuard). Is there a way to generate this disclosure file with cordova? Or should one migrate to the Android App Bundle format?
One more question. I uploaded the generate apk file to the play console and there is a warning saying that there isn't a file that discloses obfuscated code (R8/ProGuard). Is there a way to generate this disclosure file with cordova? Or should one migrate to the Android App Bundle format?
I'm not 100% sure what you're seeing but Cordova doesn't provide any ProGuard/R8 configuration. Mostly because it's not very useful since it will break Cordova. ProGuard (or R8) obfuscates the native code and mangles symbols so it makes it more difficult to reverse engineer, and to also to make the final product size smaller. But Cordova relies on finding classes/method names by strings so mangling symbols will break that mechanism.
If you want to use Proguard or R8, it must be configured in a way that it doesn't touch the Cordova classes or plugins.
I think Google will provide the warning when you upload your bundle because they recommend and want to encourage users to use it even if it's just to shrink the file size of your app. But yah, it will break Cordova unless if you tailed it specifically to not touch any cordova bits.
If you develop your own plugins, you could use Proguard/R8 on the plugin by creating an Android library with the cordova bits abstracted out for example, so that the bulk of the library is proguarded while the cordova interface to your plugin is not.
thanks again for your great reply @breautek
Bug Report
Problem
when installing the android platform with
cordova platform add android@11
then theplatforms/android/cdv-gradle-config.json
sets the SDK version to 28What is expected to happen?
that the
SDK_VERSION
version is set to the latest, at least matching theMIN_BUILD_TOOLS_VERSION
What does actually happen?
Inside of CI/CD, gradle checks fail:
Information
Command or Code
in docker
Environment, Platform, Device
running in Gitlab CI
using
beevelop/cordova
docker image:Version information
Checklist