AdvertisingIdClient asking for meta-data although it has been included

自作多情 提交于 2019-12-13 03:39:45

问题


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>

回答1:


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.



来源:https://stackoverflow.com/questions/25287764/advertisingidclient-asking-for-meta-data-although-it-has-been-included

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!