Closed betorobson closed 8 years ago
Hi @betorobson ,
Please add the android-minSdkVersion below your credentials located in the config.xml as follows:
<!-- Urban Airship app credentials -->
<preference name="com.urbanairship.production_app_key" value="Your Production App Key" />
<preference name="com.urbanairship.production_app_secret" value="Your Production App Secret" />
<preference name="com.urbanairship.development_app_key" value="Your Development App Key" />
<preference name="com.urbanairship.development_app_secret" value="Your Development App Secret" />
<!-- UA Android SDK requires minimum sdk version to be 16 -->
<preference name="android-minSdkVersion" value="16" />
Still the same :-(
@betorobson Sorry the correct location is in the platform
section in the config.xml as follows:
<platform name="android">
<preference name="android-minSdkVersion" value="16" />
</platform>
I have tried inside platform and it doesn't work neither . However, I fixed it by gradle command arguments!
Looking for Android min sdk on Cordova Docs, I found a way to change Gradle min sdk building. I ran these command:
Build:
cordova build android -- --gradleArg=-PcdvMinSdkVersion=16
Run:
cordova run android -- --gradleArg=-PcdvMinSdkVersion=16
Do you know how to make gradle use android-minSdkVersion on config.xml?
@betorobson What cordova versions are you using?
@rlepinski Cordova 6.3.1 Cordova Android Platform 5.1.1
According to https://cordova.apache.org/docs/en/latest/config_ref/index.html#preferencehttps://cordova.apache.org/docs/en/latest/config_ref/index.html#preference it looks like we are setting it right. Could you post your config.xml?
It might only work when generated the project - http://stackoverflow.com/a/34993175/1637562. could you give that shot? That will delete the Android project and recreate it, so make sure you are not going to lose any changes.
@rlepinski, I follow these steps below but they doesn't work for me. Same error.
I only can build it running this command:
cordova build android -- --gradleArg=-PcdvMinSdkVersion=16
Here my config.xml
<?xml version='1.0' encoding='utf-8'?>
<widget id="xyz" version="0.4.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Tissi</name>
<description>
xyz
</description>
<author email="xyz@xyz.com" href="http://xyz.com">
xyz
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-navigation href="data:*" />
<allow-navigation href="file:*" />
<allow-navigation href="file:*" />
<allow-navigation href="cdvfile:*" />
<allow-navigation href="http://*/*" />
<allow-navigation href="https://*/*" />
<access origin="*" />
<access launch-external="yes" origin="tel:*" />
<access launch-external="yes" origin="geo:*" />
<access launch-external="yes" origin="mailto:*" />
<access launch-external="yes" origin="sms:*" />
<access launch-external="yes" origin="market:*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<preference name="android-minSdkVersion" value="16" />
<preference name="StatusBarBackgroundColor" value="#f26b35" />
<preference name="android-manifest/application/activity/@android:theme" value="@android:style/Theme.DeviceDefault" />
<preference name="android-manifest/supports-screens/@android:xlargeScreens" value="false" />
<icon density="ldpi" src="res/icon/android/drawable-ldpi/ic_launcher.png" />
<icon density="mdpi" src="res/icon/android/drawable-mdpi/ic_launcher.png" />
<icon density="hdpi" src="res/icon/android/drawable-hdpi/ic_launcher.png" />
<icon density="xhdpi" src="res/icon/android/drawable-xhdpi/ic_launcher.png" />
<icon density="xxhdpi" src="res/icon/android/drawable-xxhdpi/ic_launcher.png" />
<icon density="xxxhdpi" src="res/icon/android/drawable-xxxhdpi/ic_launcher.png" />
<splash density="land-hdpi" src="res/screen/android/land-hdpi/default.png" />
<splash density="land-ldpi" src="res/screen/android/land-ldpi/default.png" />
<splash density="land-mdpi" src="res/screen/android/land-mdpi/default.png" />
<splash density="land-xhdpi" src="res/screen/android/land-xhdpi/default.png" />
<splash density="land-xxhdpi" src="res/screen/android/land-xxhdpi/default.png" />
<splash density="land-xxxhdpi" src="res/screen/android/land-xxxhdpi/default.png" />
<splash density="port-hdpi" src="res/screen/android/port-hdpi/default.png" />
<splash density="port-ldpi" src="res/screen/android/port-ldpi/default.png" />
<splash density="port-mdpi" src="res/screen/android/port-mdpi/default.png" />
<splash density="port-xhdpi" src="res/screen/android/port-xhdpi/default.png" />
<splash density="port-xxhdpi" src="res/screen/android/port-xxhdpi/default.png" />
<splash density="port-xxxhdpi" src="res/screen/android/port-xxxhdpi/default.png" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon height="180" src="res/icon/ios/icon-60@3x.png" width="180" />
<icon height="60" src="res/icon/ios/Icon-60.png" width="60" />
<icon height="120" src="res/icon/ios/Icon-60@2x.png" width="120" />
<icon height="76" src="res/icon/ios/Icon-76.png" width="76" />
<icon height="152" src="res/icon/ios/Icon-76@2x.png" width="152" />
<icon height="167" src="res/icon/ios/Icon-83.5@2x.png" width="167" />
<icon height="40" src="res/icon/ios/Icon-40.png" width="40" />
<icon height="80" src="res/icon/ios/Icon-40@2x.png" width="80" />
<icon height="57" src="res/icon/ios/Icon.png" width="57" />
<icon height="114" src="res/icon/ios/Icon@2x.png" width="114" />
<icon height="72" src="res/icon/ios/Icon-72.png" width="72" />
<icon height="144" src="res/icon/ios/Icon-72@2x.png" width="144" />
<icon height="29" src="res/icon/ios/Icon-Small.png" width="29" />
<icon height="58" src="res/icon/ios/Icon-Small@2x.png" width="58" />
<icon height="87" src="res/icon/ios/Icon-Small@3x.png" width="87" />
<icon height="50" src="res/icon/ios/Icon-Small-50.png" width="50" />
<icon height="100" src="res/icon/ios/Icon-Small-50@2x.png" width="100" />
<splash height="480" src="res/screen/ios/Default.png" width="320" />
<splash height="960" src="res/screen/ios/Default@2x.png" width="640" />
<splash height="1024" src="res/screen/ios/Default-Portrait.png" width="768" />
<splash height="2048" src="res/screen/ios/Default-Portrait@2x.png" width="1536" />
<splash height="768" src="res/screen/ios/Default-Landscape.png" width="1024" />
<splash height="1536" src="res/screen/ios/Default-Landscape@2x.png" width="2048" />
<splash height="1136" src="res/screen/ios/Default-568h@2x.png" width="640" />
<splash height="1334" src="res/screen/ios/Default-667h@2x.png" width="750" />
<splash height="2208" src="res/screen/ios/Default-Portrait-736h@3x.png" width="1242" />
<splash height="1242" src="res/screen/ios/Default-Landscape-736h@3x.png" width="2208" />
</platform>
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="3000" />
<preference name="FadeSplashScreenDuration" value="1000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="true" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="KeyboardShrinksView" value="true" />
<preference name="DisallowOverscroll" value="true" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<plugin name="cordova-custom-config" spec="~2.0.0" />
<plugin name="cordova-plugin-compat" spec="~1.0.0" />
<plugin name="cordova-plugin-device" spec="~1.1.2" />
<plugin name="cordova-plugin-dialogs" spec="~1.2.1" />
<plugin name="cordova-plugin-file" spec="~4.2.0" />
<plugin name="cordova-plugin-file-transfer" spec="~1.5.1" />
<plugin name="cordova-plugin-keyboard" spec="~1.1.4" />
<plugin name="cordova-plugin-network-information" spec="~1.2.1" />
<plugin name="cordova-plugin-spinner-dialog" spec="~1.3.1" />
<plugin name="cordova-plugin-splashscreen" spec="~3.2.2" />
<plugin name="cordova-plugin-statusbar" spec="~2.1.3" />
<plugin name="cordova-plugin-whitelist" spec="~1.2.2" />
<engine name="ios" spec="~4.1.1" />
<preference name="TwitterConsumerKey" value="xyz" />
<preference name="TwitterConsumerSecret" value="xyz" />
<plugin name="twitter-connect-plugin" spec="~0.5.0">
<variable name="FABRIC_KEY" value="xyz" />
</plugin>
<plugin name="cordova-plugin-facebook4" spec="~1.7.1">
<variable name="APP_ID" value="xyz" />
<variable name="APP_NAME" value="xyz" />
</plugin>
<plugin name="cordova-plugin-googleplus" spec="https://github.com/EddyVerbruggen/cordova-plugin-googleplus">
<variable name="REVERSED_CLIENT_ID" value="xyz" />
</plugin>
<plugin name="cordova-plugin-google-analytics" spec="~0.8.1" />
<plugin name="phonegap-plugin-barcodescanner" spec="~6.0.2">
<variable name="CAMERA_USAGE_DESCRIPTION" value="Escanear codigo de barras" />
</plugin>
<preference name="com.urbanairship.production_app_key" value="" />
<preference name="com.urbanairship.production_app_secret" value="" />
<preference name="com.urbanairship.development_app_key" value="xyz" />
<preference name="com.urbanairship.development_app_secret" value="xyz" />
<preference name="com.urbanairship.gcm_sender" value="xyz" />
<preference name="com.urbanairship.in_production" value="false" />
<preference name="com.urbanairship.enable_push_onlaunch" value="true" />
<preference name="com.urbanairship.notification_icon" value="ic_notification" />
<preference name="com.urbanairship.notification_accent_color" value="#f26b35" />
<preference name="com.urbanairship.clear_badge_onlaunch" value="true" />
<plugin name="urbanairship-cordova" spec="~6.0.0" />
<engine name="android" spec="~5.2.2" />
</widget>
Whats really weird is I didnt even have to set it to 16 from a fresh project using 5.2.2. In platforms/android/build/manifests/full/debug/AndroidManifest.xml I see:
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="23" />
Could you print out the output of ./gradlew cdvPrintProps
from the platform/android directory?
It looks like whatever "android-minSdkVersion"
sets minSdkVersion in the main project manifest. When you generate a project you should see: <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="23" />
. Now that value is typically ignored in the new gradle build system and instead it will be replaced by whatever the build.gradle file says in the minSdkVersion. Looks like cordova will parse the manifest for a default value but allow overriding that value with the
cdvMinSdkVersion
that you can set in a few different ways.
So either your manifest is not generating the minSdkVersion or you have an environment variable set up to override the version. Check the manifest first, then the cdvPrintProps
should print out the overrides.
I got this cdvPrintProps
:cdvPrintProps cdvCompileSdkVersion=android-23 cdvBuildToolsVersion=19.1.0 cdvVersionCode=null cdvMinSdkVersion=15 cdvBuildMultipleApks=false cdvReleaseSigningPropertiesFile=null cdvDebugSigningPropertiesFile=null cdvBuildArch=null computedVersionCode=400
cdvMinSdkVersion=15
is the reason for your troubles. It looks like cordova is pulling that in from somewhere. Could you post the output of printenv | grep "cdvMinSdkVersion"
and find . -type f -exec grep -H 'cdvMinSdkVersion' {} \;
This printenv return empty. Ok, no worries mattes.
I can go for now using that argument or set manually the cdvMinSdkVersion by exporting it trough:
export ORG_GRADLE_PROJECT_cdvMinSdkVersion=16
Thank you anyway for your help :-D
After upgrade to release 6.0, it won't build my Android project. Have a look on my error:
I already add on config.xml this: `
`
:processDebugManifest/Users/roberto/Work/planyou/planyou-app/mobileApp/platforms/android/AndroidManifest.xml:70:5-74 Error: uses-sdk:minSdkVersion 15 cannot be smaller than version 16 declared in library [com.urbanairship.android:urbanairship-sdk:8.0.1] /Users/roberto/Work/planyou/planyou-app/mobileApp/platforms/android/build/intermediates/exploded-aar/com.urbanairship.android/urbanairship-sdk/8.0.1/AndroidManifest.xml Suggestion: use tools:overrideLibrary="com.urbanairship" to force usage
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:processDebugManifest FAILED
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':processDebugManifest'.
BUILD FAILED
Total time: 10.165 secs Error: Error code 1 for command: /Users/roberto/Work/planyou/planyou-app/mobileApp/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/roberto/Work/planyou/planyou-app/mobileApp/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true `