Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No resource identifier found for attribute 'parentActivityName' in package 'android'

I'm trying to complete this tutorial from the Android Page http://developer.android.com/training/basics/firstapp/starting-activity.html But I Eclipse throws this error: "No resource identifier found for attribute 'parentActivityName' in package 'android'" I have included the android-support-library.

Here is the whole AndroidManifest.xml code

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

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="15" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/title_activity_main" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.myfirstapp.DisplayMessageActivity"
        android:label="@string/title_activity_display_message" 
        android:parentActivityName="com.example.myfirstapp.MainActivity" >
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.example.myfirstapp.MainActivity" />
    </activity>
</application>

like image 264
Tudor Ravoiu Avatar asked Dec 09 '12 10:12

Tudor Ravoiu


2 Answers

android:parentActivityName appears first in Android 4.1 (API level 16). You need to have the latest 4.1 SDK to compile this.

like image 135
David Wasser Avatar answered Nov 12 '22 05:11

David Wasser


To add to David Wasser's answer, if you use Eclipse and have the correct SDK library installed but still have this error, it means that while the correct library is installed Eclipse does not use it for this project.

To change that, go to your project's Properties (right-click on its name in the Package Explorer and it's the last but one option), select Android in the left hand column and you should have a list called Project Build Target. Then:

  • Select the appropriate target (Android 4.2.2 or Google APIs for Platform 4.2.2 in this instance)

  • Save your Manifest file (make a trivial edit if necessary)

Once it is saved Eclipse will process it and those errors should disappear as Eclipse finds the resource identifier in its new build target.

like image 24
Julien Rousseau Avatar answered Nov 12 '22 04:11

Julien Rousseau