Closed mervyn-thyng closed 6 years ago
Could you please reproduce the AndroidManifest.xml
file you're using?
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2018 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<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>
I had to place the API key inside of the application
element to get it to work.
End result looked like this:
...
<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"/>
<application
android:allowBackup="false"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="false"
tools:ignore="GoogleAppIndexingWarning">
<meta-data
android:name="com.google.android.ar.API_KEY"
android:value="**obsured**"/>
<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">
...
Yes! that did it. Thank you. It would be great if the docs were more specific as well as codelab docs (which specifically instructs to place meta element out of the application element).
Thanks again!
It would be great if the docs were more specific as well as codelab docs (which specifically instructs to place meta element out of the application element).
Could you please provide a link to where this statement is made?
Thanks for pointing this out! We've now clarified this instruction in our documentation: https://developers.google.com/ar/develop/java/cloud-anchors/cloud-anchors-quickstart-android#add_an_api_key
Hope this helps!
one year later this mistake in the codelab still exists. please fix to prevent confusion. https://codelabs.developers.google.com/codelabs/arcore-cloud-anchors/#2
Am getting the same error not authorized even after using key less authentication, this meta-data isn't being used in the newer version, I tried putting that meta-data inside application too but it doesn't work... any help?
I am getting this error on Android after setting up the quick start sample app com.google.ar.core.examples.java.cloudanchor.
Here is the logcat when error occurs:
I have:
Before attempting to do the Android version, I set up the iOS quick start sample app and that works fine - I can be a host, add an object and then resolve and find the object.
The Android version is to communicate with the same Firebase DB that iOS app did and is to demonstrate cloud anchors across the 2 platforms.
I have also tried setting up the Android sample app with a new Firebase project and get the same error on Android.
Please advise what I am missing.
Thank you,