Skip to content

-sdk option does not set android:targetSdkVersion="XX" in AndroidManifest.xml #840

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

Closed
dtopuzov opened this issue Sep 1, 2015 · 0 comments
Assignees
Labels
Milestone

Comments

@dtopuzov
Copy link
Contributor

dtopuzov commented Sep 1, 2015

After we migrated to gradle --sdk option does not set android:targetSdkVersion="XX" in AndroidManifest.xml

Steps to reproduce:
tns create TNS_App
tns platform add android --sdk 19 --frameworkPath tns-android.tgz --path TNS_App

Can't find this in AndroidManifest:
android:targetSdkVersion="19"
It was set correctly before.

@dtopuzov dtopuzov added the bug label Sep 1, 2015
@dtopuzov dtopuzov added this to the 1.3.0 milestone Sep 1, 2015
teobugslayer added a commit that referenced this issue Sep 1, 2015
@vchimev vchimev reopened this Sep 1, 2015
rosen-vladimirov added a commit that referenced this issue Sep 2, 2015
When android platform is added, we should add information about the targetSdk in the created `AndroidManifest.xml`. This way the platform add command will work in the following way:
* `tns platform add android` - adds the android platform and inside `<projectDir>/platforms/android/src/main/AndroidManifest.xml` will add the value of the androidSDK that the CLI had calculated. CLI uses latest supported and installed version of the android SDK, for example if CLI supports versions 21, 22 and 23 and the user had installed 19, 21 and 22, 22 will be used.
* `tns platform add android --sdk <value>` - adds the android platform and inside `<projectDir>/platforms/android/src/main/AndroidManifest.xml` will add the value of the androidSDK that the user had specified (if it is valid one).
The above behavior will fix [this issue](#840)

Every build/run, etc. will use the value specified in the `AndroidManifest.xml`. In case you want to test with another sdk, there's no need to remove the platform and add the platform again. You can use `--sdk` option to all build related commands and this will build the project with the specified SDK version, but will **NOT** update `AndroidManifest.xml`. This way `--sdk` can be used for testing other SDK versions, without breaking the current project.

> NOTE: In case you have not added platform and you run `tns <run/build/deploy/prepare/update> android --sdk 19`, this will add the android platform and specify android:targetSdkVersion="19" in the `AndroidManifest.xml` file. All other calls will not update the AndroidManifest.xml file.
@rosen-vladimirov rosen-vladimirov self-assigned this Sep 2, 2015
rosen-vladimirov added a commit that referenced this issue Sep 5, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
rosen-vladimirov added a commit that referenced this issue Sep 5, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
rosen-vladimirov added a commit that referenced this issue Sep 7, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
rosen-vladimirov added a commit that referenced this issue Sep 7, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
rosen-vladimirov added a commit that referenced this issue Sep 7, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
rosen-vladimirov added a commit that referenced this issue Sep 7, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
rosen-vladimirov added a commit that referenced this issue Sep 7, 2015
We should pass correct parameters to android build. We need:
* Compile SDK - at least 21
* BuildTools version - at least 22
* AppCompat lib (Android Support) version - same as compile SDK
* Target SDK - the selected target by user - there's no need to have it

Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.

Fixes #840
@dtopuzov dtopuzov assigned dtopuzov and unassigned rosen-vladimirov Sep 8, 2015
vchimev pushed a commit to NativeScript/nativescript-cli-tests that referenced this issue Sep 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants