how to correct this error

0 Manoj Meena · March 28, 2015
Error:Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Users\user\AppData\Local\Android\sdk1\build-tools\21.1.2\aapt.exe'' finished with non-zero exit value 1
Error:(7, 17) Resource id cannot be an empty string (at 'id' with value '@+id/').
C:\Users\user\AndroidStudioProjects\manoj1\app\src\main\res\layout\activity_main.xml

Post a Reply

Replies

Oldest  Newest  Rating
0 Dol Lod · March 28, 2015
Unless you paste code I can't say for sure, but the problem is whatever resource has that error has no id associated with it and this is required by layouts and views used in xml. 
0 Manoj Meena · March 29, 2015
activity_main.xml

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
    android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
    android:id="@+id/">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="@string/message_text"
        android:id="@+id/manojText"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="93dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/button_text"
        android:id="@+id/manojButton"
        android:layout_below="@+id/manojText"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="93dp" />
</RelativeLayout>

MainActivity.java


package com.example.user.manoj1;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;
import android.widget.Button;



public class MainActivity extends ActionBarActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button manojButton=(Button)findViewById(R.id.manojButton);

        manojButton.setOnClickListener(
                new Button.OnClickListener(){
                    public void onClick(View v){
                        TextView manojText=(TextView)findViewById(R.id.manojText);
                        manojText.setText("Well Done Manoj!");
                    }
                }

        );
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
}
0 Bartosz MaciÄ™ga · March 29, 2015
Look on RelativeLayout id, it`s empty String.
I think this caused error.
  • 1

Java / Android Development

107,179 followers
About

Very popular language used to create desktop applications, website applets, and Android apps.

Links
Moderators
Bucky Roberts Administrator