google-ar / arcore-android-sdk

ARCore SDK for Android Studio
https://developers.google.com/ar
Other
4.96k stars 1.22k forks source link

Whether cloud_anchor_c doesn't resolve cloud anchor? #409

Closed Calence closed 6 years ago

Calence commented 6 years ago

In my Mac, the cloud_anchor_java demo can host and resolve cloud anchor,but the cloud_anchor_c demo only hosts cloud anchor. And I print anchorId in the onDataChange method ,it shows a string that it has zero length. And I find when I host an anchor , the anchorID is empty and the log shows :

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)

The AndroidManifest.xml is : <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" android:usesCleartextTraffic="false">

<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. -->
<meta-data android:name="com.google.ar.core" android:value="required" />

<meta-data
    android:name="com.google.android.ar.YOUR_API_KEY"
    android:value="AIzaSyDE243fya9VdLmHDSJYhhdPZJ5U2ulNT00"/>

I want to know whether there is a problem with my configuration?

inio commented 6 years ago

I've asked the Cloud Anchor team to respond to this.

Calence commented 6 years ago

@inio Thank you very much!

Calence commented 6 years ago

I has resolved! Sorry , I wrote 「android:name="com.google.android.ar.YOUR_API_KEY"」in my local xml. Document shows: <meta-data android:name="com.google.android.ar.YOUR_API_KEY" android:value="YOUR_API_KEY"/> That's wrong.It should change "YOUR_API_KEY" to "API_KEY". I write that "android:name="com.google.android.ar.API_KEY" " is ok .