Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot Resolve symbol 'R' in Android Studio :"manifest merger failed with multiple errors, see logs"

I'm a beginner and I use Android Studio. A problem keeps on bothers me.

It keeps on showing "Cannot Resolve symbol 'R' " everywhere with R.XXX.XXX

I've tried:

1.checking my xml files, including manifest

2.checking SDK whether Build Tools is installed

3.clean project

4.rebuild project

5.sync project with Gradle files

6.every way I could find on Internet

while rebuilding project the message shows "manifest merger failed with multiple errors, see logs"

I briefly paste a part of my activity here:

public class Clock_mainpage extends Activity {

private Button button_start;

private static final int START_LOCATION = 1;

private Item item;


private void findButton()
 {

    button_start = (Button) findViewById(R.id.start);

 }

 private Button.OnClickListener startclock = new Button.OnClickListener() 
 {
    @Override
   public void onClick(View view) 
    {
                Intent intentMap = new Intent(Clock_mainpage.this, MapsActivity.class);

                intentMap.putExtra("lat", item.getLatitude());
                intentMap.putExtra("lng",item.getLongitude());
                intentMap.putExtra("title",item.getTitle());
                intentMap.putExtra("datetime",item.getLocaleDatetime());

                startActivityForResult(intentMap, START_LOCATION);
                finish();

        }
    };

Seems it appears to be something wrong in my Manifest.xml I post it below:

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

<uses-sdk
    android:minSdkVersion="14"
    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="com.google.android.providers.gsf.permission.READ_GSERVICES" />
<!--The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
     Google Maps Android API v2, but are recommended.
-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

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

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <!-- Google Service edition -->
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <meta-data android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />

    <!-- Google Map API key -->
    <meta-data
        android:name="com.google.android.maps.v2.API_KEY"
        android:value="@string/google_maps_key" />

    <!-- Map component -->
    <activity
        android:name=".MapsActivity"
        android:label="@string/title_activity_maps" />

        <activity/>

    <application/>

</manifest>

Well, this problem seems to be simple to every of you. But I wasted 3hours or more on it. Appreciate to all of you. Sincerely

like image 536
PeterChen Avatar asked Oct 19 '22 04:10

PeterChen


1 Answers

In my case i have declared the same activity twice in the AndroidManifest.xml. So it was giving me the duplicate merger error. Once i removed that my issue was resolved. Make sure your activity is not listed twice in manifest.

like image 124
vivek Avatar answered Nov 13 '22 01:11

vivek