Qzee
Qzee

Reputation: 15

Attribute "name" was already specified for element "activity"

I am following the guide to set up a serial Bluetooth application from TutorialsPoint.

However, I was prompted an error from Android Studio and I am a newbie.

Errors are :

Error:Attribute "name" bound to namespace "http://schemas.android.com/apk/res/android" was already specified for element "activity".

Error:Cannot read packageName from /Users/ooiquanzee/AndroidStudioProjects/ECG/app/src/main/AndroidManifest.xml

Code:

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

    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />

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

        <activity android:name=".MainActivity"
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:qzname="android.intent.action.MAIN" />
                <category android:qzname="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

Upvotes: 1

Views: 5217

Answers (1)

Patrick R
Patrick R

Reputation: 6857

You have defined .MainActivity twice remove one from them.

And also you have defined action and category name as qzname

please update it as follow:

<activity android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
    <action android:name="android.intent.action.MAIN" />

    <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

Upvotes: 3

Related Questions