?
1. Installing the JDK
Download JDK installation from official website,
Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
I choose the red, for jdk1.8.0_45.
?
After installing the JDK, you will be prompted to install the JRE, keep it installed in the same directory: in the Java directory
?
2. Configure Environment variables
- New Java_home: Select the installation path for the JDK, such as K:\Java\jdk1.8.0_45
- Path added:%java_home%\bin;%java_home%\jre\bin;
- New classpath:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
- Verify
?
?
Both the Java and Javac commands are passed, then the configuration is OK!
?
3. Download ADT
Because I do not know how to find, from the Baidu cloud disk search one.
?
4. Utility Tools
CTR +shift+o Auto-Add Package
ctr+/???????? Comment Code
Ctr+shit+f???? Automatic Formatting code
Note: If the shortcut key is invalid, please turn off the global hotkey of Sogou input method.
????
?
Since the development environment has not been opened for a long time:
I don't know how much. A fragment.xml configuration, debugging always prompt a problem:
Find an experience on the Web:
?
- Delete the file with Fragment_***.xml;
- Open the corresponding activity and replace the actionbaractivity with the activity;
- Remove Placeholderfragment Entire class
?
Before you modify:
- Public class Testactivity extendsactionbaractivity {
- ?
- [Email protected]
- ??? protected void onCreate (Bundle savedinstancestate) {
- ?????? Super. OnCreate (savedinstancestate);
- ?????? Setcontentview (r.layout.activity_test);
- ?
- ?????? if (savedinstancestate = = null) {
- ????????? Getsupportfragmentmanager (). BeginTransaction ()
- ???????????????. Add (R.id.container, new placeholderfragment ()). commit ();
- ??????}
- ???}
- ?
- [Email protected]
- ??? Public boolean oncreateoptionsmenu (Menu menu) {
- ?
- ?????? //inflate the menu; This adds items to the action bar if it is present.
- ?????? Getmenuinflater (). Inflate (r.menu.test, menu);
- ?????? return true;
- ???}
- ?
- [Email protected]
- ??? Public boolean onoptionsitemselected (MenuItem item) {
- ?????? //Handle Action Bar item clicks here. The Action Bar would
- ?????? //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);
- ???}
- ?
- ??? /**
- ???? * A placeholder fragment containing a simple view.
- ???? */
- ??? Public Static class placeholderfragment extends Fragment {
- ?
- ?????? Public Placeholderfragment () {
- ??????}
- ?
- [Email protected]
- ?????? Public View Oncreateview (layoutinflater inflater, ViewGroup container,
- ???????????? Bundle savedinstancestate) {
- ????????? View Rootview = inflater.inflate (R.layout.fragment_test, container,
- ??????????????? false);
- ????????? return Rootview;
- ??????}
- ???}
- }
After modification:
- Public class Testactivity extends Activity {
- ?
- [Email protected]
- ??? protected void onCreate (Bundle savedinstancestate) {
- ?????? Super. OnCreate (savedinstancestate);
- ?????? Setcontentview (r.layout.activity_test);
- ???}
- ?
- [Email protected]
- ??? Public boolean oncreateoptionsmenu (Menu menu) {
- ?
- ?????? //inflate the menu; This adds items to the action bar if it is present.
- ?????? Getmenuinflater (). Inflate (r.menu.test, menu);
- ?????? return true;
- ???}
- ?
- [Email protected]
- ??? Public boolean onoptionsitemselected (MenuItem item) {
- ?????? //Handle Action Bar item clicks here. The Action Bar would
- ?????? //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);
- ???}
- }
?
Android Basic Environment Setup