Default Template on Android studio deaprecated -
ok earlier asking how come on windows phone developing, didn't sit , wait replys got started.
i installed android studio learned didn't have 4.4 api default (the version of android new phone running) located sdk manager , installed missing sdk preview pane layout editor not render...i learnt needed go module settings , change target there, preview pane drop down , change targeted android version there. added simple button , realised have error java ...that have yet touch!
public class maindisplay extends actionbaractivity {
actionbaractivity deprecated.
...but that's default template!
getmenuinflater().inflate(r.menu.menu_main, menu);
cannot resolve symbol r .
...again default "blank activity" template
checked updates , latest version of android studio: 1.2.1.1 jdk latest version : jdk1.8.0_45 (64bit)
any ideas why android studio (freshly installed today) generating broken templates or other ideas how fix?
edit
so uninstalled android studio, sdk , deleted folders created reinstalled installed version 1.7 of java jdk
same errors on new project,
this source code generates:
import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar // automatically handle clicks on home/up button, long // specify parent activity in androidmanifest.xml. int id = item.getitemid(); //noinspection simplifiableifstatement if (id == r.id.action_settings) { return true; } return super.onoptionsitemselected(item); }
as can see extending depracated class, , adding r's cant resolve .....and before have done anything.
but tonight have ran out of time, had 7 hours free start porting app android , gone setting dev enviroment, wouldnt mind not working , have no idea why
according video should make 2 changes
after did 2 changes worked fine
for more information have [1] , blog
update 1
after change, clean project , sync project gradle file.
update 2
if after have problem resolving symbol r errors after sdk update in android studio can follow steps showing in blog
Comments
Post a Comment