[TIMOB-18113] Android: Feature Request to select the Android Build Tools version
GitHub Issue | n/a |
Type | Improvement |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2015-02-13T22:18:13.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 4.1.0 |
Components | Android, CLI |
Labels | n/a |
Reporter | Eduardo Gomez |
Assignee | Tim Poulsen |
Created | 2014-12-01T18:27:51.000+0000 |
Updated | 2017-03-16T22:51:01.000+0000 |
Description
Feature Request Description
It would be great if you could set this as a feature request for the 3.5.0 or 3.5.1 TiSDK. I anticipate that having this ability would reduce the number of different build environments that we would have to maintain and would allow us to upgrade our Android versions at a faster pace.
The request would be to select the Android Build Tools version when launching the ti build command via a parameter.
Use Case
The scenario is as follows. Suppose we have a app 3.4 which is GA'd against the 3.4.1.GA TiSDK Android-18 Target SDK, and the Android 19.1.0 Build Tools. We are now working on our app 3.5 project and want to upgrade to TI 3.5.0.GA and the Android Target SDK to 21 for Android 5.0 support. For Android 5.0 support we have to use build tools 21.0.0. I was wondering if there is a way at build time to select 19.1.0 for the 3.4 app and the 21.0.0 for the 3.5 app via some build time parameter.
Comments
JSON Source
Is there a reason you couldn't use build tools 21 for all versions?
We should definitely support this. Right now, the Android detection code in the Titanium SDK (node_modules/titanium-sdk/lib/android.js) gets the highest version of platform tools and build tools. The current code will need some cleaning up. This logic should take into account the supported build/platform tools defined in the Android platform's package.json vendorDependencies. This will make sure that only the latest supported versions are selected by default. Then these versions should be overridden by the "android.platformTools.selectedVersion" and "android.buildTools.selectedVersion". The actual code would look like:
[~skypanther] Because this is similar to how Windows works with Visual Studio and Windows Phone SDK selection. Remember that the
versions
detected should excluded versions that aren't supported and we only pick the latest if it hasn't been globally set. Ideally we should have a consistent way of having global, project, and build-level settings, but we sorta don't.PR: https://github.com/appcelerator/titanium_mobile/pull/6593 Functional review steps: 1. Determine which build tools are available in your Android SDK (e.g. these are the dir names in ~/android-sdk/build-tools/) 2. Configure the selected build tools version with
ti config android.buildTools.selectedVersion 20.0.0
where the last arg is an installed, but not newest, build tools version 3. Enterti config
and confirm that the value was set. 4. Create and build a Titanium app for Android and watch the output for a reference in the console output to the build tools version, such as\[INFO\] Packaging application: /android-sdk/build-tools/20.0.0/aapt ...
. You can cancel the build at this point. 5. Remove the config setting withti config -r android.buildTools.selectedVersion
6. Enterti config
and confirm that the value was removed. 7. Clean, the build your app again. Look for the build tools version in the log output; it should be the highest version installed on your system. 8. Set the selected build tools version to the earliest installed on your system; install a pre-18 version if necessary. Attempt to build the app. You should receive a warning that you're using an outdated version.PR updated incorporating feedback from Chris: CLI now uses either the selected version, or the newest, supported auto-detected version. (Prior to this ticket, the CLI always used the newest version whether supported or not). If the selected version doesn't exist or is unsupported, gives the same error messages as you'd get previously if no SDK installed, missing executables, etc.
See additional comments on the PR.
See final comments on PR. Merged.
Closing ticket as fixed.