admin管理员组

文章数量:1356852

I'm trying to use Gemini Nano in my Android app, but I always get the same error:

AICore failed with error type 2-INTERFERENCE_ERROR and error code 8-NOT_AVAILABLE: Requited LLM feature not found.

I have a basic implementation:

aicore = { module = "com.google.ai.edge.aicore:aicore", version.ref = "0.0.1-exp02" }

    val generationConfig = generationConfig {
        context = currentContext
    }

    val downloadCallback = object : DownloadCallback {
        override fun onDownloadStarted(bytesToDownload: Long) {
            Log.d("Gemini", "onDownloadStarted")
        }

        override fun onDownloadFailed(failureStatus: String, e: GenerativeAIException) {
            Log.e("Gemini", "onDownloadFailed", e)
        }

        override fun onDownloadProgress(totalBytesDownloaded: Long) {
            Log.d("Gemini", "onDownloadProgress")
        }

        override fun onDownloadCompleted() {
            Log.d("Gemini", "onDownloadCompleted")
        }
    }

    val downloadConfig = DownloadConfig(downloadCallback)
    val generativeModel = GenerativeModel(generationConfig, downloadConfig)


Button(
            onClick = {
                coroutineScope.launch {
                    isLoading = true
                    try {
                        val response = generativeModel.generateContent(
                            "my promt"
                        )
                        
                    } catch (e: GenerativeAIException) {
                        
                        Toast.makeText(currentContext, "Error generando texto", Toast.LENGTH_SHORT).show()
                        Log.e("Gemini", "Error generando contenido", e)
                    } finally {
                        isLoading = false
                    }
                }
            },
            enabled = !isLoading
        ) {
            Text(if (isLoading) "Loading..." else "Generar respuesta")
        }

I’ve followed all the required steps:

  • Joined the aicore-experimental Google group

  • Opted in to the Android AICore testing program

  • Updated the AICore app (to at least version 0.thirdpartyeap)

  • Updated Private Compute Services (to a version higher than 1.0.release.658389993)

Everything was testing with a real device Pixel 9 pro. SDK 35

I also tried going to the AICore settings under Developer Options, but now there’s no toggle—just a screen with terms and conditions to read.

Has anyone faced this same issue? Is there something else I’m missing?

本文标签: