diff --git a/packages/cli/src/config/PublishDetails.ts b/packages/cli/src/config/PublishDetails.ts index 027c00e..0805336 100644 --- a/packages/cli/src/config/PublishDetails.ts +++ b/packages/cli/src/config/PublishDetails.ts @@ -325,6 +325,8 @@ const getAndroidDetails = async ( ); } + checkAbis(apkPath); + return { android_package: appPackage?.[1] ?? "", min_sdk: parseInt(minSdk?.[1] ?? "0", 10), @@ -343,6 +345,35 @@ const getAndroidDetails = async ( } }; +const checkAbis = async (apkPath: string) => { + try { + const { stdout } = await runExec(`zipinfo -s ${apkPath} | grep \.so$`); + const amV7libs = [...stdout.matchAll(/lib\/armeabi-v7a\/(.*)/g)].flatMap(permission => permission[1]); + const x86libs = [...stdout.matchAll(/lib\/x86\/(.*)/g)].flatMap(permission => permission[1]); + const x8664libs = [...stdout.matchAll(/lib\/x86_64\/(.*)/g)].flatMap(permission => permission[1]); + if (amV7libs.length > 0 || x86libs.length > 0 || x8664libs.length > 0) { + + const messages = [ + `Solana dApp Store only supports arm64-v8a abi.`, + `Your apk file contains following unsupported abis`, + ... amV7libs.length > 0 ? [`\narmeabi-v7a:\n` + amV7libs] : [], + ... x86libs.length > 0 ? [`\nx86:\n` + x86libs] : [], + ... x8664libs.length > 0 ? [`\nx86_64:\n` + x8664libs] : [], + `\n\nAlthough your app works fine on Saga, these library files are unused and increase the size of apk file making the download and update time longer for your app.`, + `\n\nSee https://developer.android.com/games/optimize/64-bit#build-with-64-bit for how to optimize your app.`, + ].join('\n') + + showMessage( + `Unsupported files found in apk`, + messages, + `warning` + ) + } + } catch (e) { + // Ignore this error. + } +} + export const extractCertFingerprint = async (aaptDir: string, apkPath: string): Promise => { const { stdout } = await runExec(`${aaptDir}/apksigner verify --print-certs -v "${apkPath}"`); diff --git a/packages/core/src/validate/CoreValidation.ts b/packages/core/src/validate/CoreValidation.ts index 4412e80..f592803 100644 --- a/packages/core/src/validate/CoreValidation.ts +++ b/packages/core/src/validate/CoreValidation.ts @@ -1,11 +1,9 @@ -import fs from "fs"; import Ajv from "ajv"; import type { AppMetadata, MetaplexFileReleaseJsonMetadata, PublisherMetadata, - ReleaseJsonMetadata } from "../types.js"; // eslint-disable-next-line require-extensions/require-extensions