0

This Question seems like it's been answered but not updated, I am working on Android Studios 1.5.1.0 and I am getting an error in the activity_main.xml and also in the MainActivity.java. When making my app I had no problems until i tried to run it.

This is what came up when I tried to run it

    Error:(13, 24) No resource found that matches the given name (at 'theme' with value '@style/AppTheme.AppBarOverlay').
    Error:(20, 29) No resource found that matches the given name (at 'popupTheme' with value '@style/AppTheme.PopupOverlay').
    Error:Execution failed for task ':app:processDebugResources.

com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command 'C:\Android\sdk\build-tools\23.0.2\aapt.exe'' finished with non-zero exit value 1

In my activity_main.xml

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

    <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" /> This is in red

</android.support.design.widget.AppBarLayout>

<include layout="@layout/content_main" />

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@android:drawable/ic_dialog_email" />

and in my mainactivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    final EditText tickets = (EditText)findViewById(R.id.txtTickets);
    final Spinner group = (Spinner)findViewById(R.id.txtGroup);
    Button cost = (Button)findViewById(R.id.btncost);
    cost.setOnClickListener(new View.OnClickListener() {
        final TextView result = ((TextView)findViewById(R.id.txtResult);
        @Override
        public void onClick(View v) {
            numberOfTickets = Integer.parseInt(tickets.getText().toString());
            totalCost = costPerTickets * numberOfTickets;
            DecimalFormat currency = new DecimalFormat("$###,###.##");
            groupchoice = group.getSelectedItem().toString();
            result.setText("Cost for " + groupchoice + " is " + currency.format(totalCost));
        }
    });
}

All (R.) is in Red

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142

4 Answers4

0

clean and rebuild your project

change the version of buildTools to :

buildToolsVersion "23.0.2"

Get this setting inside the file app/build.gradle.

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
0

Whenever my R is red, I've found that it's because one of my resource XML files was badly formed, such that it wouldn't compile to create the R class. Inspect recent changes to your resource files and look for problems (tag errors, wrong quotes, etc).

Peter McLennan
  • 371
  • 4
  • 11
  • I did that, and the only thing that is wrong is my @style/App.Theme.PopupOverlay which is connected to my (R). – Mrs_Are3 Mar 03 '16 at 14:31
0

You must define "AppTheme.AppBarOverlay" and "AppTheme.PopupOverlay" in values/style first

0

Did you check some of the other answers on how to update your build.gradle file? here and here, for me worked after restart of Android Studio 2.2.2 and update.

Community
  • 1
  • 1
Kaloyan Penov
  • 81
  • 1
  • 3