Updated to SDK34 but "expo build:android" still using SDK32

Title edited, old title :
SDK 34 produces .apk/.aab with “Target API 26”

Hi there,

I recently tried to upload an apk file (built with Expo SDK 32) to google play console, and ended up with the following error :

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

I’ve tried updating to SDK 33, but the new APK built with SDK 33 got the same error, so I tried updating to SDK 34 (correcting code and updating dependencies in the meantime), but I still got the same error from google play console with SDK 34.

Each time I updated the SDK, I also changed the sdkVersion in app.json. I’ve also deleted node-modules folder after each upgrade, and deleted cache with expo r -c.
So right now, I’m using these :

"expo": "^34.0.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-34.0.0.tar.gz",
"react": "16.8.3",

expo-cli “3.0.10” and sdkVersion is set to “34.0.0”, building using “expo build:android --no-publish”, but google play console is still saying I’m using target API 26.
Building an app-bundle using “-t app-bundle” has also the same result.

Is there something I’m missing, or some package I forgot to update in order for expo to build the apk using target API 28 ?

Thanks for your time and have a great day

EDIT
Running throught the build logs, I’ve found something strange, the build is still using SDK 32 :

/app/turtle/workingdir/android/sdk32/tools-public /app/turtle/workingdir/android/sdk32/android/app
/app/turtle/workingdir/android/sdk32/android/app
> Task :app:processProdKernelReleaseGoogleServices
Parsing json file: /app/turtle/workingdir/android/sdk32/android-shell-app/app/google-services.json

It looks like it’s still using SDK 32 instead of SDK 34 - and that would explain why it’s using ‘target API 26’.

Well ! I solved my issue thanks to this thread :

Quoting from this thread :

it [build:android] reads from the latest published version, so you can either run expo publish again to update it, or you can use expo export and put the resulting files on some hosting service then (if i’m not mistaken, i am not an expert on turtle-cli personally) you should be able to pass in a public-url flag similar to https://docs.expo.io/versions/v31.0.0/distribution/hosting-your-app#build-standalone-app to point to it

In my case I did an “expo publish”, and then ran “expo build:android --no-publish” again, and the builds logs changed, using sdk34 for everything this time.

Might be that running “expo build:android” the first time (without the no-publish option) would have worked, but I was trying to test the .apk before publishing my changes (updating from sdk 32 to 34).

Anyway, problem solved !

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.