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