"Android: Could not find ... appcompat-v7 - how to update preinstalled packages"

If you'd get an error in your Android build like: "Could not find com.android.support:appcompat-v7:24.2.0." or: "You have not accepted the license agreements of the following SDK components" Read this!


You can find an up to date version of this issue and fix
on our DevCenter

If you'd get an error in your Android build like:

Could not find com.android.support:appcompat-v7:24.2.0.

or:

You have not accepted the license agreements of the following SDK components:

it means that your Android build requires an Android package which is either not (yet) preinstalled (you can see which packages are preinstalled here, on GitHub - feel free to send us a Pull Request if you'd want to add a new preinstalled package!), or outdated.

We update the preinstalled Android packages on every weekend, so if the error is related to an outdated package, the workaround we describe here can be removed from your build after that weekend's update.

How to fix these errors?

It's quite simple, you just have to update or install the related Android package. You can do this with a Script step (can be the first step in the Workflow), just specify this as the content of the Script step to update the packages related to the errors above:


#!/bin/bash
# fail if any commands fails 
set -e 
# debug log 
set -x

# write your script here 
echo y | android update sdk --no-ui --all --filter extra-android-support | grep 'package installed' 
echo y | android update sdk --no-ui --all --filter extra-android-m2repository | grep 'package installed'
echo y | android update sdk --no-ui --all --filter extra-google-m2repository | grep 'package installed'
Copy code


Happy Building! 🚀

No items found.

Explore more topics

App development

Best practices from engineers on how to use Bitrise to build better apps, faster.

Community

Meet other Bitrise engineers, technology experts, power users, partners and join our BUGs.

Company

All the updates about Bitrise events, sponsorships, employees, and more.

Insights

Mobile development, latest tech, industry insights, and interviews with experts.

Mobile DevOps

Learn why mobile development is unique and requires a set of unique practices.

Releases

Stay tuned for the last updates, new features, and product improvements.

Get the latest from Bitrise

Join other Mobile DevOps engineers who receive regular emails from Bitrise, filled with tips, news, and best practices.