Khadreal
Khadreal

Reputation: 731

Nativescript API LEVEL

I built an android app with Nativescript framework, I tried to upload my SDK to play store and am getting this error below

"Your app currently targets API level 25 and must target at least API level 26 to ensure it is built on the latest APIs optimized for security and performance. Change your app's target API level to at least 26."

I have change the API LEVEL in AndroidManifest.xml but that doesn't seems to work, how can I fix this issue.

Upvotes: 3

Views: 2650

Answers (2)

Velunce
Velunce

Reputation: 1

Sharing the experience with NativeScript6 project, which upgrade the API level to 33 and released on the Google Play.

You should update 3 files:

  • [Project Root] >> App_Resources >> Android >> app.gradle
  • [Project Root] >> App_Resources >> Android >> src >> main >> AndroidManifest.xml
  • [Project Root] >> references.d.ts
  1. Update app.gradle file add minSdkVersion and targetSdkVersion.

    android{
        defaultConfig{
            ...
            minSdkVersion 29
            targetSdkVersion 33
            ...
        }
    }
    
  2. Update AndroidManifest.xml

    <manifest xmlns:android="http://schemas.android.com/apk/res/android">
        ...
        <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="33"/>
        ...
        <application ...>
            <activity ... android:exported="true">
                ...
            </activity>
            ...
        </application>
    </manifest>
    
  3. Update the references.d.ts file (Option)

    /// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
    /// <reference path="./node_modules/tns-platform-declarations/android-24.d.ts" />
    

After completing the above operations, delete folders node_modules and platforms and rebuild your project.


Why the minSdkVersion is not set to 33?

Because the minSdkVersion determines whether refer to the latest permission required for advertising ID in Google Play services.

Behavior changes: Apps targeting Android 13 or higher

You can decide whether to do this.

Hope it helps you!

Upvotes: 0

Nick Iliev
Nick Iliev

Reputation: 9670

After changing the targetSdkVersion in AndroidManifest.xml make a clean rebuild to amek sure that the changes are applied in the Android project.

If the above is not working you could explicitly set the targetSdkVersion in your project's app.gradle file as done here

Upvotes: 5

Related Questions