Я получаю эту ошибку на Android после настройки примера приложения быстрого запуска Cloud Anchor https://developers.google.com/ar/develop/java/cloud-anchors/cloud-anchors-quickstart-android.
Вот logcat, когда происходит ошибка:
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)
У меня есть:
- Добавлено приложение в проект Firebase, которое содержит БД в реальном времени. Установить правило для общественности.
- Включена привязка к облаку
API и добавленный ключ API в учетных данных Cloud, а затем в манифесте.
Вот копия манифеста:
<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="**obsured**"/>
<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>
Прежде чем даже попытаться сделать версию для Android, я настроил пример приложения для быстрого запуска iOS, и это прекрасно работает - я могу быть хостом, добавить объект, а затем решить и найти объект.
Версия для Android предназначена для связи с той же базой данных Firebase, что и приложение для iOS, и для демонстрации облачных привязок на iOS и Android.
Я также попытался настроить пример приложения Android с новым проектом Firebase и получить ту же ошибку на Android.
Если есть кто-то, кто пробовал AR Cloud Anchor для Android, пожалуйста, дайте мне знать, почему ключ API отклоняется Google Cloud Platform, в то время как версия для iOS отлично работает с той же настройкой бэкэнда.
Спасибо,