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
Make sure that your theme is child from Theme.AppCompat.NoActionBar
, then in styles.xml
:
<style name="MyMaterialTheme" parent="Theme.AppCompat.NoActionBar">
<item name="windowNoTitle">true</item>
...
</style>
Btw, it's a new issue for Support Library 22.1.
Use this parent in Style.xml parent="Theme.AppCompat.Light.NoActionBar"
In my case, I look for @rewrihitesh answer, and I notice that I inverted elements order. Changing from
setContentView(R.layout.activity_test);
super.onCreate(savedInstanceState);
to
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test);
Fix my problem.
Hope it helps !!
Check if you call setContentView()
after super.onCreate()
, and not before. This helped in my case.
I had the same problem when I upgraded the library version from 22.0.0 to 22.1.1 and fixed it by dropping back to the previous version: com.android.support:appcompat-v7:22.0.0 and go back to using ActionBarActivity, not AppCompatActivity in my Activity classes as required by the newer version of the compatibility library. I'll try again later.
Make sure that
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
are at the top of everything this works for me....good luck