谷歌阿比项丢失 [英] Google Api Key Missing

查看:370
本文介绍了谷歌阿比项丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想推出一个可穿戴式机器人与仿真器,但它崩溃启动和得到以下错误:

I am trying to launch an android wearable with an emulator, but it crashes on startup and getting the following error:  

java.lang.RuntimeException: API key not found.  Check that <meta-data android:name="com.google.android.geo.API_KEY" android:value="your API key"/> is in the <application> element of AndroidManifest.xml

但奇怪的是我并在我的清单中这样定义的:

But the weird part is i did defined it in my manifest like this:

新editted说,作品

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.wearfare.wearapp.gpswear"
    android:versionCode="1"
    android:versionName="1.0" >

    <!-- Mark this app as an Android Wear app. -->
    <uses-feature android:name="android.hardware.type.watch" />

    <!-- Permission required for ambient mode to keep the application running. -->
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

    <application

        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.DeviceDefault" >

        <!-- API key for the Android Maps API v2. The value is defined as a string resource. -->
        <meta-data android:name="com.google.android.geo.API_KEY"
            android:value="xxxxxxxxxxxxxxx"/>

        <!-- Reference the wearable shared library required to support ambient mode. -->
        <uses-library android:name="com.google.android.wearable" android:required="false" />

        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

编辑2

我收到以下内容:

10-07 10:04:43.972    1614-1614/com.wearfare.wearapp.gpswear W/ResourcesManager﹕ Asset path '/system/framework/com.google.android.wearable.jar' does not exist or contains no resources.
10-07 10:04:43.993    1614-1631/com.wearfare.wearapp.gpswear I/GMPM﹕ App measurement is starting up
    10-07 10:04:43.995    1614-1631/com.wearfare.wearapp.gpswear E/GMPM﹕ getGoogleAppId failed with status: 10
    10-07 10:04:43.995    1614-1631/com.wearfare.wearapp.gpswear E/GMPM﹕ Uploading is not possible. App measurement disabled

修改的build.gradle

EDIT build.gradle

apply plugin: 'com.android.application'android {
        signingConfigs {
        }
        compileSdkVersion 22
        buildToolsVersion "23.0.1"
        defaultConfig {
            applicationId "com.wearfare.wearapp.gpswear"
            minSdkVersion 22
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.google.android.support:wearable:1.3.0'
        provided 'com.google.android.wearable:wearable:1.0.0'
        compile 'com.google.android.gms:play-services-wearable:8.1.0'
        compile 'com.google.android.gms:play-services:8.1.0'
        compile 'com.android.support:support-v4:23.0.1'
        compile 'com.google.android.gms:play-services-maps:8.1.0'
    }

xxx是API密钥我把,但在运行项目时,仍然得到同样的错误消息。任何建议什么,我在这里丢失?

xxx is the api key i put in, but still getting the same error message when running the project. any suggestions what i am missing here?

先谢谢了。

几乎没有

玉家伙,它看起来像它的工作,但它不显示我的地图,这是一个灰色区域。我想通了,我可以关闭应用程序时,我渴望preSS它。

Ok Guys, it looks like it does work, but it doesnt show my map, it's a grey field. I figured out i can dismiss the app when i longpress it.

因此​​,也许它可能是别的东西,为什么它不是显示我的地图吗?

So maybe it could be something else why it isnt showing my map?

推荐答案

我觉得灰屏的问题是,你没有正确获得API密钥。请确保您已获得正确的关键。当发布,而不是调试模式下生成我的钥匙我有这个确切的问题。

I think the problem of the grey screen is that you didn't obtain the API key correctly. Please ensure that you have obtained the key correctly. I've had this exact problem when my key was generated for release instead of debug mode.

https://developers.google.com/maps/documentation/android-api/start#obtaining_an_api_key

这篇关于谷歌阿比项丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆