Skip to content
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

Android SDK 29 support #4926

Closed
15 tasks done
KristianDD opened this issue Aug 1, 2019 · 9 comments · Fixed by #4988
Closed
15 tasks done

Android SDK 29 support #4926

KristianDD opened this issue Aug 1, 2019 · 9 comments · Fixed by #4988
Assignees
Labels
build Describes issues related to build operations debug feature os: android run Describes issues related to run command unit testing
Milestone

Comments

@KristianDD
Copy link
Contributor

KristianDD commented Aug 1, 2019

Is your feature request related to a problem? Please describe.
NativeScript should be able to build applications with Android SDK29

Describe the solution you'd like
The Android SDK29 should be chosen by default if available on the machine.

Describe alternatives you've considered
No alternatives

Additional context
There are currently two places where we keep the compatible Android SDK versions - NS CLI and NS Doctor. This makes the update difficult and no straight forward. There is also a lot of repetition of code in android-tools-info modules inside the CLI and NS Doctor. For future updates it will be beneficial to extract the logic at one place.

If the targeted device is APK Level 29(Android 10) the application should use the next version of NativeScript Adnroid Runtime!

Acceptance Criteria
Valid values for --compileSdk are >=28. (should be installed)
Valid values for --sdk are >= 17 <=29 (corresponds to targetSdk and not mandatory to be installed)
Valid Android build tools on the machine are >=23 (should be installed)

  • 1. SDK 29 should be chosen by default if available on the machine. You can verify that SDK 29 was used by using Analyze APK inside Android Studio and check the values inside Manifest.xml.
  • 2. Deploy, run, debug and test should work as expected. - test against an API 28 and API 29 devices.
  • 3. Validations from the doctor for tns run android should be the same as in previous version. Can add a plugin that needs build (has Manifest.xml and include.gradle but no .aar in package). This can be emulated installing nativescript-mapbox, deleting the .aar file from node_modules/nativescript-mapbox and then copy the Manifest.xml from here.
    • a. tns build android --compileSdk 16 where SDK16 is installed
    • b. tns build android --compileSdk 25 where SDK25 is not installed
    • c. Rename android sdk folder.
    • d. Remove all SDKs that are supported by NS >= 17 <=29
    • e. Remove SDKs above SDK 27
    • f. When SDK 28 and 29 are available, if project is with Android Runtime 6.0.0, SDK28 should be used and when project is with Android Runtime 6.1.0 SDK29 should be used.
  • 4. Same as 3 but with tns plugin build - should clone a plugin that has platforms\Android\Manifest.xml. - for example this one.
    • a. tns plugin build --compileSdk 16 where SDK16 is installed
    • b. tns plugin build --compileSdk 25 where SDK25 is not installed
    • c. Rename android sdk folder.
    • d. Remove all SDKs that are supported by NS >= 17 <=29
    • e. Remove SDKs above SDK 27
@KristianDD KristianDD added this to the 6.1.0 milestone Aug 1, 2019
@KristianDD KristianDD self-assigned this Aug 1, 2019
@rosen-vladimirov
Copy link
Contributor

Due to issues with Android Runtime when building the applications with Android SDK 29 and running them on devices (emulators) with SDK 29 that are fixed in Android Runtime (tns-android package) 6.1.0, the following logic is implemented in CLI:

SDK Installed tns-android < 6.1.0 tns-android 6.1.0 or later
Android SDK 28 and 29 CLI will use SDK 28 CLI will use SDK 29
Android SDK 28 CLI will use SDK 28 CLI will use SDK 28
Android SDK 29 CLI will not allow build and throw an error CLI will use SDK 29

Description of the table:

  • In case you have both Android SDK 29 and 28 installed, but you are still using Android Runtime (tns-android) before 6.1.0, CLI will use SDK 28.
  • In case you have both Android SDK 29 and 28 installed, and you are using Android Runtime (tns-android) 6.1.0 or later (including pre-release versions of 6.1.0), CLI will use SDK 29.
  • In case you have only Android SDK 28 installed, and you are still using Android Runtime (tns-android) before 6.1.0, CLI will use SDK 28.
  • In case you have only Android SDK 28 installed, and you are using Android Runtime (tns-android) 6.1.0 or later (including pre-release versions of 6.1.0), CLI will use SDK 28.
  • In case you have only Android SDK 29 installed, and you are still using Android Runtime (tns-android) before 6.1.0, CLI will throw an error that this combination is not supported. In this case you can either install Android SDK 28 or update your Android Runtime version to latest version (tns platform remove android && tns platform add android@latest).
  • In case you have only Android SDK 29 installed and you are using Android Runtime (tns-android) 6.1.0 or later (including pre-release versions of 6.1.0), CLI will use SDK 29.

@rosen-vladimirov rosen-vladimirov added build Describes issues related to build operations debug feature os: android run Describes issues related to run command unit testing labels Aug 21, 2019
@endarova
Copy link
Contributor

In case you have only Android SDK 29 installed, and you are still using Android Runtime (tns-android) before 6.1.0 there is not descriptive error that this combination is not supported

@JamesPJ
Copy link

JamesPJ commented Sep 1, 2020

In case you have only Android SDK 29 installed, and you are still using Android Runtime (tns-android) before 6.1.0 there is not descriptive error that this combination is not supported

I'm bit confused with the statement there is not descriptive error that this combination is not supported.

I'm having NS 5.4 and the app built on angular 4. But, if I build the app with taregetSDK 29. The installed app start crashing.

Also I've tried upgrading to latest NativeScript version. But, I noticed it is required to have the latest version of Angular. And my code needs lot of modificatons. Let me know is there any easy migration path if it is mandatory to have the latest NS cli.

@jamescodesthings
Copy link

If anyone ends up here because they have a build still based on 5.4 they have to support whilst updating is underway I found that the crash on startup issue is NativeScript/android#1458 which was not applied to the 5.x branches.

You can check out android-runtime at the version you need and cherry-pick the commit in to produce a build of 5.4.0 that works on SDK level 29.

@NathanaelA

This comment was marked as abuse.

@leena-bhise
Copy link

@JamesPJ, I'm facing the same issue. Is this issue resolved if yes, So let me know what steps you follow for resolved this issue?

@JamesPJ
Copy link

JamesPJ commented Dec 30, 2020

@leena-bhise Yes, but I had to upgrade to NS{6}

@leena-bhise
Copy link

@JamesPJ, I also upgraded to NS{6} and follow the steps below:

  • Removed node_modules and platforms and hooks and ./gradle folder
  • Installed the NS{6}
  • Then run npm i
  • Then run tns migrate
  • Then tns run android

but still facing the issue. Let me know if I'm missing something.

@JamesPJ
Copy link

JamesPJ commented Dec 30, 2020

@leena-bhise I'm not sure what issue you are facing. But, I had faced issue with certain cli versions. Below are my current cli versions.

tns-android has 6.5.3 version
tns-ios has 6.5.2 version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Describes issues related to build operations debug feature os: android run Describes issues related to run command unit testing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants