You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Android端AR Cloud Anchor授权错误:请求缺少有效API密钥

Android Cloud Anchors Quickstart throws ERROR_NOT_AUTHORIZED despite valid API key (iOS works with same backend)

I've set up the official Android Cloud Anchors quickstart app, but keep hitting an ERROR_NOT_AUTHORIZED error on my Android device.

Logcat Error Output

05-10 17:52:07.258 3214-3273/com.google.ar.core.examples.java.cloudanchor E/zygote64: The String#value field is not present on Android versions >= 6.0
05-10 17:52:07.528 3214-3273/com.google.ar.core.examples.java.cloudanchor E/AnchorServiceClient: AnchorServiceClient Exception aua: PERMISSION_DENIED: The request is missing a valid API key.
    at bhd.a(PG:58)
    at bhd.a(PG:29)
    at com.google.ar.persistence.AnchorServiceClient.a(PG:17)
    at com.google.ar.persistence.AnchorServiceClient.createAnchors(PG:26)

Steps I've Already Completed

  • Added the app to a Firebase project with Realtime Database, and set public security rules.
  • Enabled the Cloud Anchor API, created an API key in Cloud Credentials, and added it to the app's Manifest file.

My AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="com.google.ar.core.examples.java.cloudanchor">
    <uses-permission android:name="android.permission.CAMERA"/>
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- This tag indicates that this application requires ARCore. This results in the application only being visible in the Google Play Store on devices that support ARCore. -->
    <uses-feature android:name="android.hardware.camera.ar" android:required="true"/>
    <meta-data android:name="com.google.android.ar.API_KEY" android:value="**obscured**"/>
    <application android:allowBackup="false" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:usesCleartextTraffic="false" tools:ignore="GoogleAppIndexingWarning">
        <activity android:name=".CloudAnchorActivity" android:label="@string/app_name" android:configChanges="orientation|screenSize" android:exported="true" android:theme="@style/Theme.AppCompat.NoActionBar" android:screenOrientation="locked">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>
        <!-- This tag indicates that this application requires ARCore. This results in the Google Play Store downloading and installing ARCore along with the application. Application code must still call ArCoreApk.requestInstall() before beginning an ARCore sessions, in case the user uninstalls ARCore for any reason. -->
        <meta-data android:name="com.google.ar.core" android:value="required" />
    </application>
</manifest>

Additional Context

  • My iOS version of the Cloud Anchors quickstart works perfectly with the same backend setup – I can host and resolve anchors without issues.
  • The Android app is intended to use the same Firebase database for cross-platform anchor functionality.
  • I've also tried setting up a brand new Firebase project specifically for the Android app, but the same PERMISSION_DENIED error persists.

Can anyone with Android AR Cloud Anchor experience explain why my API key is being rejected by GCP on Android, even though it works fine on iOS with the same configuration?

Thanks!

内容的提问来源于stack exchange,提问作者sillywab8

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 07:24:14