Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App must target Android 15 (API level 35) or higher

I have an kivy app and i compile it via Buildozer.

My settings are:

# (int) Target Android API, should be as high as possible.
android.api = 34

# (int) Minimum API your APK / AAB will support.
android.minapi = 21

# (int) Android SDK version to use
android.sdk = 34

# (str) Android NDK version to use
android.ndk = 25b

Should i change only android.api = 34 to android.api = 35

or

Should i change both android.api = 34 and android.sdk = 34 to android.api = 35 and android.sdk = 35

Thanks for your replies.

like image 984
MECRA YAVCIN Avatar asked Mar 06 '26 10:03

MECRA YAVCIN


1 Answers

For anyone who comes across this and is looking for a solution for an expo React Native App you need to either

  1. Update your expo SDK to v53 (see here: https://expo.dev/changelog/sdk-53) or

  2. (in case you are looking for a quick fix without updating expo AGAIN): set expo-build-properties in app.json or app.config.js (thanks to @Drazar and @HabiburRaman for pointing this out in the comments)

Use expo-build-properties in app.json:

// app.json
{
  "expo": {
    ...
    "plugins": [
      [
        "expo-build-properties",
        {
          "android": {
            "compileSdkVersion": 35,
            "targetSdkVersion": 35,
            "buildToolsVersion": "35.0.0"
          },
        }
      ]
    ]
  }
}

Original Answer:

Creating a custom config plugin:

  1. Create a file named withTargetSdk35.js (or similar) in your project root:

    // withTargetSdk35.js
    const { withAppBuildGradle } = require('@expo/config-plugins');
    
    module.exports = function withTargetSdk35(config) {
      return withAppBuildGradle(config, (config) => {
        if (config.modResults.language === 'groovy') {
          config.modResults.contents = config.modResults.contents.replace(
            /targetSdkVersion\s*\d+/,
            'targetSdkVersion 35'
          );
        } else {
          throw new Error('Cannot modify build.gradle: unexpected language');
        }
        return config;
      });
    };
    
    
  2. Register the Plugin in app.json or app.config.js

    1. If you're using app.json :

      {
        "expo": {
          ...
          "plugins": ["./withTargetSdk35"]
        }
      }
      
    2. If you're using app.config.js

      import withTargetSdk35 from './withTargetSdk35';
      
      export default {
        expo: {
          ...
          plugins: [withTargetSdk35],
        },
      };
      
like image 166
Daniel Avatar answered Mar 08 '26 22:03

Daniel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!