-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent handling of min/target SDK values #508
Comments
I think the most straightforward solution would be the following:
I would love to see this cleaned up before we finish the Cordova 9 release (apache/cordova#10). It would be nice if we could come up with a more elegant solution. I personally have no time to look into this, doubt that any other members would have the extra time either. |
How do people configure it via gradle if they're treating the platform as a build artifact? We should be setting the values in gradle based on what's specified in config.xml (and we actually have a way to do that now via GradlePropertiesParser if we so desire) |
Use
That would be really nice. Some pointers how to do this would be great. I personally have no extra time to work on this one. |
@brodybits
The defaults are added around this line. We could add our defaults here for the min and target SDK. Currently, users who want to modify the This file is created and modified by the If the user wanted to modify this file and they didn't commit the platforms, the current best option is to use an We could do something like this: master...erisu:user-custom-gradle-properties-defines This would use one of our existing methods for setting the min and target SDK. The above is a working example of updating the Gradle Properties files, but I suspect there would be a lot more refactoring involved. Hope this helps... |
I had started doing something along these lines, but never got to the point of hooking it up in the prepare step. I added methods to the GradlePropertiesParser to allow setting variables, which you could pull from this commit: dpogue@d18f8d1 |
I would now favor limiting the scope of our changes to read I think the most common issue has been with apps that need to increase the minimum SDK value. We should set target/compile SDK to recent value by default in cordova-android itself. I have encountered enough issues with compile / target SDK values in Gradle. I think there is need to compound these troubles by attempting to read from |
Closing as PR #699 should have resolve this and is merged into master. Should be available with next release. |
cordova-android currently has a few different ways to specify a minimum SDK version and the target SDK version, and they are not equally exposed at various levels of tooling, and they can override each other in non-obvious ways (to non-native Android devs).
Traditionally, we've relied on the
<uses-sdk>
element in AndroidManifest.xml to specify the minimum, target, and (optionally) the maximum SDK versions. These can be customized via<preference>
elements in an app's config.xml (android-minSdkVersion
,android-targetSdkVersion
, andandroid-maxSdkVersion
respectively).We also allow specifying these values via Gradle variables (
cdvMinSdkVersion
, andcdvCompileSdkVersion
). If these variables are not specified, we default them.According to Google's documentation:
In particular, I'm concerned about the possibility of someone specifying a minimum SDK version in config.xml, and that getting overridden by the default minimum SDK version of 19 via gradle.
Google seems to recommend using Gradle properties, which was also brought up in my PR about updating the Gradle build files.
It seems to me like the correct thing to do is to take the SDK versions specified in config.xml and transform them into both
<uses-sdk>
attributes (as is done currently), but also into gradle properties. We don't currently have a good way to do that, but @erisu's PR #465 provides a gradle.properties file that we could injectcdvMinSdkVersion
andcdvCompileSdkVersion
into.Thoughts/Concerns/Feedback?
The text was updated successfully, but these errors were encountered: