AdvertisingIdClient要求的元数据,尽管它已被列入 [英] AdvertisingIdClient asking for meta-data although it has been included

查看:774
本文介绍了AdvertisingIdClient要求的元数据,尽管它已被列入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建 ANE 获得 AdvertisingId 为Android。我使用 Flash Builder的4.7 AIR SDK 14.0 。我可以成功地创建 ANE ,但问题是,它总是抛出误差

  A需要`元data`在应用程序的`AndroidManifest.xml`不存在标签。
你必须有内部的以下声明
<应用>元件:
<元数据机器人:名字=com.google.android.gms.version
机器人:值=@整数/ GOOGLE_PLAY_SERVICES_VERSION/>

我已经添加了的Andr​​oidManifest.xml 这个元数据是在我的 ANE 的Java应用程序。如果我有这样的应用程序程序app.xml android->应用标签,它不会抛出任何错误,但它不会前进。

下面是我的的Andr​​oidManifest.xml

 <?XML版本=1.0编码=UTF-8&GT?;
<清单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    包=com.company.androidnativeextensions
    安卓版code =1
    机器人:=的versionName1.0>    <用途-SDK
        安卓的minSdkVersion =8
        机器人:targetSdkVersion =18/>    <应用
        机器人:allowBackup =真
        机器人:图标=@绘制/ ic_launcher
        机器人:标签=@字符串/ APP_NAME
        机器人:主题=@风格/ AppTheme>        <元数据机器人:名字=com.google.android.gms.version机器人:值=@整数/ GOOGLE_PLAY_SERVICES_VERSION/>
        <活动
            机器人:名字=com.company.androidnativeextensions.MainActivity
            机器人:标签=@字符串/ APP_NAME>
            &所述;意图滤光器>
                <作用机器人:名字=android.intent.action.MAIN/>                <类机器人:名字=android.intent.category.LAUNCHER/>
            &所述; /意图滤光器>
        < /活性GT;
    < /用途>< /清单>


解决方案

您使用的元数据似乎罚款。问题在于不能够解决了Android构建系统 @整数/ GOOGLE_PLAY_SERVICES_VERSION 这是从 RES /价值/ version.xml

这根本不​​会成为问题上只是一个机器人项目,但因为这是一个ANE项目,它是由ADT把 RES 文件夹中最终的APK内正确的地方。这就是packagedResources是。

注:这是没有必要有内部Platform.xml指定的任何packagedDependencies为了使用packagedResources。这是完全正常的只具有已指定packagedResources一个Platform.xml。

这里的链接 Adob​​e的约包括页面在ANE资源建立相关的例子。

您可以替换最坏的情况下 @整数/ GOOGLE_PLAY_SERVICES_VERSION 里面的值 version.xml

I am trying to create ANE to get AdvertisingId for android. I am using Flash Builder 4.7 with AIR SDK 14.0. I could successfully create the ANE, but the problem is, it is always throwing error as

A required `meta-data` tag in your app's `AndroidManifest.xml` does not exist.
You must have the following declaration within the
<application> element:
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />

I have already added this meta-data in AndroidManifest.xml which is in Java application of my ANE. If i include this in Application-app.xml's android->application tag, it won't throw any error but it won't go forward.

Here is my AndroidManifest.xml

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

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

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


        <activity
            android:name="com.company.androidnativeextensions.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>

解决方案

Your metadata usage seems fine. The issue lies with the android build system not being able to resolve @integer/google_play_services_version which comes from res/values/version.xml.

This wouldn't have even been an issue on just another android project but since this is an ANE project, it is up to ADT to put the res folder in the right place inside the final APK. That's what packagedResources are for.

NOTE: It is not necessary to have any packagedDependencies specified inside Platform.xml in order to use packagedResources. It is perfectly alright to have a Platform.xml that only has packagedResources specified.

Here's the Link to Adobe's page about including resources in your ANE builds with relevant examples.

Worst case you can replace @integer/google_play_services_version with the value inside version.xml.

这篇关于AdvertisingIdClient要求的元数据,尽管它已被列入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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