Skip to content

Instantly share code, notes, and snippets.

@azabost
Last active August 27, 2025 12:21
Show Gist options
  • Save azabost/3f8a33dca49a2b951bde0ba7d63499a0 to your computer and use it in GitHub Desktop.
Save azabost/3f8a33dca49a2b951bde0ba7d63499a0 to your computer and use it in GitHub Desktop.
Find archived files in JAR/AAR files
#!/bin/bash
# This script is useful for understanding which dependencies include specific
# native libraries to prepare for 16 KB memory page size requirement
# https://android-developers.googleblog.com/2025/05/prepare-play-apps-for-devices-with-16kb-page-size.html
#
# ---
#
# For example:
# find_in_archives.sh ~/.gradle/caches libsentry.so
# may print:
#
# Found libsentry.so in: /Users/azabost/.gradle/caches/modules-2/files-2.1/io.sentry/sentry-android-ndk/7.18.0/fb34ebba0e8bc491db4a09724d9800cb4d3cee01/sentry-android-ndk-7.18.0.aar
# 1214928 02-01-1980 00:00 jni/arm64-v8a/libsentry.so
# 707340 02-01-1980 00:00 jni/armeabi-v7a/libsentry.so
# 1303616 02-01-1980 00:00 jni/x86/libsentry.so
# 1276008 02-01-1980 00:00 jni/x86_64/libsentry.so
location=$1
term=$2
while read file
do
result=$(unzip -l "$file" 2>/dev/null | grep "$term")
if [ -n "$result" ]
then
echo "Found $term in: $file"
echo "$result"
fi
done < <(find -E "$location" -regex ".*\.(jar|aar)" -type f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment