1

I'm new to android programming and eclipse, I apologize if this question is trivial. I'm following google's tutorial on getting google gps api to be compatible with my application. After following the steps, I got the following code with a warning in front of the first instance of application and a warning on the first instance of meta-data.

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

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE "/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE "/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION "/>
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true"/>

    <application
<meta-data
        android:allowBackup="true" 
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" 
        android:theme="@style/AppTheme" 
        android:name="com.google.android.gms.version" 
        android:value="@integer/google_play_services_version" 


    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIzaSyC2WJ8Z3w1qoWKiBmCZVlvQLN4Pr8CTGLg">


</meta-data>
  </application>
</manifest>

The warning on application states

"Multiple annotations found at this line: - Should explicitly set android:icon, there is no default - Should explicitly set android:allowBackup to true or false (it's true by default, and that can have some security implications for the application's data)"

And the error states

"Element type "application" must be followed by either attribute specifications, ">" or "/

"."

Can anyone help, please?

Sid
  • 33
  • 5

3 Answers3

2

You are mixing application tag with the metadata tag. Try this:

<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"/>

    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="AIzaSyC2WJ8Z3w1qoWKiBmCZVlvQLN4Pr8CTGLg"/>
</application>
Lucas Arrefelt
  • 3,879
  • 5
  • 41
  • 71
  • I did as you said and now the error is on the line where " – Sid Oct 27 '14 at 15:19
  • By the looks of it I'm guessing you want 2 metadata, since you have 2 android:name and android:value attributes. Try updated answer. Unfortunately I cant try myself. – Lucas Arrefelt Oct 27 '14 at 15:22
  • I didn't know two metadata were allowed. Thanks again for your help. The tutorial said to make sure these names and values were children of metadata. It's long but this is the link I'm following. [link]https://developers.google.com/maps/documentation/android/start#getting_the_google_maps_android_api_v2 On this line android:value="@integer/google_play_services_version"/>, I now get an error stating "error: Error: No resource found that matches the given name (at 'value' with value '@integer/ google_play_services_version')." – Sid Oct 27 '14 at 15:30
  • The @integer means it will fetch value from a resource file with a defined integer with that name. If you dont have that, it will be marked as an error. You can check this link for more info about that: http://stackoverflow.com/questions/19297522/android-integer-from-xml-resource – Lucas Arrefelt Oct 27 '14 at 15:42
0

XML Tags are enclosed between < >

Change

<application

To

<application

    <!-- insert your properties here -->

> <!-- add a tag closer here -->
nem035
  • 34,790
  • 6
  • 87
  • 99
0

Replace <application with

    <application
    android:icon="@drawable/atlogo"
    android:label="@string/app_name"
    android:largeHeap="true"
    android:theme="@style/mytheme">

You're missing the rest of your opening application tag.

Kristy Welsh
  • 7,828
  • 12
  • 64
  • 106