簡體   English   中英

Android Manifest 找不到<meta-data>

[英]Android Manifest doesn't find <meta-data>

我正在嘗試將我的應用配置為對 Chromecast 特色按鈕進行編程。

我正在閱讀所有 chromecast SDK,它說我必須安裝 Google Play 服務。 我將庫鏈接到我的項目,在同一個工作區。 我做得很好,因為我有一個名為 google_play_services.jar 的新 Android Dependencies 庫

當我到達這一點時,我想測試 googlePlayServices 是否可用,所以我想使用:

GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext());

並打印帶有結果的日志。

但是問題出現在這里。 當我運行我的應用程序時,它說這不在我的 Android 清單中。

我的 Android 清單已經有這些行:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chromecastAPP"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>

<meta-data 
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.chromecastAPP.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>

任何不同的解決方案?

謝謝

元數據必須在應用程序標簽中。 “編輯您的應用程序的AndroidManifest.xml文件,並在<application>元素中添加以下聲明。這將嵌入應用程序編譯時使用的 Google Play 服務版本。” 這個鏈接。 嘗試這個:

 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.chromecastAPP"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"/>



<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.chromecastAPP.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>
<meta-data 
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
</application>
</manifest>

我也面臨這個問題。 我剛剛用它的更新版本更新了我的 SDK Google Play 服務,它對我有用......試試它可能也適合你......

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM