Matthew Goulart
Matthew Goulart

Reputation: 3065

Change nativescript android api version

I am using:

nativescript has an 8.0.1 version and is up to date.
@nativescript/core has an 8.0.4 version and is up to date.
@nativescript/ios are not installed.
@nativescript/android has an 8.0.0 version and is up to date.

I am trying to get my app to target minSdkVersion 19, but no matter what I do, the app is compiled with version 17.

I tried:

I've looked around and I can't find the solution, though I have come across a few posts about the same issue. None of them solved the issue.

The project in question is here, just clone it and run tns build android. It will build with android-platform-17.d.ts. If you want to see the build fail when using a type from platform 19, just add let test = new android.bluetooth.BluetoothGattCallback().

Upvotes: 1

Views: 1336

Answers (1)

Ashwin
Ashwin

Reputation: 52

The default value in the file node_modules/@nativescript/types-android/lib/android.d.ts is <reference path="./android-17.d.ts" /> so it is building with android-platform-17.d.ts. Try changing the value to <reference path="./android-19.d.ts" /> in that file and build it.

I tried to build after changing it in your code and due to a different reason the build failed which is Cannot create an instance of an abstract class. This error occurred because android.bluetooth.BluetoothGattCallback is actually a class but you are trying to use it like a function.

Upvotes: 1

Related Questions