{"record":{"id":"87c530043ea7a64c","repo":"microg/GmsCore","slug":"version-not-supported","errorCode":null,"errorMessage":"Version not supported","messagePattern":"Version not supported","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt","lineNumber":89,"sourceCode":"    @TargetApi(19)\n    private fun configureBroadcastListenersIfNeeded() {\n        synchronized(this) {\n            if (!this::timeoutBroadcastReceiver.isInitialized) {\n                val intentFilter = IntentFilter(ACTION_SMS_RETRIEVE_TIMEOUT)\n                timeoutBroadcastReceiver = TimeoutReceiver()\n                ContextCompat.registerReceiver(context, timeoutBroadcastReceiver, intentFilter, ContextCompat.RECEIVER_NOT_EXPORTED)\n            }\n            if (!this::smsBroadcastReceiver.isInitialized) {\n                val intentFilter = IntentFilter(Telephony.Sms.Intents.SMS_RECEIVED_ACTION)\n                intentFilter.priority = 999\n                smsBroadcastReceiver = SmsReceiver()\n                context.registerReceiver(smsBroadcastReceiver, intentFilter)\n            }\n        }\n    }\n\n    private suspend fun ensureReady(permissions: Array<String>): Boolean {\n        if (SDK_INT < 19) throw RuntimeException(\"Version not supported\")\n        if (!ensurePermission(permissions)) return false\n        configureBroadcastListenersIfNeeded()\n        return true\n    }\n\n    suspend fun startSmsRetriever(packageName: String) {\n        val appHashString = getHashString(packageName)\n\n        if (!ensureReady(arrayOf(RECEIVE_SMS)))\n            throw RuntimeException(\"Initialization failed\")\n        if (anyOtherPackageHasHashString(packageName, appHashString))\n            throw RuntimeException(\"Collision in hash string, can't use SMS Retriever API\")\n        if (requests.values.any { it.packageName == packageName && it.appHashString == appHashString && it.type == RETRIEVER })\n            throw RuntimeException(\"App already listening\")\n\n        val request = SmsRetrieverRequest(\n            id = requestIdCounter.incrementAndGet(),\n            type = RETRIEVER,","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-auth-api-phone/core/src/main/kotlin/org/microg/gms/auth/phone/SmsRetrieverCore.kt#L71-L107","documentation":"ensureReady() in SmsRetrieverCore throws this RuntimeException when the device runs Android with SDK_INT below 19 (Android 4.4 KitKat). The SMS Retriever API depends on APIs introduced in API 19 (e.g. PackageManager signature hashing and SMS broadcast support), so the library hard-fails instead of silently degrading.","triggerScenarios":"Calling startSmsRetriever() or startWithConsentPrompt() (both delegate to ensureReady) on a device/emulator running API level 18 or lower.","commonSituations":"Testing on an old emulator AVD image or a legacy physical device below Android 4.4; minSdk left too low in the app so old devices can install the app and reach this code path.","solutions":["Raise the device to Android 4.4 (API 19) or newer, or test on a modern emulator image","Set minSdkVersion >= 19 in the consuming app so the code path is unreachable on old devices","Guard the call at runtime with Build.VERSION.SDK_INT check before invoking the retriever","Use a different SMS verification mechanism (e.g. user-typed code) on legacy devices"],"exampleFix":"// before\nsmsRetrieverCore.startSmsRetriever(packageName)\n// after\nif (Build.VERSION.SDK_INT >= 19) {\n    smsRetrieverCore.startSmsRetriever(packageName)\n} else {\n    // fall back to manual SMS code entry\n}","handlingStrategy":"try-catch","validationCode":"if (Build.VERSION.SDK_INT < 19) { /* skip / fallback */ }","typeGuard":"fun isSmsRetrieverSupported(): Boolean = Build.VERSION.SDK_INT >= 19","tryCatchPattern":"try { core.startSmsRetriever(pkg) } catch (e: RuntimeException) { if (e.message == \"Version not supported\") fallbackToManualCode() else throw e }","preventionTips":["Set minSdkVersion >= 19 in your app","Check Build.VERSION.SDK_INT before any SMS retriever call","Provide a manual OTP-entry fallback for old devices"],"tags":["android","sms-retriever","sdk-version","compatibility"],"backgroundTag":"unsupported-platform","analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}