Android Basic Environment Setup

Source: Internet
Author: User

?

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

  1. New Java_home: Select the installation path for the JDK, such as K:\Java\jdk1.8.0_45

  2. Path added:%java_home%\bin;%java_home%\jre\bin;

  3. New classpath:.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

  4. 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:

?

    1. Delete the file with Fragment_***.xml;
    2. Open the corresponding activity and replace the actionbaractivity with the activity;
    3. Remove Placeholderfragment Entire class

?

Before you modify:

  1. Public class Testactivity extendsactionbaractivity {
  2. ?
  3. [Email protected]
  4. ??? protected void onCreate (Bundle savedinstancestate) {
  5. ?????? Super. OnCreate (savedinstancestate);
  6. ?????? Setcontentview (r.layout.activity_test);
  7. ?
  8. ?????? if (savedinstancestate = = null) {
  9. ????????? Getsupportfragmentmanager (). BeginTransaction ()
  10. ???????????????. Add (R.id.container, new placeholderfragment ()). commit ();
  11. ??????}
  12. ???}
  13. ?
  14. [Email protected]
  15. ??? Public boolean oncreateoptionsmenu (Menu menu) {
  16. ?
  17. ?????? //inflate the menu; This adds items to the action bar if it is present.
  18. ?????? Getmenuinflater (). Inflate (r.menu.test, menu);
  19. ?????? return true;
  20. ???}
  21. ?
  22. [Email protected]
  23. ??? Public boolean onoptionsitemselected (MenuItem item) {
  24. ?????? //Handle Action Bar item clicks here. The Action Bar would
  25. ?????? //automatically handle clicks on the Home/up button, so long
  26. ?????? //As you specify a parent activity in Androidmanifest.xml.
  27. ?????? int id = item.getitemid ();
  28. ?????? if (id = = r.id.action_settings) {
  29. ????????? return true;
  30. ??????}
  31. ?????? return Super. onoptionsitemselected (item);
  32. ???}
  33. ?
  34. ??? /**
  35. ???? * A placeholder fragment containing a simple view.
  36. ???? */
  37. ??? Public Static class placeholderfragment extends Fragment {
  38. ?
  39. ?????? Public Placeholderfragment () {
  40. ??????}
  41. ?
  42. [Email protected]
  43. ?????? Public View Oncreateview (layoutinflater inflater, ViewGroup container,
  44. ???????????? Bundle savedinstancestate) {
  45. ????????? View Rootview = inflater.inflate (R.layout.fragment_test, container,
  46. ??????????????? false);
  47. ????????? return Rootview;
  48. ??????}
  49. ???}
  50. }

After modification:

  1. Public class Testactivity extends Activity {
  2. ?
  3. [Email protected]
  4. ??? protected void onCreate (Bundle savedinstancestate) {
  5. ?????? Super. OnCreate (savedinstancestate);
  6. ?????? Setcontentview (r.layout.activity_test);
  7. ???}
  8. ?
  9. [Email protected]
  10. ??? Public boolean oncreateoptionsmenu (Menu menu) {
  11. ?
  12. ?????? //inflate the menu; This adds items to the action bar if it is present.
  13. ?????? Getmenuinflater (). Inflate (r.menu.test, menu);
  14. ?????? return true;
  15. ???}
  16. ?
  17. [Email protected]
  18. ??? Public boolean onoptionsitemselected (MenuItem item) {
  19. ?????? //Handle Action Bar item clicks here. The Action Bar would
  20. ?????? //automatically handle clicks on the Home/up button, so long
  21. ?????? //As you specify a parent activity in Androidmanifest.xml.
  22. ?????? int id = item.getitemid ();
  23. ?????? if (id = = r.id.action_settings) {
  24. ????????? return true;
  25. ??????}
  26. ?????? return Super. onoptionsitemselected (item);
  27. ???}
  28. }

?

Android Basic Environment Setup

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.