[TIMOB-27696] Android: Add "gradle.properties" support to app builds
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | Low |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2020-01-31T11:00:24.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 9.0.0 |
| Components | Android |
| Labels | android, build, gradle, properties, settings |
| Reporter | Hans Knöchel |
| Assignee | Joshua Quick |
| Created | 2019-12-22T10:23:33.000+0000 |
| Updated | 2020-01-31T11:00:24.000+0000 |
Description
*Summary:*
Titanium app developers would like the ability to set up their own "gradle.properties" file according to Google's documentation. We should add support for this and allow this file to override the properties defined by Titanium's build system.
https://developer.android.com/studio/build#properties-files
*Recommended Solution:*
Copy the properties from the following project file...
./platform/android/gradle.properties
These properties should be copied to the end of the Titanium generated "gradle.properties" file so that the app dev's properties can override the ones we set.
I don't think this is necessary. The properties you set in the
gradle.propertiesfile are copied to the gradleproject.propertiesdictionary in groovy. Which means you can set these properties in yourbuild.gradlescript instead. The below is an example on how to add properties via a Titanium project's./platform/android/build.gradlefile.Note that I thinkandroid.useAndroidXshould be hardcoded totrueonce Titanium switches over to AndroidX. Thelocal.propertiesfile is only for setting paths to the Android SDK, Android NDK, and CMake. The options are limited. What are you after in this file? (Or perhaps you know something I don't?)I was checking for parity with our native Android gradle project, but I think you're right and this can be done via the above as well. I will close the PR and you can resolve this ticket! *EDIT*: Agree with the local.properties, but the gradle.properties should really be able to be overwritten, since store a few other things there as well, which the above syntax looks a bit odd to. And there shouldn't be any downside of making this fully configurable.
Yeah, I can see setting properties via "gradle.properties" being more natural. Especially when Google's official docs tell you to do so. I'll try to be open minding about this. FYI: Setting properties via
project.extis commonly done as well. For example... https://github.com/google/ExoPlayer/blob/release-v2/constants.gradle https://github.com/facebook/facebook-android-sdk/blob/master/constants.gradlePR (main): https://github.com/appcelerator/titanium_mobile/pull/11428
Closing ticket, fix verified in SDK version
9.0.0.v20200130113429Test and other information can be found at: https://github.com/appcelerator/titanium_mobile/pull/11428