I tried to migrate a project from Eclipse to Android studio. Finally I am able to run it, but at a certain point I got this exception, and I found nothing in google about th
I solved the issue by my main Activity extending AppCompatActivity :)
alternative to @sbaar's answer,
keep windowActionBar
to false
and add windowNoTitle
as well and set it to true
.
ie
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
if you have added <item name="windowActionBar">false</item>
,
then ,you need to add
<item name="windowNoTitle">true</item>
to solve the problem.
I had same issue somewhat, removed android:
from my syles.xml as per below;
<!-- caused crash -->
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
<!-- didn't cause crash -->
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
just Use this in your style.xml no other editing is needed
<style name="AppTheme" parent="Theme.AppCompat">
<!-- theme customizations -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
don't add anything in to activity file please leave it
public class Main extends ActionBarActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.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();
if (id == R.id.action_settings) {
return true;
}
return super.onOptionsItemSelected(item);
}
}
in my case i didnt change to .NoActionBar Theme. i just remove android prefix from this item.
<item name="windowActionBar">false</item>
and the error goes away.