Android寮鍙戠綉http://www.ojizl5.fun/android/Android寮鍙戣呯殑鍔犳补绔?Android瀛︿範鑰呯殑涔愬洯RainbowSoft Studio Z-Blog 1.8 Walle Build 100427zh-CNCopyright 漏 2011-2017 Android寮鍙戠綉. 鐗堟潈鎵鏈?Tue, 24 Oct 2017 14:47:44 +0800Android鎵?#37832;?#37719;?#28601;?#38171;堜簩鍗佷簩锛?#38171;歮d5鍔犲瘑杩囩▼a@b.com (楦″晞绫?http://www.ojizl5.fun/android/example/717.htmlTue, 24 Oct 2017 14:43:08 +0800http://www.ojizl5.fun/android/example/717.html銆銆鍦?#28052;?#37715;嶇殑鏂?#32468;?#28051;?#38171;?#37812;戜滑灏嗙敤鎴风殑?#30225;鐮佷?#36328;敤SharedPreferences瀛樺偍锛?#37812;戜滑鎵?#23534;/data/data/com.wuyudong.mobilesafe/shared_prefs鏂?#28000;?#28598;?#28051;嬬殑 config.xml 鏂?#28000;?#38171;?#28725;?#37711;ュ埌鏈?#37734;?#38171;屾煡鐪嬪唴瀹?#38171;?/p>
XML/HTML浠g爜
  1. <?xml version='1.0' encoding='utf-8' standalone='yes' ?>  
  2. <map>  
  3.     <string name="mobile_safe_psd">123</string>  
  4.     <boolean name="open_update" value="false" />  
  5. </map>  

銆銆?#30225;?#29212;灞呯劧浣跨敤?#27537;?#27128;鏄?#37826;?#38171;?#26473;?#37837;锋槸闈炲父涓?#28729;?#37711;ㄧ殑銆?#26473;?#38322;?#38322;囩敤md5鍔犲瘑

銆銆缂栧啓Md5Util宸?#37711;?#32491;?#38171;?#28000;g爜濡?#28051;?

Java浠g爜
  1. package com.wuyudong.mobilesafe.Utils;  
  2.   
  3. /** 
  4.  * Created by wuyudong on 2016/10/9. 
  5.  */  
  6.   
  7. import java.security.MessageDigest;  
  8. import java.security.NoSuchAlgorithmException;  
  9.   
  10. public class Md5Util {  
  11.     /** 
  12.      * 缁欐寚瀹?#28699;?#32471;?#28051;?#37816;夌収md5绠楁硶鍘?#37716;犲瘑 
  13.      * 
  14.      * @param psd 闇瑕?#37716;犲瘑?#27537;?#30225;?#29212;    鍔犵?#24876;?#21229;悊 
  15.      * @return md5鍚庣殑瀛?#32471;?#28051;?/span> 
  16.      */  
  17.     public static String encoder(String psd) {  
  18.         try {  
  19.             //鍔犵?#24876;?#21229;悊  
  20.             psd = psd + "mobilesafe";  
  21.             //1,?#23514;瀹?#37716;犲瘑绠楁硶绫诲瀷  
  22.             MessageDigest digest = MessageDigest.getInstance("MD5");  
  23.             //2,灏?#38343;瑕?#37716;犲瘑?#27537;瀛?#32471;?#28051;?#28051;?#26462;崲鎴恇yte绫诲瀷?#27537;?#26271;缁??#21159;鍚?#26473;涜?#23684;殢鏈?#37725;堝笇杩囩▼  
  24.             byte[] bs = digest.digest(psd.getBytes());  
  25. 銆銆銆銆銆銆銆//3,寰幆閬嶅巻bs,?#21159;鍚?#29825;?#37711;?#37922;?#37812;?2浣?#28699;?#32471;?#28051;?鍥?#28729;氬啓?#30838;  
  26.             //4,鎷兼帴瀛?#32471;?#28051;?#26473;囩▼  
  27.             StringBuffer stringBuffer = new StringBuffer();  
  28.             for (byte b : bs) {  
  29.                 int i = b & 0xff;  
  30.                 //int绫诲瀷?#27537;i闇瑕?#26462;崲鎴?6鏈哄埗瀛?#32471;?/span>  
  31.                 String hexString = Integer.toHexString(i);  
  32.                 if (hexString.length() < 2) {  
  33.                     hexString = "0" + hexString;  
  34.                 }  
  35.                 stringBuffer.append(hexString);  
  36.             }  
  37.             //5,鎵?#37719;?#23092;嬭瘯  
  38.             System.out.println(stringBuffer.toString());  
  39.             return stringBuffer.toString();  
  40.         } catch (NoSuchAlgorithmException e) {  
  41.             e.printStackTrace();  
  42.         }  
  43.         return "";  
  44.     }  
  45. }  

銆銆md5鍔犲瘑:灏?#28699;?#32471;?#28051;?#26462;崲鎴?32浣嶇殑瀛?#32471;?#28051;?16杩涘埗瀛?#32471;?0~f)) 涓?#37721;?#38315;?/p>

銆銆渚嬪锛?23鍔犲瘑鍚?#38171;?02cb962ac59075b964b07152d234b70

銆銆?#24116;涓嬫潵?#27967;?#24116;?#30367;?#25956;鍔犲瘑绫?#37719;?#37721;?#38171;屽?#21975;埆鍦?ldquo;璁剧疆?#30225;?#29212;”鍜?ldquo;纭?#29825;ゅ瘑?#29212;”涓?#28051;?#28725;硅瘽妗?#26473;涜鍔犲瘑?#30254;瀵?#38171;屽叿浣?#28000;g爜濡?#28051;?#38171;?/p>

Java浠g爜
  1. /** 
  2.  * 纭?#29825;ゅ瘑?#29212;瀵硅瘽妗?/span> 
  3.  */  
  4. private void showConfirmPsdDialog() {  
  5.     //闇瑕佽嚜宸?#37720;?#28729;?#28052;?#28725;硅瘽妗嗙殑鏄剧ず鏍?#23534;?#38171;?#37813;浠?#29781;佽皟?#25956;dialog.setView(view);  
  6.     Builder builder = new Builder(this);  
  7.     final AlertDialog dialog = builder.create();  
  8.     final View view = inflate(this, R.layout.dialog_confirm_psd, null);  
  9.     //璁?#28725;硅瘽妗?#37828;剧ず涓涓嚜宸?#28729;?#28052;夌殑瀵硅瘽妗嗙晫闈?#37825;堟灉  
  10.     dialog.setView(view);  
  11.     dialog.show();  
  12.   
  13.     Button bt_submit = (Button) view.findViewById(R.id.bt_submit);  
  14.     Button bt_cancel = (Button) view.findViewById(R.id.bt_cancel);  
  15.   
  16.     bt_submit.setOnClickListener(new OnClickListener() {  
  17.         @Override  
  18.         public void onClick(View v) {  
  19.             EditText et_confirm_psd = (EditText) view.findViewById(R.id.et_confirm_psd);  
  20.             String confirmPsd = et_confirm_psd.getText().toString();  
  21.   
  22.             if (!TextUtils.isEmpty(confirmPsd)) {  
  23.                 //灏?#28699;樺偍鍦╯p涓?2浣嶇殑?#30225;?#29212;,鑾?#37721;栧嚭鏉??#21159;鍚?#28751;嗚緭鍏ョ殑?#30225;?#29212;鍚屾牱杩涜?#23470;d5,?#21159;鍚?#28051;巗p涓?#28699;樺偍?#30225;?#29212;?#30254;瀵?/span>  
  24.                 String psd = SpUtil.getString(getApplicationContext(), ConstantValue.MOBILE_SAFE_PSD, "");  
  25.   
  26.                 if (psd.equals(Md5Util.encoder(confirmPsd))) {  
  27.                     //杩?#37711;ョ敤鎴?#37813;?#37832;?#38339;茬?#26945;ā?#28513;,寮鍚?#28051;涓?#37826;扮殑activity  
  28.                     Intent intent = new Intent(getApplicationContext(), testActivity.class);  
  29.                     startActivity(intent);  
  30.                     //璺?#26462;埌鏂扮殑?#26219;闈?#28000;?#37722;?#38343;瑕?#37720;?#38341;愯棌瀵硅瘽妗?/span>  
  31.                     dialog.dismiss();  
  32.                 } else {  
  33.                     ToastUtil.show(getApplicationContext(), "?#32237;鍏ュ瘑?#29212;閿?#29831;?quot;);  
  34.                 }  
  35.   
  36.             } else {  
  37.                 //鎻愮?#34425;敤鎴峰瘑?#29212;?#32237;鍏?#28051;虹?#34425;殑?#20751;鍐?/span>  
  38.                 ToastUtil.show(getApplicationContext(), "璇疯緭鍏ュ瘑?#29212;");  
  39.             }  
  40.         }  
  41.     });  
  42.     bt_cancel.setOnClickListener(new OnClickListener() {  
  43.         @Override  
  44.         public void onClick(View view) {  
  45.             dialog.dismiss();  
  46.         }  
  47.     });  
  48. }  
  49.   
  50. /** 
  51.  * 璁剧疆?#30225;?#29212;瀵硅瘽妗?/span> 
  52.  */  
  53. private void showSetPsdDialog() {  
  54.     //闇瑕佽嚜宸?#37720;?#28729;?#28052;?#28725;硅瘽妗嗙殑鏄剧ず鏍?#23534;?#38171;?#37813;浠?#29781;佽皟?#25956;dialog.setView(view);  
  55.     Builder builder = new Builder(this);  
  56.     final AlertDialog dialog = builder.create();  
  57.     final View view = inflate(this, R.layout.dialog_set_psd, null);  
  58.     //璁?#28725;硅瘽妗?#37828;剧ず涓涓嚜宸?#28729;?#28052;夌殑瀵硅瘽妗嗙晫闈?#37825;堟灉  
  59.     dialog.setView(view);  
  60.     dialog.show();  
  61.   
  62.     Button bt_submit = (Button) view.findViewById(R.id.bt_submit);  
  63.     Button bt_cancel = (Button) view.findViewById(R.id.bt_cancel);  
  64.   
  65.     bt_submit.setOnClickListener(new OnClickListener() {  
  66.         @Override  
  67.         public void onClick(View v) {  
  68.             EditText et_set_psd = (EditText) view.findViewById(R.id.et_set_psd);  
  69.             EditText et_confirm_psd = (EditText) view.findViewById(R.id.et_confirm_psd);  
  70.             String psd = et_set_psd.getText().toString();  
  71.             String confirmPsd = et_confirm_psd.getText().toString();  
  72.             if (!TextUtils.isEmpty(psd) && !TextUtils.isEmpty(confirmPsd)) {  
  73.                 //杩?#37711;ョ敤鎴?#37813;?#37832;?#38339;茬?#26945;ā?#28513;  
  74.                 if (psd.equals(confirmPsd)) {  
  75.                     Intent intent = new Intent(getApplicationContext(), testActivity.class);  
  76.                     startActivity(intent);  
  77.                     //璺?#26462;埌鏂扮殑?#26219;闈?#28000;?#37722;?#38343;瑕?#37720;?#38341;愯棌瀵硅瘽妗?/span>  
  78.                     dialog.dismiss();  
  79.                     SpUtil.putString(getApplicationContext(), ConstantValue.MOBILE_SAFE_PSD, Md5Util.encoder(psd));  
  80.   
  81.                 } else {  
  82.                     ToastUtil.show(getApplicationContext(), "?#30225;鐮佷笉涓鑷?quot;);  
  83.                 }  
  84.   
  85.             } else {  
  86.                 //鎻愮?#34425;敤鎴峰瘑?#29212;?#32237;鍏?#28051;虹?#34425;殑?#20751;鍐?/span>  
  87.                 ToastUtil.show(getApplicationContext(), "璇疯緭鍏ュ瘑?#29212;");  
  88.             }  
  89.         }  
  90.     });  
  91.     bt_cancel.setOnClickListener(new OnClickListener() {  
  92.         @Override  
  93.         public void onClick(View view) {  
  94.             dialog.dismiss();  
  95.         }  
  96.     });  
  97. }
]]>
Android寮鍙?#28729;?#28186;?/category>http://www.ojizl5.fun/android/example/717.html#commenthttp://www.ojizl5.fun/android/http://www.ojizl5.fun/android/feed.asp?cmt=717http://www.ojizl5.fun/android/cmd.asp?act=tb&id=717&key=fc84d9e9
Android Studio锛堜簩鍗?#37711;?#38171;?#38171;欳PU Monitora@b.com (楦″晞绫?http://www.ojizl5.fun/android/environment/716.htmlWed, 11 Oct 2017 09:45:03 +0800http://www.ojizl5.fun/android/environment/716.html銆銆Android Monitor鍖?#37722;?#28051;涓狢PU Monitor锛?#37721;?#28000;?#29825;?#28003;?#38344;炲父鏂逛?#36328;殑鐩?#23092;?#28003;犵殑搴旂敤?#27537;CPU?#27537;浣跨敤銆?#28729;?#37828;剧?#40511;瘯?#30255;?#27537;CPU浣跨敤銆?/p>

銆銆鍦–PU Monitor鏄剧?#28888;鍦?#26473;?#29723;岀殑搴旂敤

銆銆1銆?鎵?#23534;涓涓?#26916;?#37929;?/p>

銆銆2銆?鍦?#37911;╃悊璁?#28598;?#37812;?#38095;?#37815;?#37832;?#28051;?#26473;?#29723;屽?#26050;敤

銆銆3銆?鏄剧?#31688;ndroid Monitor

銆銆4銆?鐐?#37713;籑onitors骞?#28051;?#37828;剧ずCPU Monitor銆?/p>

銆銆濡?#37733;?#38171;?/p>

Android Studio锛堜簩鍗?#37711;?#38171;?#38171;欳PU Monitor

]]>
Android寮鍙戠幆澧?/category>http://www.ojizl5.fun/android/environment/716.html#commenthttp://www.ojizl5.fun/android/http://www.ojizl5.fun/android/feed.asp?cmt=716http://www.ojizl5.fun/android/cmd.asp?act=tb&id=716&key=9bd1816b
鎺?#38013;愬崄鏈珹ndroid寮鍙戠簿閫?#28052;?#32491;?/title><author>a@b.com (楦″晞绫?</author><link>http://www.ojizl5.fun/android/book/715.html</link><pubDate>Wed, 27 Sep 2017 09:47:43 +0800</pubDate><guid>http://www.ojizl5.fun/android/book/715.html</guid><description><![CDATA[<p>銆銆鎺?#38013;愬崄鏈珹ndroid寮鍙戠簿閫?#28052;?#32491;?#37818;ㄨ崘锛屽寘鎷?#28052;?#32491;嶇畝浠?#28000;?#37721;?#38315;?#37722;?#38339;?#29831;?#27996;虹兢锛?/p><p>      <span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;婃繁鍏ョ悊瑙ndroid?#21812;鏍?#29825;?#29825;?#37804;濇兂锛?#32471;?鐗?#38171;?#38171;堜笂涓嬪唽锛?#37510;?/strong></span></p><p>      <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>      鏈?#28052;?#28000;庢搷浣滅郴缁熺殑鍩?#32429;?#29025;?#30225;鍏?#37813;?#38171;屽叏闈?#37715;?#37835;?#26473;?#32459;?绾跨▼銆佸唴瀛?#32480;$悊銆丅inder鏈哄埗銆丟UI鏄剧?#34425;郴缁?#37510;?#28598;氬獟浣?#32480;$悊銆佽緭鍏ョ郴缁?#37510;佽櫄鎷?#37832;虹瓑鏍?#36423;冩妧鏈?#37734;ˋndroid涓殑瀹炵幇鍘熺悊銆?#28052;?#28051;?#29825;?#26473;扮殑?#29025;?#30225;鐐?#28598;?#38318;ㄥ垎鏉ユ簮浜?#23480;?#32459;嬮」鐩?#37934;?#37721;?#38171;屽洜鑰屽叿鏈?#26440;?#23534;虹殑瀹炵敤鎬?#38171;屽笇鏈?#37721;?#28000;?#29825;?#29831;?#38000;?ldquo;?#29025;鍏剁劧锛屾洿?#29025;鍏?#37813;浠ョ劧”銆?#37832;?#28052;﹀垎涓?#32514;?#29831;戠瘒銆佺郴缁?#37720;?#37918;嗙瘒銆佸?#26050;敤鍘?#37918;嗙瘒銆佺郴缁?#23480;?#37711;风瘒锛屽叡4?#30226;25绔?#38171;屽熀鏈?#23057;?#37929;?#27996;?#37721;?#28051;嶢ndroid寮鍙?#37813;闇鍏?#28598;囩殑?#29025;?#30225;锛屽苟閫?#26473;?#28598;?#38322;?#37733;?#37911;?#28051;?#28729;?#28186;嬫潵寮?#28725;?#29831;?#38000;?#28699;︿範锛?#28000;ユ眰灏?#38322;?#37734;?#23143;愮爜?#22414;鏋愬涓?#29831;?#38000;?#37819;?#28186;涙洿鏄?#27996;庣悊瑙g殑鎬?#32513;?#37826;?#23534;?#37510;?#37832;?#28052;︽棦閫?#37722;圓ndroid?#37108;缁?#23480;?#32459;嬪笀锛?#28052;?#38315;?#37722;堜簬搴旂敤寮鍙?#23480;?#32459;嬪?#22559;潵闃?#29831;?#38171;?#28000;?#38000;屾?#24876;?#22023;ndroid寮鍙戣兘鍔?#37510;傝鑰?#37721;?#28000;?#37734;?#37832;?#28052;?#23100;滅Щ榛樺寲?#27537;瀛︿範杩囩▼涓洿?#32321;鍒?#37734;扮悊瑙ndroid?#37108;缁?#38171;屽苟灏?#37813;瀛︾煡?#30225;?#22172;?#21159;鍦?#25652;旂敤?#22476;瀹?#38340;?#23534;鍙?#38341;?#26864;樼殑瑙?#37712;?#28051;?#37510;?/p><p>銆  <span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;夾ndroid Studio搴旂敤寮鍙?#28729;?#37812;?#29831;?#29785;?#37510;?/strong></span></p><p>      <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>       鍏?#28052;?#37711;卞垎18绔?#38171;?#28186;濇璁茶В浜咥ndroid寮鍙戝熀纭銆佹惌寤篈ndroid寮鍙戠幆澧?#37510;丄ndroid Studio闆?#37812;?#23534;鍙戠幆澧?#28000;?#32513;?#37510;丄ndroid Studio?#29238;瑙佹搷浣?#37510;佸垎鏋怉ndroid搴旂敤绋嬪簭鏂?#28000;剁殑缁?#37812;?#37510;丟radle?#22951;鏈?#37737;?#32429;銆乁I?#26219;闈?#29999;?#28766;銆丮aterial Design璁?#29825;?#29831;?#29815;銆?#37837;?#36423;?#32513;?#28000;?#28000;?#32513;?#37510;丄ndroid浜?#28000;?#28598;勭悊銆佸浘褰?#37733;?#37709;?#37724;?#37716;?#37922;?#28598;勭悊銆?#23534;鍙戦煶棰?瑙嗛?#25117;?#26050;敤绋嬪簭銆丟PS鍦?#37733;?#28729;?#28003;?#37510;丄ndroid浼犳?#29111;櫒搴旂敤寮鍙?#37510;?#32514;栧啓瀹?#37711;ㄧ殑搴旂敤绋嬪簭銆丟oogle Now鍜孉ndroid Wear銆丄ndroid搴旂敤浼樺寲浠?#37721;夾ndroid TV寮鍙?#37510;?#37832;?#28052;?#37713;?#28052;庢兜鐩?#27996;咥ndroid Studio搴旂敤寮鍙?#37813;?#20824;娑?#37721;婄殑鎵鏈?#26864;嗗煙锛?#37734;?#29825;茶В?#30241;涓涓煡?#30225;鐐?#37827;?#38171;岄兘閬?#23536;?#27996;嗙悊璁鸿?#26050;郴瀹?#38340;呯殑璁茶В鏂?#23534;?#38171;岀敤鍏?#28003;?#28729;?#28186;嬪?#35826;簳鍓?#37835;?#27996;咥ndroid Studio寮鍙戠殑?#30241;涓涓煡?#30225;鐐?#37510;?#37832;?#28052;?#29825;茶В鏂规硶閫氫織鏄撴噦锛?#37911;?#37714;?#37832;?#37714;?#27996;?#37714;?#28699;?#38000;?#28699;︿範骞舵?#22557;寲銆?#37832;?#28052;?#38315;?#37722;圓ndroid鍒?#32510;?#29831;?#38000;?#37510;丄ndroid搴旂敤寮鍙戜?#21700;憳銆丄ndroid鐖卞ソ鑰?#37510;丄ndroid Studio寮鍙戜?#21700;憳銆丄ndroid鏅鸿兘瀹?#28766;?#37510;丄ndroid鍙?#32460;?#37812;?#29825;?#28598;囩爺鍙戜?#21700;憳瀛︿範锛?#28052;?#37721;?#28000;?#28003;?#28051;虹浉鍏冲煿璁?#28699;?#37837;?#37724;?#28598;?#28051;?#38340;?#37837;?#37929;?#37711;?#28051;?#28051;氱殑?#26240;瀛︾敤涔?#37510;?/p><p>銆  <span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;婃繁鍏?#29785;?#37835;怉ndroid 铏?#37815;?#37832;?#37510;?/strong></span></p><p>      <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>       Android?#37108;缁?#28000;?#29831;?#37922;熷埌?#24135;鍦ㄧ殑鐭?#37933;?#37713;犲?#23384;?#22549;棿閲?#38171;屽嚟鍊?#37711;?#37828;撶敤鎬?#37724;?#23534;鍙戠殑绠娲佹?#38171;岃耽寰?#27996;嗗箍澶?#23534;鍙戣呯殑鏀?#37816;?#37510;?#37734;?#37825;?#28051;狝ndroid?#37108;缁?#28051;?#38171;孌alvik VM涓?#27967;?#27128;璐?#32460;?#28000;?#25652;?#28766;傚唴鏍稿埌楂樺眰搴旂敤寮鍙戠殑鏍?#36423;?#37510;?#37832;?#28052;?#23536;?#25652;忔笎杩?#37734;?#29825;茶В浜咥ndroid铏?#37815;?#37832;虹郴缁熺殑鍩?#37832;煡?#30225;锛屽苟鍓?#37835;?#27996;?#37711;舵暣涓唴瀛樼郴缁熺殑杩?#32459;嬪拰杩?#28003;?#23092;?#32459;?#38171;屽苟瀵硅櫄鎷?#37832;虹郴缁?#28028;樺?#26663;拰寮傚父澶勭?#21977;殑?#29025;?#30225;杩涜浜嗚缁?#29825;茶В銆?#37832;?#28052;?#37713;?#28052;庢兜鐩?#27996;咲alvik VM?#37108;缁熺殑鎵鏈?#28051;?#29781;佸唴瀹?#38171;屽苟涓?#29825;茶В鏂规硶閫氫織鏄撴噦锛?#37911;?#37714;?#37832;?#37714;?#27996;?#29831;?#38000;?#28699;︿範骞舵?#22557;寲銆?/p><p>銆銆<span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;夾ndroid浼犳?#29111;櫒寮鍙?#28051;庢?#40511;兘璁?#28598;?#22935;堜?#23338;疄鎴?#37510;?/strong></span></p><p>      <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>      鏈?#28052;?#28051;?#29781;佷粙缁岮ndroid浼犳?#29111;櫒鍜?#28598;?#29825;剧殑寮鍙?#38171;屽叡29绔?#38171;?#28051;?#29781;佸寘鎷珹ndroid寮鍙戞妧鏈?#37737;?#32429;銆佽幏鍙栧苟缂?#29831;戞?#24878;爜銆丄ndroid?#22951;鏈?#37837;?#36423;?#22935;嗘?#36346;垎鏋?#37510;丄ndroid浼犳?#29111;櫒?#37108;缁熷垎鏋?#37510;佷?#36328;敤鍦?#37733;?#28729;?#28003;?#37510;?#37711;夌嚎浼犳?#29111;櫒璇?#29785;?#37510;佹帴杩戣鎶?#28028;犳?#29111;櫒璇?#29785;?#37510;佺?#20344;満浼犳?#29111;櫒璇?#29785;?#37510;?#37716;?#38315;?#25652;?#28028;犳?#29111;櫒璇?#29785;?#37510;?#37826;?#37722;戜?#29363;?#29111;櫒璇?#29785;?#37510;?#38340;铻?#28000;?#28028;犳?#29111;櫒璇?#29785;?#37510;佹棆杞?#37722;?#38322;?#28028;犳?#29111;櫒璇?#29785;?#37510;佽?#28616;浼犳?#29111;櫒璇?#29785;?#37510;佹皵鍘嬩?#29363;?#29111;櫒璇?#29785;?#37510;佹俯搴?#28028;犳?#29111;櫒璇?#29785;?#37510;佹箍搴?#28028;犳?#29111;櫒璇?#29785;?#37510;丄ndroid钃?#37911;欑郴缁熸杩?#37510;佷綆鍔?#38000;?#38019;?#37911;欐妧鏈?#29831;?#29785;?#37510;佽闊宠瘑鍒妧鏈?#29831;?#29785;?#37510;?#37813;?#37716;胯瘑鍒妧鏈?#29831;?#29785;?#37510;丯FC杩戝満閫氫俊?#22951;鏈?#29831;?#29785;?#37510;?#37815;嶇収瑙?#37835;?#37833;?#35120;㈢爜?#22951;鏈?#29831;?#29785;?#37510;佸?#36720;簬鍥?#37709;?#28598;勭?#21977;殑浜鸿?#27468;瘑鍒妧鏈?#29831;?#29785;?#37510;佽?#23683;蛋杞?#26473;?#29825;板?#26334;櫒銆?#37813;?#37716;块煶涔愭挱鏀?#37731;?#37724;屾?#40511;兘瀹?#28766;呯郴缁熺瓑銆?#37832;?#28052;?#37713;?#28052;庢兜鐩?#27996;咥ndroid浼犳?#29111;櫒鍜?#28598;?#29825;?#23534;鍙?#37813;闇?#27537;鎵鏈?#28051;?#29781;佸唴瀹?#38171;岃?#33590;В鏂规硶閫氫織鏄撴噦銆?/p><p>銆銆<span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;?#37835;勫缓瀹?#37711;ㄧ殑Android App銆?/strong></span></p><p>      <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>      鏈?#28052;?#28000;?#32513;嶄簡涓?#23092;佺殑Android瀹?#37711;ㄦ妧鏈?#23534;鍙戠殑鏂规硶锛屽?#33333;妸姝?#37826;规硶搴旂敤鍦?#37825;?#28051;狝ndroid搴旂敤寮鍙戠殑浠g爜閲?#37510;?#28052;?#28051;?#28003;?#38000;?#28003;跨敤璇?#32513;嗙殑渚?#28699;?#38171;?#28000;?#37812;愮櫨涓?#37719;?#28051;?#28000;栧凡缁?#27996;茶嚜瀹?#37837;哥殑搴旂敤绋嬪簭涓?#38171;屽府鍔?#29831;?#38000;呰В璇诲?#26050;敤绋嬪簭琚?#37824;诲嚮?#27537;鍘?#37733;?#38171;岀劧鍚庢?#26050;?#28888;洿瀹?#37711;ㄧ殑瑙?#37712;?#37826;?#22935;?#37510;?#28052;?#28051;?#37718;?#37815;韩浠介?#23683;瘉銆佺?#25120;粶銆佹暟鎹?#25652;?#37510;?#37832;?#37716;?#37731;?#37824;诲嚮銆佹暟鎹?#37510;?#32429;?#28000;?#32475;夋妧鏈?#38171;屽苟闃?#37828;?#27996;嗘瘡绉嶆妧鏈?#28000;g爜绀?#28186;嬬殑鍚?#28052;?#37724;?#28003;滅敤锛?#37721;?#28000;?#29999;?#37716;?#29831;?#38000;?#26440;惧埌瀛?#28000;?#38007;寸敤?#27537;鐩?#37837;?#37510;?/p><p>銆銆<span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;夾ndroid 搴旂敤娴嬭瘯?#23514;鍗?#37510;?/strong></span></p><p>       <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>      銆夾ndroid搴旂敤娴嬭瘯?#23514;鍗?#37510;嬫槸涓鏈?#32457;?#37716;?#23092;嬭瘯瀹炵敤宸?#37711;?#28052;?#37510;?#37832;?#28052;﹂拡瀵瑰綋鍓?#23092;佽?#23680;殑?#22951;鏈?#37510;?#22935;嗘?#36346;?#23677;伐绋嬭川閲忔敼杩?#23480;?#37711;?#26473;涜浜?#28000;?#32513;?#38171;?#28051;姝?#28051;姝?#23059;呮櫚鍦版寚瀵?#28598;?#28729;?#28641;?#28003;?#37720;诲啓搴旂敤绋嬪簭?#27537;娴嬭瘯?#25956;渚?#38171;屽埄?#25956;鍚勭娴嬭瘯鎵嬫鏉ヤ繚璇丄ndroid椤?#37929;?#29840;?#38322;?#37510;?#37832;?#28052;?#26851;?#37711;堜粙缁嶄簡TTD锛圓ndroid娴嬭瘯椹?#37716;?#23534;鍙?#38171;?#37510;俆TD?#27128;杞?#28000;?#23534;鍙戣?#22249;▼涓?#28051;涓?#37825;忔?#38155;ā寮?#38171;岃兘璁?#28003;犲湪鏃?#37832;?#37721;戠幇搴旂敤涓殑Bug銆?#28052;?#28051;?#32513;?#37713;轰簡涓浜?#37711;稿瀷?#27537;鏍?#28186;嬪伐绋嬫潵绀鸿寖娴嬭瘯锛屽寘鎷?#37832;绠鍗曠殑鍗?#37711;?#23092;嬭瘯鍜?#37832;澶?#37833;傜殑鎬ц兘娴嬭瘯銆?#37721;?#28598;?#38171;?#37832;?#28052;?#28000;?#29831;?#37826;殑鏂?#23534;忔潵璇?#32513;嗘弿杩癆ndroid娴嬭瘯涓?#26440;?#39582;?#23049;?#37510;佽緝娴佽?#23680;殑搴旂敤?#22951;鏈?#37510;?#28725;逛?#24226;ⅵ?#20802;鍦ˋndroid娴嬭瘯棰嗗煙鍚埅?#27537;绋嬪簭鍛樺?#23678;?#23341;瘯浜哄憳鏉?#29831;?#26473;欐?#29365;?#25118;槸涓鏈?#38344;炲父?#24381;璐?#37510;?#37832;夌敤?#27537;鍙?#38000;?#28052;?#37510;?/p><p>銆銆<span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;婄簿閫欰ndroid缃戠粶寮鍙?#37510;?/strong></span></p><p>       <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>       鏈?#28052;?#29831;?#32513;?#28000;?#32513;嶄?#21669;ndroid缃戠粶寮鍙戠殑鏈?#37711;冲唴瀹?#38171;屽叏涔?#37711;卞垎涓??#30226;锛屽叡璁?5绔?#38171;?#28000;庢惌寤篈ndroid寮鍙戠幆澧?#37724;屾牳蹇?#22935;嗘?#36346;垎鏋?#29825;茶捣锛?#28186;濇璁茶В浜咥ndroid?#22951;鏈?#37837;?#36423;?#22935;嗘灦锛岀?#25120;粶寮鍙戞妧鏈?#37737;?#32429;锛孒TTP?#26271;鎹?#38315;氫俊锛孶RL澶勭悊?#26271;鎹?#38171;?#28598;勭悊XML?#26271;鎹?#38171;?#28051;?#26462;?#26473;?#32459;嬫暟鎹?#38171;?#28051;?#28028;犳暟鎹?#38171;?#28003;跨敤Socket瀹炵?#29256;暟鎹?#38315;氫俊锛?#28003;跨敤WebKit娴?#29785;堢綉椤垫暟鎹?#38171;學i-Fi?#37108;缁?#25652;旂敤锛岃摑鐗欑郴缁?#25652;旂敤锛岄偖浠跺?#26050;敤锛孯SS搴旂敤锛岀?#25120;粶瑙嗛澶勭悊锛岀?#25120;粶娴?#38322;?#37929;?#37818;?#38171;岀?#25120;粶RSS闃?#29831;诲櫒锛?#23534;鍙?#28051;涓?#38317;?#28000;剁郴缁?#38171;?#37734;ˋndroid涓?#23534;鍙戠Щ鍔?#23536;?#37719;氬?#26050;敤銆佺?#25120;粶闃茬伀澧欑郴缁?#38171;?#23534;鍙慦eb鐗堢殑鐢佃瘽鏈?#32480;?#37918;嗙郴缁?#37510;佺Щ鍔?#23536;俊?#37108;缁熺?#22796;煡?#30225;銆?#37832;?#28052;?#37713;?#28052;庢兜鐩?#27996;咥ndroid缃戠粶搴旂敤涓殑鎵鏈?#28051;?#29781;佸唴瀹?#38171;岃?#33590;В鏂规硶閫氫織鏄撴噦銆?/p><p>銆銆<span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;奐ava鍜孉ndroid寮鍙?#28699;?#28052;犳寚鍗?#38171;?#32471;?鐗?#38171;?#37510;?/strong></span></p><p>       <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>       鏈?#28052;︽槸Java璇?#29815;瀛?#28052;犳寚鍗?#38171;?#37911;?#37714;拡瀵?#28003;跨敤Java杩涜?#23369;ndroid搴旂敤绋嬪簭寮鍙?#28766;?#23534;浜嗚缁?#28000;?#32513;?#37510;?#37711;?#28052;?#37711;?0绔?#37510;傚垎涓?#28051;?#28598;?#38318;ㄥ垎銆?#32471;?閮ㄥ垎锛?#32471;?绔犲埌绗?2绔?#38171;?#28051;?#29781;佷粙缁岼ava璇?#29815;鍩?#32429;?#29025;?#30225;鍙?#37711;?#37716;熻兘鐗?#37804;?#37510;?#32471;?閮ㄥ垎锛?#32471;?3绔犲埌绗?0绔?#38171;?#28051;?#29781;佷粙缁嶅浣?#37832;夋晥鍦?#37835;勫?#31688;ndroid搴旂敤绋嬪簭銆?#37832;?#28052;?#38315;?#37722;堜换浣曟兂瑕?#28699;︿範Java璇?#29815;?#27537;璇?#38000;?#38339;?#29831;?#38171;?#37911;?#37714;?#38315;?#37722;堟兂瑕?#37812;?#28051;篈ndroid搴旂敤绋嬪簭寮鍙戜?#21700;?#27196;殑璇?#38000;?#28699;︿範鍙?#38000;?#37510;?/p><p>銆銆<span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;夾ndroid寮鍙戣繘闃?#38171;?#28000;?#28751;?#23480;ュ埌涓?#28729;?#37510;?/strong></span></p><p>      <strong>涔?#32491;嶇畝浠?#38171;?/strong></p><p>      鏈?#28052;︽槸涓鏈?#28051;?#38338;?#28000;?#32513;岮ndroid寮鍙戠殑鍥?#28052;?#37510;?#28052;?#28051;?#26851;?#37711;?#28725;笰ndroid寮鍙戠殑鏍?#36423;冪煡?#30225;鐐?#26473;涜?#23678;繁鍏?#29825;茶В锛岀劧鍚?#28000;?#32513;?#37719;?#37711;?#23092;嬭瘯銆佷唬?#29212;瑙勮寖銆?#37911;堟湰鎺у埗銆?#38322;?#37835;?#37510;?#37835;?#37835;勭瓑閲?#29781;佺殑?#29025;?#30225;锛?#28003;?#23536;?#29831;?#38000;?#37734;ㄦ繁鍏?#37818;屾彙?#22951;鏈殑鍚屾椂涔?#29999;?#37716;?#28000;栦滑寮闃?#37930;肩晫锛?#28051;旇兘澶?#28000;ユ洿涓?#28051;氱殑鏂?#23534;?#29825;?#29825;?#25652;旂敤杞?#28000;?#38171;屽畬鎴?#28000;?#37721;細瀹炵幇鍔熻兘?#27537;鍒?#32510;?#32459;嬪簭鍛樺埌杞?#28000;?#23480;?#32459;嬪笀銆?#29825;?#29825;?#29999;堢殑杞?#37721;?#37510;?#37832;?#28052;︾殑涓?#29781;佸唴瀹?#28051;?#38171;?#37835;?#37812;怉ndroid?#37108;缁?#37737;虹煶?#27537;鍥?#28598;?#32513;?#28000;?#37510;佸垱閫犲嚭涓?#28725;?#28598;氬僵?#27537;UI璁?#29825;$殑鎺?#28000;?#37510;佷繚璇丄pp娴佺?#21615;殑澶?#32510;跨▼寮鍙?#37510;佸?#21615;煡蹇呬細?#27537;HTTP缃戠粶璇锋眰搴旂敤銆佹暟鎹?#28699;樺偍?#27537;鏍?#36423;僑QLite?#26271;鎹?#25652;?#37510;?#29825;?#32459;嬪?#24532;洿浼樼?#27537;鎬ц兘浼樺寲銆?#29825;?#32459;嬪?#24532;洿鏁存?#20346;殑浠g爜瑙勮寖銆?#32480;?#37918;嗙?#23338;簭?#27537;濂?#29999;?#37813;婫it鐗堟湰鎺у埗锛?#28000;?#37721;?#38343;瑕?#37818;屾彙?#27537;楂?#32510;ф妧鏈?#38171;屽鍗?#37711;?#23092;嬭瘯銆?#37711;?#28598;?#37720;?#37714;?#28051;?#29825;?#29825;?#22959;?#23534;?#37510;?#38322;?#37835;?#37724;?#32513;?#37722;?#28729;?#37812;樼瓑銆?/p><p>銆銆 <span style="font-size: medium;"><strong>涔?#32491;嶅?#23943;О锛?#37510;夾ndroid妗嗘灦鎻?#32457;?#37510;?/strong></span></p><p>       涔?#32491;嶇畝浠?#38171;?#37510;夾ndroid妗嗘灦鎻?#32457;?#37510;?#38315;?#26473;?#28725;笰ndroid?#37108;缁熸簮浠g爜?#27537;?#22414;鏋?#38171;?#28051;?#29781;佷粙缁岮ndroid妗嗘?#21057;殑鍒濆?#23338;寲杩囩▼鍙?#28051;?#29781;?#32513;?#28000;剁殑宸?#28003;?#37720;熺悊銆?#28003;?#38000;呯洿?#24116;?#22414;鏋愬?#23678;?#23544;悊浜咥ndroid妗嗘?#21057;殑涓?#29781;佹簮浠g爜锛屽苟璇?#32513;?#29825;茶В浜嗙悊瑙?#22935;嗘灦宸?#28003;?#37720;熺悊鎵闇?#27537;鍚勭?#23941;熀纭?#29025;?#30225;鍜屾瀯鎴愬疄闄匒ndroid骞?#37721;?#26976;?#39582;茬殑鏈?#37716;?#22935;嗘灦銆?#37711;?#28051;殑涓?#29781;佸唴瀹?#37718;?#37815;?#38171;?#38315;?#26473;?#37722;?#37716;?#32459;嬪簭浜嗚ВAndroid妗嗘?#21057;殑姒傝锛岀?#32472;?#23726;ndroid浠?#37721;?#28641;?#28003;?#23534;鍙?#38315;?#37722;?#37722;勭鏈哄櫒?#27537;搴旂敤绋嬪簭锛屽垎鏋怉ndroid妗嗘灦鎵闇?#27537;鍩?#32429;?#29025;?#30225;锛孞NI(Java Native Interface)涓嶣inder鍩?#32429;?#29025;?#30225;锛孼ygote銆丼ervice Manager銆丼ervice Server绛堿ndroid鏍?#36423;?#32513;?#28000;?#38171;孉ndroid鏈?#37716;?#22935;嗘?#21057;殑缁?#37835;?#28051;庣悊瑙?#38171;岄?#26473;嘋amera Service銆丄ctivity Manager Service绛?#37832;?#37716;″垎鏋愬疄闄呯殑Android鏈?#37716;?#32475;?#37510;?#37510;夾ndroid妗嗘灦鎻?#32457;?#37510;?#28051;?#28000;?#37721;?#28000;?#28186;?#37711;?#28598;?#28051;瀹?#23534;鍙戠粡楠岀殑Android寮鍙戜?#21700;憳鍙?#38000;?#38339;?#29831;?#38171;?#28052;?#37721;?#28003;?#28051;篈ndroid寮鍙?#37714;?#28699;?#38000;呯殑Android妗嗘灦鍏?#38338;?#37825;欐潗浣跨敤銆?/p>]]></description><category>Android寮鍙?#28052;?#32491;?/category><comments>http://www.ojizl5.fun/android/book/715.html#comment</comments><wfw:comment>http://www.ojizl5.fun/android/</wfw:comment><wfw:commentRss>http://www.ojizl5.fun/android/feed.asp?cmt=715</wfw:commentRss><trackback:ping>http://www.ojizl5.fun/android/cmd.asp?act=tb&id=715&key=c4f6dda4</trackback:ping></item><item><title>Android鎵?#37832;?#37719;?#28601;?#38171;堜簩鍗佷竴锛?#38171;?#32429;?#29825;ゅ瘑?#29212;瀵硅瘽妗嗙?#26663;啓a@b.com (楦″晞绫?http://www.ojizl5.fun/android/example/714.htmlTue, 19 Sep 2017 09:33:33 +0800http://www.ojizl5.fun/android/example/714.html 銆  鏈?#37826;囨帴?#28483;瀹炵幇“纭?#29825;ゅ瘑?#29212;”鍔熻兘锛?#28052;?#37719;虫槸?#25956;鎴?#28000;?#37715;?#29825;剧疆杩囧瘑?#29212;锛岀幇鍦?#37721;?#38343;瑕佽緭鍏?#32429;?#29825;ゅ瘑?#29212;

Android鎵?#37832;?#37719;?#28601;?#38171;堜簩鍗佷竴锛?#38171;?#32429;?#29825;ゅ瘑?#29212;瀵硅瘽妗嗙?#26663;啓

銆銆甯?#28766;鏂?#28000;跺拰銆?a href="http://www.ojizl5.fun/android/example/704.html" target="_blank">Android 鎵?#37832;?#37719;?#28601;?-璁剧疆?#30225;?#29212;瀵硅瘽妗?/a>銆?#28051;殑甯?#28766;鍩?#37832;?#32491;?#28028;?#38171;?#37813;鏈塩opy涓涓?#38171;屼慨鏀?#28051;鐐?#32513;嗚妭灏?#37820;?#28729;?#38171;?/p>

XML/HTML浠g爜
  1. <?xml version="1.0" encoding="utf-8"?>  
  2. <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"  
  3.     android:layout_width="match_parent"  
  4.     android:layout_height="match_parent"  
  5.     android:orientation="vertical">  
  6.   
  7.     <TextView  
  8.         style="@style/TitleStyle"  
  9.         android:background="#f00"  
  10.         android:text="纭?#29825;ゅ瘑?#29212;"  
  11.         />  
  12.     <EditText  
  13.         android:id="@+id/et_confirm_psd"  
  14.         android:layout_width="match_parent"  
  15.         android:layout_height="wrap_content"  
  16.         android:hint="纭?#29825;ゅ瘑?#29212;"  
  17.         />  
  18.   
  19.     <LinearLayout  
  20.         android:layout_width="match_parent"  
  21.         android:layout_height="wrap_content">  
  22.   
  23.         <Button  
  24.             android:id="@+id/bt_submit"  
  25.             android:layout_width="0dp"  
  26.             android:layout_height="wrap_content"  
  27.             android:layout_weight="1"  
  28.             android:text="纭?#29825;?quot; />  
  29.   
  30.         <Button  
  31.             android:id="@+id/bt_cancel"  
  32.             android:layout_width="0dp"  
  33.             android:layout_height="wrap_content"  
  34.             android:layout_weight="1"  
  35.             android:text="鍙?#23057;?quot; />  
  36.     </LinearLayout>  
  37.   
  38. </LinearLayout>  

銆銆浠g爜閫?#26440;?#28052;?#37737;?#37832;?#32491;?#28028;?#38171;?#32480;鍗曠殑淇?#37824;?#28051;涓?/p>

Java浠g爜
  1. /** 
  2.  * 纭?#29825;ゅ瘑?#29212;瀵硅瘽妗?/span> 
  3.  */  
  4. private void showConfirmPsdDialog() {  
  5.     //闇瑕佽嚜宸?#37720;?#28729;?#28052;?#28725;硅瘽妗嗙殑鏄剧ず鏍?#23534;?#38171;?#37813;浠?#29781;佽皟?#25956;dialog.setView(view);  
  6.     Builder builder = new Builder(this);  
  7.     final AlertDialog dialog = builder.create();  
  8.     final View view = inflate(this, R.layout.dialog_confirm_psd, null);  
  9.     //璁?#28725;硅瘽妗?#37828;剧ず涓涓嚜宸?#28729;?#28052;夌殑瀵硅瘽妗嗙晫闈?#37825;堟灉  
  10.     dialog.setView(view);  
  11.     dialog.show();  
  12.   
  13.     Button bt_submit = (Button) view.findViewById(R.id.bt_submit);  
  14.     Button bt_cancel = (Button) view.findViewById(R.id.bt_cancel);  
  15.   
  16.     bt_submit.setOnClickListener(new OnClickListener() {  
  17.         @Override  
  18.         public void onClick(View v) {  
  19.             EditText et_confirm_psd = (EditText) view.findViewById(R.id.et_confirm_psd);  
  20.             String confirmPsd = et_confirm_psd.getText().toString();  
  21.             String psd = SpUtil.getString(getApplicationContext(),ConstantValue.MOBILE_SAFE_PSD, "");  
  22.             if(!TextUtils.isEmpty(confirmPsd)){  
  23.                 //杩?#37711;ョ敤鎴?#37813;?#37832;?#38339;茬?#26945;ā?#28513;  
  24.                 if(psd.equals(confirmPsd)) {  
  25.                     Intent intent = new Intent(getApplicationContext(), testActivity.class);  
  26.                     startActivity(intent);  
  27.                     //璺?#26462;埌鏂扮殑?#26219;闈?#28000;?#37722;?#38343;瑕?#37720;?#38341;愯棌瀵硅瘽妗?/span>  
  28.                     dialog.dismiss();  
  29.                 } else {  
  30.                     ToastUtil.show(getApplicationContext(),"?#32237;鍏ュ瘑?#29212;閿?#29831;?quot;);  
  31.                 }  
  32.   
  33.             }else{  
  34.                 //鎻愮?#34425;敤鎴峰瘑?#29212;?#32237;鍏?#28051;虹?#34425;殑?#20751;鍐?/span>  
  35.                 ToastUtil.show(getApplicationContext(),"璇疯緭鍏ュ瘑?#29212;");  
  36.             }  
  37.         }  
  38.     });  
  39.     bt_cancel.setOnClickListener(new OnClickListener() {  
  40.         @Override  
  41.         public void onClick(View view) {  
  42.             dialog.dismiss();  
  43.         }  
  44.     });  
  45. }
]]>
Android寮鍙?#28729;?#28186;?/category>http://www.ojizl5.fun/android/example/714.html#commenthttp://www.ojizl5.fun/android/http://www.ojizl5.fun/android/feed.asp?cmt=714http://www.ojizl5.fun/android/cmd.asp?act=tb&id=714&key=ec305767
Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?4a@b.com (楦″晞绫?http://www.ojizl5.fun/android/game/713.htmlWed, 13 Sep 2017 09:47:01 +0800http://www.ojizl5.fun/android/game/713.html銆銆鏈変簡鍓?#38344;?#37713;犵瘒NDK涓嶫NI寮鍙戠浉鍏冲熀纭鍋氶?#21700;灚锛屽啀鏉?#38315;?#26473;?#28000;g爜璇?#37828;?#28051;?#26473;?#37826;?#38344;?#37711;?#28003;撶殑?#25655;浣?#28000;?#37721;?#28051;浜?#38322;?#29781;佺殑缁嗚妭銆?#38317;?#28052;?#38171;?#28751;?#32513;?#32513;?a href="http://www.ojizl5.fun/android/catalog.asp?tags=NDK" target="_blank">NDK涓嶫NI?#27537;瀛?#28052;犳?#32513;?#37510;?/p>

銆銆JavaVM鍜孞NIEnv

銆銆鍦╦ni.h澶?#37826;?#28000;?#28051;?#28729;?#28052;変簡涓?#32457;?#38322;?#29781;佺殑?#26271;鎹?#32513;?#37835;凧avaVM鍜孞NIEnv锛屽苟涓?#37734;–鍜孋++涓?#28729;冧滑?#27537;瀹炵?#29256;槸涓嶅?#23680;殑(閫?#26473;?if defined(__cplusplus)瀹?#28729;?#28052;?#28729;炵幇)銆?#37832;?#29840;?#38318;芥槸?#23514;鍚?#28751;佽浜咼NI鍑芥暟鍒?#29723;ㄧ殑?#23514;?#25313;銆?/p>

銆銆JavaVM

銆銆?#27128;java铏?#37815;?#37832;?#37734;╦ni灞傜殑琛?#32448;?#37510;?#37734;ˋndroid涓?#28051;涓狫VM鍙?#37711;?#29825;?#37832;?#28051;涓狫avaVM瀵硅薄銆?#37721;?#28000;?#37734;?#32510;跨?#23342;棿鍏?#27996;?#28051;涓狫avaVM瀵硅薄銆?/p>

銆銆JavaVM澹?#37828;?/strong>

銆銆鍦╦ni涓拡瀵笴璇?#29815;?#24134;澧?#37724;孋++璇?#29815;?#24134;澧冪殑JavaVM瀹炵幇鏈?#37813;涓嶅悓銆?/p>

銆銆C鐗堢殑JavaVM澹?#37828;?#28051;?#38171;?/p>

C++浠g爜
  1. typedef const struct JNIInvokeInterface* JavaVM;  
  2.   
  3. struct JNIInvokeInterface {  
  4.     void*       reserved0;  
  5.     void*       reserved1;  
  6.     void*       reserved2;  
  7.   
  8.     jint        (*DestroyJavaVM)(JavaVM*);  
  9.     jint        (*AttachCurrentThread)(JavaVM*, JNIEnv**, void*);  
  10.     jint        (*DetachCurrentThread)(JavaVM*);  
  11.     jint        (*GetEnv)(JavaVM*, void**, jint);  
  12.     jint        (*AttachCurrentThreadAsDaemon)(JavaVM*, JNIEnv**, void*);  
  13. };  

銆銆C++鐗堢殑JavaVM澹?#37828;?#28051;?#38171;?/p>

Java浠g爜
  1. typedef _JavaVM JavaVM;  
  2.   
  3. struct _JavaVM {  
  4.     const struct JNIInvokeInterface* functions;  
  5.   
  6. #if defined(__cplusplus)  
  7.     jint DestroyJavaVM()  
  8.     { return functions->DestroyJavaVM(this); }  
  9.     jint AttachCurrentThread(JNIEnv** p_env, void* thr_args)  
  10.     { return functions->AttachCurrentThread(this, p_env, thr_args); }  
  11.     jint DetachCurrentThread()  
  12.     { return functions->DetachCurrentThread(this); }  
  13.     jint GetEnv(void** env, jint version)  
  14.     { return functions->GetEnv(this, env, version); }  
  15.     jint AttachCurrentThreadAsDaemon(JNIEnv** p_env, void* thr_args)  
  16.     { return functions->AttachCurrentThreadAsDaemon(this, p_env, thr_args); }  
  17. #endif /*__cplusplus*/  
  18. };  

銆銆JavaVM鑾?#37721;?#37826;?#23534;?/strong>

銆銆(1)jni鍔?#37804;佹敞鍐岀殑鏂?#23534;?#37510;?#37734;?#37716;?#26462;?#37716;?#37804;侀摼?#24116;搴撶殑鏃跺?#38171;孞VM?#32048;?#30367;?#25956;JNI_OnLoad(JavaVM* vm, void* reserved)锛屽?#26421;?#29362;叆JavaVM?#23514;?#25313;锛?/p>

C++浠g爜
  1. JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {  
  2.   
  3. }  

銆銆(2)鍦?#37832;?#37734;?#28000;?#37934;佷腑閫?#26473;囪皟?#25956;jint JNI_CreateJavaVM(JavaVM**, JNIEnv**, void*)鏉?#37714;涘缓銆?/p>

銆銆JNIEnv

銆銆绠鍗?#37833;?#29831;?#38171;?#28751;辨槸JNIEnv鎻?#28186;?#27996;?#37813;鏈塉NI鍑芥暟?#30367;?#25956;?#27537;?#24116;鍙?#37510;?#28051;嶈兘鍦?#32510;跨?#23342;棿鍏?#27996;?#37722;?#28051;涓狫NIEnv鍙?#38322;?#38171;?#28000;?#37734;?#37714;涘缓瀹冪殑绾跨▼鏈夋晥锛屽鏋?#29781;?#37734;?#37711;?#28729;冪?#36328;▼璁?#38338;甁VM锛岄渶瑕佽皟?#25956;AttachCurrentThread鎴朅ttachCurrentThreadAsDaemon灏嗗綋鍓嶇?#36328;▼涓嶫VM缁?#28729;?#37510;?#37712;?#38315;?#26473;嘕avaVM瀵硅薄?#27537;GetEnv鏉?#38014;?#37721;朖NIEnv銆?/p>

銆銆JNIEnv澹?#37828;?/strong>

銆銆涓嶫avaVM绫?#28028;?#38171;孞NIEnv鍦–鍜孋++璇?#29815;涓殑澹?#37828;?#28052;?#37832;?#37813;涓嶅悓銆?/p>

銆銆C鐗堢殑JavaVM澹?#37828;?#28051;?#38171;?/p>

C++浠g爜
  1. typedef const struct JNINativeInterface* JNIEnv;  
  2.   
  3. struct JNINativeInterface {  
  4.         jint        (*GetVersion)(JNIEnv *);  
  5.         ···  
  6. }  

銆銆C++鐗堢殑JavaVM澹?#37828;?#28051;?#38171;?/p>

C++浠g爜
  1. typedef _JNIEnv JNIEnv;  
  2.   
  3. struct _JNIEnv {  
  4.     /* do not rename this; it does not seem to be entirely opaque */  
  5.     const struct JNINativeInterface* functions;  
  6.   
  7. #if defined(__cplusplus)  
  8.   
  9.     jint GetVersion()  
  10.     { return functions->GetVersion(this); }  
  11.   
  12.     ...  
  13. }  

銆銆jobject銆乯class銆乯methodID鍜宩fieldID

銆銆jobject锛?/strong>

銆銆?#27128;JNI瀵?#37720;熷?#23189;ava.lang.Object?#27537;鏄犲皠銆?#37721;?#28000;?#38315;?#26473;囪皟?#25956;NewObject鏉?#38014;?#23536;?#28051;涓猨object瀵硅薄銆備?#23338;锛?/p>

銆銆env->NewObject(jclass clazz, jmethodID methodID, ...)

銆銆jclass锛?/strong>

銆銆?#27128;JNI瀵?#37720;熷?#23189;ava.lang.Class?#27537;鏄犲皠銆?#37721;?#28000;?#38315;?#26473;囪皟?#25956;FindClass鏉?#38014;?#23536;梛class瀵硅薄銆備?#23338;锛?/p>

銆銆jclass intArrayClass = env->FindClass("[I");

銆銆jmethodID锛?/strong>

銆銆鑾?#37721;?#28725;?#25652;?#32491;?#37812;愬憳鏂规硶?#27537;鏂规硶id銆?#37721;?#28000;?#38315;?#26473;囪皟?#25956;GetMethodID鏉?#38014;?#37721;?#37510;備?#23338;锛?/p>

銆銆jmethodID myMethodId = env->(jclass clazz, const char *name, const char *sig);

銆銆jfieldID锛?/strong>

銆銆鑾?#37721;?#28725;?#25652;?#32491;?#37812;愬憳鍙?#38322;忕殑瀛楁id銆?#37721;?#28000;?#38315;?#26473;囪皟?#25956;GetFieldID鏉?#38014;?#23536;?#37510;備?#23338;锛?/p>

銆銆jfieldID nameFieldId = env->GetFieldID(jclass clazz, const char *name, const char *sig)

銆銆鏈?#37734;?#25652;撹皟?#25956;

銆銆JNI?#27537;鍔?#26462;?#37832;?#37734;?#25652;?#28051;殑浠g爜锛屾楠?#32480;杩?#28641;?#28051;?鍚屾椂锛?#28052;熸槸Android鎺?#38013;愮殑鍋氭硶)锛?/p>

銆銆(1)鍦╦ava绫荤殑闈欐佸潡涓皟?#25956;System.loadLibrary鏉?#37716;?#26462;?#37716;?#37804;佸簱锛岃嫢鍔?#37804;佸?#25782;殑鍚?#28699;?#28051;簂ibcocos2dx.so锛岄偅涔?#38171;岃皟?#25956;涓?#38171;?/p>

Java浠g爜
  1. static {  
  2.     System.loadLibrary("cocos2dx");  
  3. }  

銆銆(2)鍦?#37832;?#37734;?#28000;?#37934;佷腑瀹炵幇JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved);鏂规硶銆?/p>

銆銆(3)鍦?#29831;NI_OnLoad鏂规硶涓?#38171;岃皟?#25956;env->RegisterNatives(jclass clazz, const JNINativeMethod *methods, jint nMethods)娉?#37712;?#37813;鏈?#37832;?#37734;扮殑瀹炵幇鏂规硶銆?#37818;?#38013;愬皢鏂规硶澹?#37828;?#28051;?#38344;欐佺殑锛?#26473;?#37837;?#28051;嶄細鍗犳嵁璁?#28598;?#28051;婄殑绗?#37721;?#29723;ㄧ殑绌?#38338;?#37510;?/p>

銆銆JNI閫氫俊

銆銆JNI?#27537;閫氫俊杩囩▼锛屽叾瀹?#28751;辨槸鍘?#37922;烰ava涓?#25652;?#28766;侰/C++?#26271;鎹?#28028;?#38315;掔殑杩囩▼銆?#26473;?#38322;?#32480;鍗曞綊绾?#28051;?#38171;屾暟鎹?#28028;?#38315;掑垎涓?#28000;?#28051;?#26473;?#37713;犵锛?/p>

銆銆• 浼?#38315;?#37737;?#37832;暟鎹?#32491;诲瀷(渚嬪锛歩nt锛宖loat绛?

銆銆• 浼?#38315;?#28725;硅薄(渚嬪锛歋tring锛孫bject锛岃嚜瀹?#28052;?#32491;籑yObject绛?

銆銆• 浼?#38315;掓暟缁?渚嬪锛歩nt[]锛?String[]绛?

銆銆• 浼?#38315;?#38342;?#37722;?#28725;硅薄(渚嬪锛欰rrayList锛孒ashMap绛?

銆銆鑰岃皟?#25956;鏂?#23534;?#37832;?#37721;?#28000;ュ垎涓?#38171;?/p>

銆銆(1)java?#30367;?#25956;native鏂规硶

銆銆(2)native?#30367;?#25956;java闈欐?#37826;规硶锛?#38344;?#38344;欐?#37826;规硶(鎴愬憳鏂规硶)锛?#28000;?#37721;?#38014;?#37721;杍ava绫荤殑鎴愬憳鍙?#38322;?#37510;?/p>

銆銆涓?#38344;?#37816;夌収瀹炵幇鏂?#23534;忕殑涓嶅悓缁?#37722;堜互涓?#29781;?#37904;?#38171;岄?#26473;?#28051;涓?#28186;?#28699;?#28000;g爜鏉?#29831;?#37828;?#28051;?#37711;?#28003;撴槸濡?#28003;?#28729;炵幇?#27537;銆?/p>

銆銆(1)闈欐佹敞鍐岀殑鏂?#23534;?/p>

銆銆宸?#32459;?#32513;?#37835;?#28641;?#28051;?#38171;?杩?#38322;?#37721;?#37714;?#28051;?#37713;?#28051;?#29781;佽鏄庣殑椤?

XML/HTML浠g爜
  1. JNISample1    
  2.   鈹?#37433;鈹 build.gradle  
  3.   鈹?#37433;鈹 CMakeLists.txt   
  4.   鈹?#37433;鈹 app   
  5.       鈹?#37433;鈹 build.gradle  
  6.       鈹?#37433;鈹 CMakeLists.txt  
  7.       鈹?#37433;鈹 src   
  8.           鈹?#37433;鈹 cpp  
  9.           鈹?nbsp;   鈹?#37433;鈹 JNIUtils.h  
  10.           鈹?nbsp;   鈹?#37433;鈹 JNIUtils.cpp  
  11.           鈹?#37433;鈹 com.alphagl.main  
  12.                     鈹?#37433;鈹 JNIUtils.java  
  13.                     鈹?#37433;鈹 MainActivity.Java  
  14.                     鈹?#37433;鈹 Person.java  

銆銆浠g爜濡?#28051;?#38171;?杩?#38322;屽?#27691;簡涓?#32480;鍖?#38171;屽幓鎺変?#28057;敞閲?#28000;?#37721;?#37719;?#37711;?#23092;嬭瘯閮?#37714;嗙殑浠g爜)

銆銆MainActivity.java锛?/strong>

Java浠g爜
  1. package com.alphagl.main;  
  2.   
  3. import android.app.Activity;  
  4. import android.os.Bundle;  
  5. import android.util.Log;  
  6.   
  7. public class MainActivity extends Activity {  
  8.   
  9.     static {  
  10.         System.loadLibrary("native-lib");  
  11.     }  
  12.   
  13.     protected void onCreate(Bundle savedInstanceState) {  
  14.         super.onCreate(savedInstanceState);  
  15.         setContentView(R.layout.activity_main);  
  16.   
  17.         Log.i("MainActivity""getStringFromJNI ============= " + JNIUtils.getStringFromJNI());  
  18.         Log.i("MainActivity""getIntArrayFromJNI ============= " + JNIUtils.getIntArrayFromJNI()[0] + "," + JNIUtils.getIntArrayFromJNI()[1]);  
  19.         JNIUtils.setPersonToJNI(new Person(18"jobs"));  
  20.         Log.i("MainActivity""getPersonFromJNI ============= " + JNIUtils.getPersonFromJNI().getAge()+ "," + JNIUtils.getPersonFromJNI().getName());  
  21.     }  
  22. }  

銆銆Person.java锛?灏佽?#21615;殑?#22172;瀹?#28052;?#28725;硅薄)

Java浠g爜
  1. package com.alphagl.main;  
  2.   
  3. import android.util.Log;  
  4.   
  5. public class Person {  
  6.     private int age;  
  7.     private String name;  
  8.   
  9.     public Person(int age, String name) {  
  10.         this.age = age;  
  11.         this.name = name;  
  12.     }  
  13.   
  14.     public void setAge(int age) {  
  15.         this.age = age;  
  16.     }  
  17.   
  18.     public int getAge() {  
  19.         return age;  
  20.     }  
  21.   
  22.     public void setName(String name) {  
  23.         this.name = name;  
  24.     }  
  25.   
  26.     public String getName() {  
  27.         return name;  
  28.     }  
  29.   
  30.     public void printPerson() {  
  31.         Log.d("MainActivity""age ======== " + age + "," + "name ======== " + name);  
  32.     }  
  33. }  

銆銆JNIUtils.java锛?/strong>

Java浠g爜
  1. package com.alphagl.main;  
  2.   
  3. public class JNIUtils {  
  4.     public static native String getStringFromJNI();  
  5.     public static native int[] getIntArrayFromJNI();  
  6.     public static native void setPersonToJNI(Person person);  
  7.     public static native Person getPersonFromJNI();  
  8. }  

銆銆JNIUtils.h锛?/strong>

C++浠g爜
  1. #include <jni.h>  
  2. #include <stdio.h>  
  3.   
  4. #ifndef _Included_com_alphagl_main_JNIUtils  
  5. #define _Included_com_alphagl_main_JNIUtils  
  6. #ifdef __cplusplus  
  7. extern "C" {  
  8. #endif  
  9.   
  10. JNIEXPORT jstring JNICALL Java_com_alphagl_main_JNIUtils_getStringFromJNI  
  11.   (JNIEnv *, jclass);  
  12.   
  13.   
  14. JNIEXPORT jintArray JNICALL Java_com_alphagl_main_JNIUtils_getIntArrayFromJNI  
  15.   (JNIEnv *, jclass);  
  16.   
  17.   
  18. JNIEXPORT void JNICALL Java_com_alphagl_main_JNIUtils_setPersonToJNI  
  19.   (JNIEnv *, jclass, jobject);  
  20.   
  21.   
  22. JNIEXPORT jobject JNICALL Java_com_alphagl_main_JNIUtils_getPersonFromJNI  
  23.   (JNIEnv *, jclass);  
  24.   
  25. #ifdef __cplusplus  
  26. }  
  27. #endif  
  28. #endif  

銆銆JNIUtils.cpp

C++浠g爜
  1. #include "JNIUtils.h"  
  2. #include <android/log.h>  
  3.   
  4. #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "MainActivity", __VA_ARGS__)  
  5. #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "MainActivity", __VA_ARGS__)  
  6. #define LOGE(...) __android_log_print(ANDROID_LOG_ERROE, "MainActivity", __VA_ARGS__)  
  7.   
  8.   
  9. JNIEXPORT jstring JNICALL Java_com_alphagl_main_JNIUtils_getStringFromJNI (JNIEnv *env, jclass jcls) {  
  10.     LOGD(" ====================== getStringFromJNI");  
  11.     // 鏋?#38315;?#28051;涓猄tring瀛?#32471;?#28051;?/span>  
  12.     return env->NewStringUTF("Hello from jni");  
  13. }  
  14.   
  15.   
  16. JNIEXPORT jintArray JNICALL Java_com_alphagl_main_JNIUtils_getIntArrayFromJNI (JNIEnv *env, jclass jcls) {  
  17.     LOGD(" ====================== getIntArrayFromJNI");  
  18.     // 鏋?#38315;?#28051;涓猧nt[]?#26271;缁?/span>  
  19.     jintArray intArray = env->NewIntArray(2);  
  20.     int size[]={640, 960};  
  21.     // 缁檌nt[]?#26271;缁勮?#23338;?/span>  
  22.     env->SetIntArrayRegion(intArray, 0, 2, size);  
  23.   
  24.     return intArray;  
  25. }  
  26.   
  27.   
  28. JNIEXPORT void JNICALL Java_com_alphagl_main_JNIUtils_setPersonToJNI (JNIEnv *env, jclass jcls, jobject jobj) {  
  29.     LOGD(" ====================== setPersonToJNI");  
  30.     jclass jperson = env->GetObjectClass(jobj);  
  31.     if (jperson != NULL) {  
  32.         // 鑾?#37721;朠erson瀵硅薄?#27537;age瀛楁id  
  33.         jfieldID ageFieldId = env->GetFieldID(jperson, "age""I");  
  34.         // 鑾?#37721;朠erson瀵硅薄?#27537;name瀛楁id  
  35.         jfieldID nameFieldId = env->GetFieldID(jperson, "name""Ljava/lang/String;");  
  36.   
  37.         // 鑾?#37721;朠erson?#27537;age鎴愬憳鍙?#38322;?/span>  
  38.         jint age = env->GetIntField(jobj, ageFieldId);  
  39.         // 鑾?#37721;朠erson?#27537;name鎴愬憳鍙?#38322;?/span>  
  40.         jstring name = (jstring)env->GetObjectField(jobj, nameFieldId);  
  41.   
  42.         const char *c_name = env->GetStringUTFChars(name, NULL);  
  43.   
  44.         // 鎵?#37719;?#28000;嶫ava浼?#38315;?#26473;?#37833;ョ殑Person瀵硅薄?#27537;age鍜宯ame鍙?#38322;?/span>  
  45.         LOGD("age ===== %d, name ===== %s", age, c_name);  
  46.     }  
  47.   
  48.     // 浠?#28051;嬫槸浠嶫NI鏋?#38315;燡ava瀵硅薄锛屽苟?#30367;?#25956;Java绫?#28051;殑鎴愬憳鏂规硶锛?#28000;呯敤浣?#23125;旂ず  
  49.     // 鑾?#37721;朠erson瀵硅薄?#27537;class  
  50.     jclass jstu = env->FindClass("com/alphagl/main/Person");  
  51.     // 鑾?#37721;朠erson瀵硅薄?#27537;鏋?#38315;犳柟?#30838;?#27537;鏂规硶id  
  52.     jmethodID personMethodId = env->GetMethodID(jperson, "<init>""(ILjava/lang/String;)V");  
  53.     // 鏋?#38315;?#28051;涓猄tring瀛?#32471;?#28051;?/span>  
  54.     jstring name = env->NewStringUTF("bill");  
  55.   
  56.     // 鏋?#38315;?#28051;涓狿erson瀵硅薄  
  57.     jobject  jPersonObj = env->NewObject(jstu, personMethodId, 30, name);  
  58.     // 鑾?#37721;朠erson瀵硅薄?#27537;printPerson鎴愬憳鏂规硶?#27537;鏂规硶id  
  59.     jmethodID jid = env->GetMethodID(jstu, "printPerson""()V");  
  60.     // ?#30367;?#25956;java?#27537;printPerson鏂规硶  
  61.     env->CallVoidMethod(jPersonObj, jid);  
  62. }  
  63.   
  64.   
  65. JNIEXPORT jobject JNICALL Java_com_alphagl_main_JNIUtils_getPersonFromJNI(JNIEnv *env, jclass jcls) {  
  66.     LOGD(" ====================== getPersonFromJNI");  
  67.     // 鑾?#37721;朠erson瀵硅薄?#27537;class  
  68.     jclass jstudent = env->FindClass("com/alphagl/main/Person");  
  69.     // 鑾?#37721;朠erson瀵硅薄?#27537;鏋?#38315;犳柟?#30838;?#27537;鏂规硶id  
  70.     jmethodID studentMethodId = env->GetMethodID(jstudent, "<init>""(ILjava/lang/String;)V");  
  71.     // 鏋?#38315;?#28051;涓猄tring瀛?#32471;?#28051;?/span>  
  72.     jstring name = env->NewStringUTF("john");  
  73.     // 鏋?#38315;?#28051;涓狿erson瀵硅薄  
  74.     jobject  jstudentObj = env->NewObject(jstudent, studentMethodId, 20, name);  
  75.   
  76.     return jstudentObj;  
  77. }  

銆銆杩?#38322;屽啀鎻?#28051;涓?#38171;屽涓?#38173;JNIUtils.java锝绫?#28051;?#28729;?#28052;夊ソ浜唍ative鏂规硶锛屽浣?#37837;?#37817;?#28725;硅薄?#27537;鏂规硶绛?#37722;嶇敓鎴愬搴旂殑C/C++鏂规硶?#27537;澹?#37828;?#37510;?#26473;?#38318;?#37714;嗗唴瀹?#37734;ˋndroid?#29238;鎴?#23534;鍙?#28729;?#29882;?1)涔婲DK涓嶫NI寮鍙?1 宸?#32513;忔?#24876;埌杩?#38171;?#37812;戜滑鍙?#28000;?#37706;?#37716;﹋avah鏉?#37837;?#37817;?#32514;?#29831;?#37722;庣殑.class鐢?#37812;愬?#36891;?#24227;殑澶?#37826;?#28000;?#37510;?/p>

銆銆鏅?#38315;氬?#27693;硶?#27128;锛?/p>

Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?4

銆銆鍦ˋndroidStudio涓?#37721;?#28000;?#38171;?/p>

銆銆Tools锛?gt; External Tools -> 娣?#37716;?/p>

Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?4

銆銆(1)javah鎵鍦ㄧ殑璺?#23536;?/p>

銆銆(2)鍛?#28000;?#29723;?#37721;傛暟

銆銆(3)澶?#37826;?#28000;?#37922;?#37812;愮殑璺?#23536;?/p>

Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?4

銆銆鍦?#28601;?#37828;?#27996;唍ative鏂规硶?#27537;绫?#38171;?#37721;?#38335;?#37813;?#29723;宩avah鍗?#37721;?#37510;?/p>

銆銆(2)鍔?#37804;佹敞鍐岀殑鏂?#23534;?/p>

銆銆宸?#32459;?#32513;?#37835;?#28641;?#28051;?#38171;?杩?#38322;?#37721;?#37714;?#28051;?#37713;?#28051;?#29781;佽鏄庣殑椤?

XML/HTML浠g爜
  1. JNISample2    
  2.   鈹?#37433;鈹 build.gradle  
  3.   鈹?#37433;鈹 CMakeLists.txt   
  4.   鈹?#37433;鈹 app   
  5.       鈹?#37433;鈹 build.gradle  
  6.       鈹?#37433;鈹 CMakeLists.txt  
  7.       鈹?#37433;鈹 src   
  8.           鈹?#37433;鈹 cpp  
  9.           鈹?nbsp;  鈹?#37433;鈹 JNIUtils.cpp  
  10.           鈹?nbsp;     
  11.           鈹?#37433;鈹 com.alphagl.main  
  12.                     鈹?#37433;鈹 JNIUtils.java  
  13.                     鈹?#37433;鈹 MainActivity.Java  
  14.                     鈹?#37433;鈹 Person.java  

銆銆杩?#38322;?#28051;?#29781;?#37930;?#28051;?#28051;嶅?#23680;殑浠g爜閮ㄥ垎锛?#37719;矹NIUtils.cpp銆?/p>

銆銆JNIUtils.cpp锛?/strong>

C++浠g爜
  1. #include <jni.h>  
  2. #include <string>  
  3. #include <android/log.h>  
  4.   
  5. #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, "MainActivity", __VA_ARGS__)  
  6. #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, "MainActivity", __VA_ARGS__)  
  7. #define LOGE(...) __android_log_print(ANDROID_LOG_ERROE, "MainActivity", __VA_ARGS__)  
  8.   
  9. #define CLASSNAME "com/alphagl/main/JNIUtils"  
  10.   
  11. static jstring getStringFromJNI_native(JNIEnv *env, jclass jcls) {  
  12.     LOGD(" ====================== getStringFromJNI");  
  13.     // 鏋?#38315;?#28051;涓猄tring瀛?#32471;?#28051;?/span>  
  14.     return env->NewStringUTF("Hello from jni");  
  15. }  
  16.   
  17. static jarray getIntArrayFromJNI_native(JNIEnv *env, jclass jcls) {  
  18.     LOGD(" ====================== getIntArrayFromJNI");  
  19.     // 鏋?#38315;?#28051;涓猧nt[]?#26271;缁?/span>  
  20.     jintArray intArray = env->NewIntArray(2);  
  21.     int size[]={640, 960};  
  22.     // 缁檌nt[]?#26271;缁勮?#23338;?/span>  
  23.     env->SetIntArrayRegion(intArray, 0, 2, size);  
  24.   
  25.     return intArray;  
  26. }  
  27.   
  28. static void setJniPerson_native(JNIEnv *env, jclass jcls, jobject jobj) {  
  29.     LOGD(" ====================== setPersonToJNI");  
  30.     jclass jperson = env->GetObjectClass(jobj);  
  31.     if (jperson != NULL) {  
  32.         // 鑾?#37721;朠erson瀵硅薄?#27537;age瀛楁id  
  33.         jfieldID ageFieldId = env->GetFieldID(jperson, "age""I");  
  34.         // 鑾?#37721;朠erson瀵硅薄?#27537;name瀛楁id  
  35.         jfieldID nameFieldId = env->GetFieldID(jperson, "name""Ljava/lang/String;");  
  36.   
  37.         // 鑾?#37721;朠erson?#27537;age鎴愬憳鍙?#38322;?/span>  
  38.         jint age = env->GetIntField(jobj, ageFieldId);  
  39.         // 鑾?#37721;朠erson?#27537;name鎴愬憳鍙?#38322;?/span>  
  40.         jstring name = (jstring)env->GetObjectField(jobj, nameFieldId);  
  41.   
  42.         const char *c_name = env->GetStringUTFChars(name, NULL);  
  43.   
  44.         // 鎵?#37719;?#28000;嶫ava浼?#38315;?#26473;?#37833;ョ殑Person瀵硅薄?#27537;age鍜宯ame鍙?#38322;?/span>  
  45.         LOGD("age ===== %d, name ===== %s", age, c_name);  
  46.     }  
  47.   
  48.     // 浠?#28051;嬫槸浠嶫NI鏋?#38315;燡ava瀵硅薄锛屽苟?#30367;?#25956;Java绫?#28051;殑鎴愬憳鏂规硶锛?#28000;呯敤浣?#23125;旂ず  
  49.     // 鑾?#37721;朠erson瀵硅薄?#27537;class  
  50.     jclass jstu = env->FindClass("com/alphagl/main/Person");  
  51.     // 鑾?#37721;朠erson瀵硅薄?#27537;鏋?#38315;犳柟?#30838;?#27537;鏂规硶id  
  52.     jmethodID personMethodId = env->GetMethodID(jperson, "<init>""(ILjava/lang/String;)V");  
  53.     // 鏋?#38315;?#28051;涓猄tring瀛?#32471;?#28051;?/span>  
  54.     jstring name = env->NewStringUTF("bill");  
  55.   
  56.     // 鏋?#38315;?#28051;涓狿erson瀵硅薄  
  57.     jobject  jPersonObj = env->NewObject(jstu, personMethodId, 30, name);  
  58.     // 鑾?#37721;朠erson瀵硅薄?#27537;printPerson鎴愬憳鏂规硶?#27537;鏂规硶id  
  59.     jmethodID jid = env->GetMethodID(jstu, "printPerson""()V");  
  60.     // ?#30367;?#25956;java?#27537;printPerson鏂规硶  
  61.     env->CallVoidMethod(jPersonObj, jid);  
  62. }  
  63.   
  64. static jobject getJniPerson_native(JNIEnv *env, jclass jcls) {  
  65.     LOGD(" ====================== getPersonFromJNI");  
  66.     // 鑾?#37721;朠erson瀵硅薄?#27537;class  
  67.     jclass jstudent = env->FindClass("com/alphagl/main/Person");  
  68.     // 鑾?#37721;朠erson瀵硅薄?#27537;鏋?#38315;犳柟?#30838;?#27537;鏂规硶id  
  69.     jmethodID studentMethodId = env->GetMethodID(jstudent, "<init>""(ILjava/lang/String;)V");  
  70.     // 鏋?#38315;?#28051;涓猄tring瀛?#32471;?#28051;?/span>  
  71.     jstring name = env->NewStringUTF("john");  
  72.     // 鏋?#38315;?#28051;涓狿erson瀵硅薄  
  73.     jobject  jstudentObj = env->NewObject(jstudent, studentMethodId, 20, name);  
  74.   
  75.     return jstudentObj;  
  76. }  
  77.   
  78. static JNINativeMethod gMethods[] = {  
  79.         {"getStringFromJNI""()Ljava/lang/String;", (void*)getStringFromJNI_native},  
  80.         {"getIntArrayFromJNI""()[I", (void*)getIntArrayFromJNI_native},  
  81.         {"setPersonToJNI""(Lcom/alphagl/main/Person;)V", (void*)setJniPerson_native},  
  82.         {"getPersonFromJNI""()Lcom/alphagl/main/Person;", (void*)getJniPerson_native}  
  83. };  
  84.   
  85. static jint registerNativeMethods(JNIEnv *env, const char* className, JNINativeMethod *gMethods, int numMethods) {  
  86.     jclass jcls;  
  87.     jcls = env->FindClass(className);  
  88.     if (jcls == NULL) {  
  89.         return JNI_FALSE;  
  90.     }  
  91.   
  92.     if (env->RegisterNatives(jcls, gMethods, numMethods) < 0) {  
  93.         return JNI_FALSE;  
  94.     }  
  95.   
  96.     return JNI_TRUE;  
  97. }  
  98.   
  99. static jint registerNative(JNIEnv *env) {  
  100.     return registerNativeMethods(env, CLASSNAME, gMethods, sizeof(gMethods) / sizeof(gMethods[0]));  
  101. }  
  102.   
  103. JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {  
  104.     JNIEnv *env = NULL;  
  105.     if ((vm->GetEnv((void**)&env, JNI_VERSION_1_6)) != JNI_OK) {  
  106.         return JNI_ERR;  
  107.     }  
  108.   
  109.     if (!registerNative(env)) {  
  110.         return JNI_ERR;  
  111.     }  
  112.   
  113.     return JNI_VERSION_1_6;  
  114. }  

銆銆鏈鍚庣殑鎵?#29723;?#32513;?#37835;?#28051;?#38171;?/p>

Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?4

銆銆涓?#32457;?#28729;炵幇鏂?#23534;忔瘮杈?#38171;?/p>

銆銆(1)鍔?#37804;佹敞鍐?#28051;?#38171;?#37721;?#28000;?#28051;嶇敤澹?#37828;庡舰濡侸ava_packageName_className_methodName鏍?#23534;忕殑鏂规硶銆?/p>

銆銆(2)鍔?#37804;佹敞鍐?#28051;?#38171;岃閲嶅啓JNI_OnLoad鏂规硶锛?#37813;?#37716;ㄨ皟?#25956;RegisterNatives鏉?#23049;?#37712;?#37832;?#37734;?#37826;规硶锛?#28000;?#37721;婂0鏄?#37734;↗NINativeMethod涓?#37510;?/p>

銆銆(3)鍔?#37804;佹敞鍐?#38171;屾槑鏄?#26473;欑鏂?#23534;忔洿?#20242;娲?#38171;?#28003;?#28725;?#28000;g爜瑕佹?#20635;洿楂?#38171;屾帹?#23832;浣跨敤杩欑鏂?#23534;?#37510;?/p>

銆銆浠?#28051;婄ず渚?#28000;g爜閮?#23480;?#28051;?#28028;燝ithub锛?#37832;?#38343;瑕佺殑鍙?#28000;ヨ嚜琛屾煡鐪?#37510;?/p>

銆銆https://github.com/cnsuperx/android-jni-example

銆銆JNI?#30367;?#30255;

銆銆濡?#37835;?#28729;夎浜哃LVM?#24134;澧冪殑?#30269;锛岀洿?#24116;灏咼ni Debuggable閫夐」鎵?#23534;鍗?#37721;?#37510;傜幆澧冩惌寤?#37721;?#28000;?#37721;?#38000;傾ndroid?#29238;鎴?#23534;鍙?#28729;?#29882;?1)涔婲DK涓嶫NI寮鍙?3銆?/p>

Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?4

銆銆?#24116;?#28483;?#27967;?#24116;鍦–鎴朇锛?#38171;?#28000;?#37934;佷腑璁剧疆鏂?#37904;?#37719;?#37721;?#37510;?/p>]]>Android?#29238;鎴?#23534;鍙?/category>http://www.ojizl5.fun/android/game/713.html#commenthttp://www.ojizl5.fun/android/http://www.ojizl5.fun/android/feed.asp?cmt=713http://www.ojizl5.fun/android/cmd.asp?act=tb&id=713&key=cb9760bfAndroid鍚?#37716;ㄧ瘒 鈥?init鍘熺悊锛堜簩锛?/title><author>a@b.com (楦″晞绫?</author><link>http://www.ojizl5.fun/android/course/712.html</link><pubDate>Mon, 11 Sep 2017 08:54:39 +0800</pubDate><guid>http://www.ojizl5.fun/android/course/712.html</guid><description><![CDATA[<p>銆銆<a href="http://www.ojizl5.fun/android/course/707.html" target="_blank">Android鍚?#37716;ㄧ瘒 — init鍘熺悊锛堜竴锛?/a>涓?#29825;茶В?#22414;init杩?#32459;嬪垎鏋恑nit鍒涘?#34425;郴缁?#37929;?#35120;?#39582;?#37816;?#37734;?#37929;?#25652;旂郴缁?#37826;?#28000;?#37510;佸?#28614;?#23338;寲灞?#37804;?#37737;?#37510;?#29825;剧疆?#37108;缁?#28766;?#37804;?#37510;佸惎鍔?#38320;嶇疆灞?#37804;?#37832;?#37716;?#32468;?#32475;?#28051;绯诲垪澶?#37833;?#23480;?#28003;?#38171;屽緢澶?#23480;?#28003;?#37724;岀煡?#30225;鐐硅窡Linux鍏?#32495;诲緢澶?#38171;?#37813;浠ユ病鏈?#28003;?#26473;?#28598;?#28000;?#32513;?#38171;?#38000;?#37832;?#23005;?#28725;逛簬init.rc?#27537;瑙?#37835;愬?#27408;槸閲?#28051;?#28052;?#38322;?#38171;?#37813;浠?#37719;曠嫭鎷?#37713;?#37833;?#26473;涜?#23683;缁嗗垎鏋?#37510;?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">int</span><span> main(</span><span class="keyword">int</span><span> argc, </span><span class="keyword">char</span><span>** argv) {  </span></span></li> <li><span>    <span class="comment">/* 01. 鍒涘缓鏂?#28000;剁郴缁?#37929;?#35120;?#39582;?#37816;傝浇鐩?#37711;崇殑鏂?#28000;剁郴缁?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 02. 灞忚斀鏍囧?#21977;殑?#32237;鍏?#26440;撳嚭/鍒濆?#23338;?#26663;唴鏍竘og?#37108;缁?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 03. 鍒濆?#23338;寲灞?#37804;?#37737;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 04. 瀹?#37812;怱ELinux鐩?#37711;?#23480;?#28003;?nbsp;*/</span><span>•  </span></span></li> <li><span>    <span class="comment">/* 05. 閲?#37826;?#29825;剧疆灞?#37804;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 06. 鍒涘缓epoll鍙?#37836;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 07. 瑁?#26462;?#28699;?#26473;?#32459;嬩俊鍙?#28598;勭悊鍣?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 08. 璁剧疆榛?#29825;ょ郴缁?#28766;?#37804;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 09. 鍚?#37716;?#38320;嶇疆灞?#37804;х殑鏈?#37716;?#32468;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 10. 鍖归?#23941;懡浠?#37724;屽?#33445;暟涔嬮?#23544;殑瀵?#25652;?#37711;崇郴 */</span><span>  </span></span></li> <li><span>-------------------------------------------------------------------------------------------   <span class="comment">// Android鍚?#37716;ㄧ瘒 — init鍘熺悊锛堜竴锛?#28051;?#29825;茶В</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 11. 瑙?#37835;恑nit.rc */</span><span>  </span></span></li> <li><span>    Parser& parser = Parser::GetInstance();       <span class="comment">// 鏋?#38315;?#29785;?#37835;?#37826;?#28000;剁敤?#27537;parser瀵硅薄</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">// 澧?#37716;燬erviceParser涓?#28051;涓猻ection锛?#28725;?#25652;攏ame涓簊ervice</span><span>  </span></span></li> <li><span>    parser.AddSectionParser(<span class="string">"service"</span><span>,std::make_unique<ServiceParser>());  </span></span></li> <li class="alt"><span>    <span class="comment">// 澧?#37716;燗ctionParser涓?#28051;涓猻ection锛?#28725;?#25652;攏ame涓篴ction</span><span>  </span></span></li> <li><span>    parser.AddSectionParser(<span class="string">"on"</span><span>, std::make_unique<ActionParser>());  </span></span></li> <li class="alt"><span>    <span class="comment">// 澧?#37716;營mportParser涓?#28051;涓猻ection锛?#28725;?#25652;攏ame涓簊ervice</span><span>  </span></span></li> <li><span>    parser.AddSectionParser(<span class="string">"import"</span><span>, std::make_unique<ImportParser>());  </span></span></li> <li class="alt"><span>    parser.ParseConfig(<span class="string">"/init.rc"</span><span>);      </span><span class="comment">// 寮濮嬪疄闄呯殑瑙?#37835;?#26473;囩▼</span><span>  </span></span></li></ol></div><p>銆銆<span style="font-size: medium;"><strong>銆?#23005;?#37826;?#37510;?/strong></span></p><p>銆銆init.rc?#27128;涓涓?#38320;嶇疆鏂?#28000;?#38171;屽唴閮?#37922;盇ndroid鍒濆?#23338;寲璇?#29815;缂栧啓锛圓ndroid Init Language锛?#32514;栧啓?#27537;鑴?#37832;?#38171;?#28051;?#29781;佸寘鍚?#27996;旂绫诲瀷璇?#37721;?#38171;欰ction銆丆ommand銆丼ervice銆丱ption鍜孖mport锛?#37734;ㄥ垎鏋?#28000;g爜?#27537;杩囩▼涓?#37812;戜滑?#32048;璇?#32513;?#28000;?#32513;?#37510;?/p><p>銆銆init.rc?#27537;閰嶇疆浠g爜鍦?#38171;歴ystem/core/rootdir/init.rc 涓?/p><p>銆銆init.rc鏂?#28000;舵槸鍦╥nit杩?#32459;嬪惎鍔?#37722;?#37813;?#29723;岀殑鍚?#37716;?#38004;?#37832;?#38171;?#37826;?#28000;?#28051;?#29825;板綍?#28483;init杩?#32459;?#38343;鎵?#29723;岀殑?#25655;浣?#37510;?/p><p>銆銆init.rc鏂?#28000;?#28598;?#38007;村垎涓?#28051;?#28598;?#38318;ㄥ垎锛?#28051;閮ㄥ垎?#27128;浠?ldquo;on”鍏?#38335;?#28699;?#23534;澶寸殑鍔?#28003;?#37714;?#29723;?#38171;坅ction list锛?#38171;?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>on early-init      // Action绫诲瀷璇?#37721;?nbsp; </span></span></li> <li><span>    # Set init and its forked children's oom_adj.     // #锛氭敞閲?#32471;?#37721;?nbsp; </span></li> <li class="alt"><span>    write /proc/1/oom_score_adj -1000  </span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>    start ueventd  </span></li></ol></div><p>銆銆Action绫诲瀷璇?#37721;?#37837;?#23534;?#38171;?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>on </span><span class="tag"><</span><span class="tag-name">trigger</span><span class="tag">></span><span> [&& </span><span class="tag"><</span><span class="tag-name">trigger</span><span class="tag">></span><span>]*     // 璁剧疆瑙?#37721;戝櫒    </span></span></li> <li><span>   <span class="tag"><</span><span class="tag-name">command</span><span class="tag">></span><span>    </span></span></li> <li class="alt"><span>   <span class="tag"><</span><span class="tag-name">command</span><span class="tag">></span><span>      // 鍔?#28003;?#29785;?#37721;?#28052;嬪悗瑕?#37813;?#29723;岀殑鍛?#28000;?nbsp; </span></span></li></ol></div><p>銆銆鍙?#28051;閮ㄥ垎?#27128;浠?ldquo;service”鍏?#38335;?#28699;?#23534;澶寸殑鏈?#37716;?#37714;?#29723;?#38171;坰ervice list锛?#38171;? 濡?Zygote</p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>service ueventd /sbin/ueventd  </span></span></li> <li><span>    class core  </span></li> <li class="alt"><span>    critical  </span></li> <li><span>    seclabel u:r:ueventd:s0  </span></li></ol></div><p>銆銆Service绫诲瀷璇?#37721;?#37837;?#23534;?#38171;?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>service </span><span class="tag"><</span><span class="tag-name">name</span><span class="tag">></span><span> </span><span class="tag"><</span><span class="tag-name">pathname</span><span class="tag">></span><span> [ </span><span class="tag"><</span><span class="tag-name">argument</span><span class="tag">></span><span> ]*   // </span><span class="tag"><</span><span class="tag-name">service</span><span>?#27537;鍚?#28699;?/span><span class="tag">></span><span class="tag"><</span><span>鎵?#29723;?#32459;嬪簭璺?#23536;?/span><span class="tag">></span><span class="tag"><</span><span>浼?#38315;?#37721;傛暟</span><span class="tag">></span><span>    </span></span></li> <li><span>   <span class="tag"><</span><span class="tag-name">option</span><span class="tag">></span><span>       // option?#27128;service?#27537;淇?#26967;?#29831;?#38171;屽奖鍝?#28000;涔堟?#36346;?#37510;?#28641;?#28003;?#37722;?#37716;╯ervices    </span></span></li> <li class="alt"><span>   <span class="tag"><</span><span class="tag-name">option</span><span class="tag">></span><span>    </span></span></li> <li><span>   ...  </span></li></ol></div><p>銆銆鍊?#37716;╃郴缁熺幆澧?#37721;?#38322;?#37812;朙inux鍛?#28000;?#38171;?#37716;?#28003;?#37714;?#29723;ㄧ敤浜?#37714;涘缓鎵闇鐩?#35120;?#38171;?#28000;?#37721;?#28051;烘煇浜?#37911;?#28729;?#37826;?#28000;舵寚瀹氭潈闄?#38171;?#38000;?#37832;?#37716;?#37714;?#29723;ㄧ敤鏉?#29825;板綍init杩?#32459;?#38343;瑕佸惎鍔ㄧ殑涓浜?#28699;?#26473;?#32459;?#37510;?#28641;?#28051;?#38344;?#28000;g爜鎵绀?#38171;宻ervice鍏?#38335;?#28699;?#37722;庣殑绗?#28051;涓?#28699;?#32471;?#28051;茶〃绀?#37832;?#37716;?#38171;?#28699;?#26473;?#32459;?#38171;夌殑鍚嶇О锛?#32471;簩涓?#28699;?#32471;?#28051;茶〃绀?#37832;?#37716;$殑鎵?#29723;岃矾寰?#37510;?/p><p>銆銆鍊?#23536;?#28051;鎻愮殑?#27128;鍦ˋndroid 7.0涓?#28725;筰nit.rc鏂?#28000;?#26473;涜浜?#37815;嗗垎锛屾瘡涓?#37832;?#37716;?#28051;涓猺c鏂?#28000;?#37510;?#37812;戜滑瑕佸垎鏋愮殑zygote鏈?#37716;$殑鍚?#37716;?#38004;?#37832;?#37714;?#37734;╥nit.zygoteXX.rc涓?#28729;?#28052;?#37510;?/p><p>銆銆鍦╥nit.rc?#27537;import娈?#37812;戜滑鐪嬪埌濡?#28051;?#28000;g爜锛?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>import /init.${ro.zygote}.rc     // 鍙?#28000;?#37930;嬪嚭init.rc涓嶅?#23943;洿?#24116;寮?#37711;?#28051;涓?#37733;?#28729;氱殑鏂?#28000;?#38171;?#38000;屾槸鏍?#37817;?#28766;?#37804;o.zygote?#27537;?#21812;瀹?#37833;?#23534;?#37711;?#28051;嶅?#23680;殑鏂?#28000;?nbsp; </span></span></li></ol></div><p>銆銆<strong>璇?#37828;?#38171;?/strong></p><p>銆銆浠巃ndroid5.0寮濮?#38171;宎ndroid寮濮嬫敮鎸?4浣嶇殑缂?#29831;?#38171;寊ygote鏈韩涔?#28751;?#37832;変簡32浣嶅拰64浣嶇殑鍖哄埆锛?#37813;浠?#37734;?#26473;?#38322;岀敤ro.zygote灞?#37804;?#37833;?#37818;у埗鍚?#37716;?#28051;嶅悓鐗堟湰?#27537;zygote杩?#32459;?#37510;?/p><p>銆銆init.rc浣嶄簬/system/core/rootdir涓?#37510;?#37734;?#26473;?#28051;?#29882;?#23536;?#28051;?#26473;樺寘鎷?#37733;?#28051;?#37711;?#27996;巣ygote?#27537;rc鏂?#28000;?#37510;?#37714;嗗埆?#27128;Init.zygote32.rc锛孖nit.zygote32_64.rc锛孖nit.zygote64.rc锛孖nit.zygote64_32.rc锛?#37922;?#32429;?#28000;跺喅瀹氳皟?#25956;鍝?#28051;?#37826;?#28000;?#37510;?/p><p>銆銆杩?#38322;屾嬁32浣?#28598;勭悊鍣?#28051;?#28186;?#38171;宨nit.zygote32.rc?#27537;浠g爜濡?#28051;?#37813;绀?#38171;?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server  </span></span></li> <li><span>    class main         # class?#27128;涓涓猳ption锛屾寚瀹歾ygote鏈?#37716;$殑绫诲瀷涓簃ain  </span></li> <li class="alt"><span>    socket zygote stream 660 root system          # socket鍏?#38335;?#28699;?#29723;?#32448;?#28051;涓猳ption锛屽?#28056;缓涓涓?#37722;?#28051;篸ev/socket/zygote锛?#32491;诲瀷涓簊tream锛屾潈闄?#28051;?60?#27537;socket  </span></li> <li><span>    onrestart write /sys/android_power/request_state wake          # onrestart?#27128;涓涓猳ption锛岃鏄?#37734;▃ygote閲嶅惎鏃?#38343;瑕?#37813;?#29723;岀殑command  </span></li> <li class="alt"><span>    onrestart write /sys/power/state on  </span></li> <li><span>    onrestart restart audioserver  </span></li> <li class="alt"><span>    onrestart restart cameraserver  </span></li> <li><span>    onrestart restart media  </span></li> <li class="alt"><span>    onrestart restart netd  </span></li> <li><span>    writepid /dev/cpuset/foreground/tasks  </span></li></ol></div><p>銆銆“service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server”</p><p>銆銆鍦↖nit.zygote32.rc涓?#38171;屽畾涔変簡涓涓獄ygote鏈?#37716;?#38171;歾ygote锛?#37922;?#37711;?#38335;?#28699;梥ervice鍛?#29831;塱nit杩?#32459;嬪?#28056;缓涓涓?#37722;?#28051;簔ygote?#27537;杩?#32459;?#38171;?#26473;?#28051;?#26473;?#32459;?#29781;?#37813;?#29723;岀殑绋嬪?#24532;槸锛?system/bin/app_process锛?#32513;?#26473;?#28051;?#26473;?#32459;嬪洓涓?#37721;傛暟锛?/p><p>銆銆· -Xzygote锛?#29831;?#37721;傛暟灏?#28003;?#28051;?#38095;?#37815;?#37832;?#37722;?#37716;?#37827;?#37813;闇?#27537;鍙傛暟</p><p>銆銆· /system/bin锛?#28000;?#29723;?#38095;?#37815;?#37832;?#32459;嬪簭鎵鍦?#37929;?#35120;?/p><p>銆銆· --zygote锛氭寚鏄?#28000;ygoteInit.java绫?#28051;殑main鍑芥暟浣?#28051;?#38095;?#37815;?#37832;?#37813;?#29723;屽叆鍙?/p><p>銆銆· --start-system-server锛氬憡璇塟ygote杩?#32459;嬪惎鍔⊿ystemServer杩?#32459;?/p><p>銆銆?#24116;涓嬫潵锛?#37812;戜滑鍥炲埌婧愮爜?#32139;涓?#38171;?#32513;?#32513;垎鏋恗ain鍑芥暟锛?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="comment">/* 11. 瑙?#37835;恑nit.rc */</span><span>  </span></span></li> <li><span>Parser& parser = Parser::GetInstance();       <span class="comment">// 鏋?#38315;?#29785;?#37835;?#37826;?#28000;剁敤?#27537;parser瀵硅薄</span><span>  </span></span></li> <li class="alt"><span><span class="comment">// 澧?#37716;燬erviceParser涓?#28051;涓猻ection锛?#28725;?#25652;攏ame涓簊ervice</span><span>  </span></span></li> <li><span>parser.AddSectionParser(<span class="string">"service"</span><span>,std::make_unique<ServiceParser>());  </span></span></li> <li class="alt"><span><span class="comment">// 澧?#37716;燗ctionParser涓?#28051;涓猻ection锛?#28725;?#25652;攏ame涓篴ction</span><span>  </span></span></li> <li><span>parser.AddSectionParser(<span class="string">"on"</span><span>, std::make_unique<ActionParser>());  </span></span></li> <li class="alt"><span><span class="comment">// 澧?#37716;營mportParser涓?#28051;涓猻ection锛?#28725;?#25652;攏ame涓簊ervice</span><span>  </span></span></li> <li><span>parser.AddSectionParser(<span class="string">"import"</span><span>, std::make_unique<ImportParser>());  </span></span></li> <li class="alt"><span>parser.ParseConfig(<span class="string">"/init.rc"</span><span>);      </span><span class="comment">// 寮濮嬪疄闄呯殑瑙?#37835;?#26473;囩▼</span></span></li></ol></div><p>銆銆<strong>璇?#37828;?#38171;?/strong></p><p>銆銆涓?#38344;?#37734;?#29785;?#37835;恑nit.rc鏂?#28000;舵椂浣跨敤浜哖arser绫?#38171;?#37734;╥nit鐩?#35120;?#28051;嬬殑init_parser.h涓?#28729;?#28052;?#38171;?#38171;?鍒濆?#23338;寲ServiceParser?#25956;鏉?#29785;?#37835;?“service”?#28513;锛孉ctionParser?#25956;鏉?#29785;?#37835;?quot;on"?#28513;锛孖mportParser?#25956;鏉?#29785;?#37835;?ldquo;import”?#28513;锛?ldquo;import”?#27128;?#25956;鏉?#23534;?#37711;?#28051;涓猧nit閰嶇疆鏂?#28000;?#38171;屾潵鎵?#28766;曞綋鍓嶉?#23943;疆?#27537;銆?/p><p>銆銆/system/core/init/readme.txt 涓?#28725;筰nit鏂?#28000;?#28051;殑鎵鏈?#37711;?#38335;?#28699;?#37707;氫簡浠?#32513;?#38171;?#28051;?#29781;佸寘鍚?#27996;咥ctions, Commands, Services, Options, and Imports绛?#38171;?#37721;嚜琛?#28699;︿範瑙?#29831;?#37510;?/p><p>銆銆?#22414;鏋恑nit.rc?#27537;瑙?#37835;?#26473;囩▼锛氬?#33445;暟瀹?#28052;変?#24023;ystem/core/init/ init_parser.cpp涓?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span>bool Parser::ParseConfig(</span><span class="keyword">const</span><span> std::string& path) {  </span></span></li> <li><span>    <span class="keyword">if</span><span> (is_dir(path.c_str())) {           </span><span class="comment">// 鍒?#37826;?#28028;犲叆鍙傛暟?#27128;鍚?#28051;虹洰褰?#37734;板潃</span><span>  </span></span></li> <li class="alt"><span>        <span class="keyword">return</span><span> ParseConfigDir(path);      </span><span class="comment">// 閫?#35120;?#37929;?#35120;?#38171;?#37832;缁?#26473;樻槸闈燩arseConfigFile鏉?#29785;?#37835;愬疄闄呯殑鏂?#28000;?/span><span>  </span></span></li> <li><span>    }  </span></li> <li class="alt"><span>    <span class="keyword">return</span><span> ParseConfigFile(path);         </span><span class="comment">// 浼犲叆浼犺緭涓?#37826;?#28000;?#37734;板潃</span><span>  </span></span></li> <li><span>}  </span></li></ol></div><p>銆銆缁?#32513;垎鏋怭arseConfigFile()锛?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span>bool Parser::ParseConfigFile(</span><span class="keyword">const</span><span> std::string& path) {  </span></span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>    Timer t;  </span></li> <li><span>    std::string data;  </span></li> <li class="alt"><span>    <span class="keyword">if</span><span> (!read_file(path.c_str(), &data)) {       </span><span class="comment">// 璇?#37721;?#29882;?#23536;勬寚瀹?#37826;?#28000;?#28051;殑?#21812;瀹?#38171;屼繚瀛?#28051;?#28699;?#32471;?#28051;?#35120;?#23534;?/span><span>  </span></span></li> <li><span>        <span class="keyword">return</span><span> </span><span class="keyword">false</span><span>;  </span></span></li> <li class="alt"><span>}  </span></li> <li><span>... ...  </span></li> <li class="alt"><span>    ParseData(path, data);        <span class="comment">// 瑙?#37835;?#38014;?#37721;栫殑瀛?#32471;?#28051;?/span><span>  </span></span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>}  </span></li></ol></div><p>銆銆璺熻釜ParseData()锛?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">void</span><span> Parser::ParseData(</span><span class="keyword">const</span><span> std::string& filename, </span><span class="keyword">const</span><span> std::string& data) {  </span></span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>    parse_state state;  </span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>    std::vector<std::string> args;  </span></li> <li><span>  </span></li> <li class="alt"><span>    <span class="keyword">for</span><span> (;;) {  </span></span></li> <li><span>        <span class="keyword">switch</span><span> (next_token(&state)) {    </span><span class="comment">// next_token浠?#29723;?#28051;?#37719;?#28003;嶅垎鍓?#37721;傛暟浼?#38315;?#26473;?#37833;ョ殑瀛?#32471;?#28051;?#38171;?#37832;鍏?#29863;板埌T_TEXT?#22414;鏀?/span><span>  </span></span></li> <li class="alt"><span>        <span class="keyword">case</span><span> T_EOF:  </span></span></li> <li><span>            <span class="keyword">if</span><span> (section_parser) {  </span></span></li> <li class="alt"><span>                section_parser->EndSection();    <span class="comment">// 瑙?#37835;?#32513;?#37833;?/span><span>  </span></span></li> <li><span>            }  </span></li> <li class="alt"><span>            <span class="keyword">return</span><span>;  </span></span></li> <li><span>        <span class="keyword">case</span><span> T_NEWLINE:  </span></span></li> <li class="alt"><span>            state.line++;  </span></li> <li><span>            <span class="keyword">if</span><span> (args.empty()) {  </span></span></li> <li class="alt"><span>                <span class="keyword">break</span><span>;  </span></span></li> <li><span>            }  </span></li> <li class="alt"><span>            <span class="comment">// 鍦?#37715;?#37826;囧?#28056;缓parser鏃?#38171;?#37812;戜滑涓簊ervice锛宱n锛宨mport瀹?#28052;変簡瀵?#25652;旂殑parser </span><span>  </span></span></li> <li><span>            <span class="comment">// 杩?#38322;?#28751;辨槸鏍?#37817;?#32471;?#28051;涓?#37721;傛暟锛屽垽鏂槸鍚?#37832;?#28725;?#25652;旂殑parser</span><span>  </span></span></li> <li class="alt"><span>            <span class="keyword">if</span><span> (section_parsers_.count(args[</span><span class="number">0</span><span>])) {  </span></span></li> <li><span>                <span class="keyword">if</span><span> (section_parser) {  </span></span></li> <li class="alt"><span>                    <span class="comment">// 缁?#37833;?#28051;?#28051;涓猵arser?#27537;宸?#28003;?#38171;?#28751;嗘瀯閫犲?#34425;殑瀵硅薄鍔犲叆?#22476;瀵?#25652;旂殑service_list涓巃ction_list涓?/span><span>  </span></span></li> <li><span>                    section_parser->EndSection();  </span></li> <li class="alt"><span>                }  </span></li> <li><span>                <span class="comment">// 鑾?#37721;?#37721;傛暟瀵?#25652;旂殑parser</span><span>  </span></span></li> <li class="alt"><span>                section_parser = section_parsers_[args[<span class="number">0</span><span>]].get();  </span></span></li> <li><span>                std::string ret_err;  </span></li> <li class="alt"><span>                <span class="comment">// ?#30367;?#25956;瀹?#38340;卲arser?#27537;ParseSection鍑芥暟</span><span>  </span></span></li> <li><span>                <span class="keyword">if</span><span> (!section_parser->ParseSection(args, &ret_err)) {  </span></span></li> <li class="alt"><span>                    parse_error(&state, <span class="string">"%s\n"</span><span>, ret_err.c_str());  </span></span></li> <li><span>                    section_parser = nullptr;  </span></li> <li class="alt"><span>                }  </span></li> <li><span>            } <span class="keyword">else</span><span> </span><span class="keyword">if</span><span> (section_parser) {  </span></span></li> <li class="alt"><span>                std::string ret_err;  </span></li> <li><span>                <span class="comment">// 濡?#37835;?#32471;?#28051;涓?#37721;傛暟涓嶆槸service锛宱n锛宨mport</span><span>  </span></span></li> <li class="alt"><span>                <span class="comment">// 鍒欒皟?#25956;鍓?#28051;涓猵arser?#27537;ParseLineSection鍑芥暟</span><span>  </span></span></li> <li><span>                <span class="comment">// 杩?#38322;?#37929;稿綋浜?#29785;?#37835;?#28051;涓?#37721;傛暟鍧楃殑瀛?#26916;?/span><span>  </span></span></li> <li class="alt"><span>                <span class="keyword">if</span><span> (!section_parser->ParseLineSection(args, state.filename,   </span></span></li> <li><span>                                                             state.line, &ret_err)) {  </span></li> <li class="alt"><span>                    parse_error(&state, <span class="string">"%s\n"</span><span>, ret_err.c_str());  </span></span></li> <li><span>                }  </span></li> <li class="alt"><span>            }  </span></li> <li><span>            args.clear();       <span class="comment">// 娓呯┖鏈?#23046;?#29785;?#37835;愮殑?#26271;鎹?/span><span>  </span></span></li> <li class="alt"><span>            <span class="keyword">break</span><span>;  </span></span></li> <li><span>        <span class="keyword">case</span><span> T_TEXT:  </span></span></li> <li class="alt"><span>            args.emplace_back(state.text);     <span class="comment">//灏?#37832;?#23046;?#29785;?#37835;愮殑?#21812;瀹瑰啓鍏ュ埌args涓?/span><span>  </span></span></li> <li><span>            <span class="keyword">break</span><span>;  </span></span></li> <li class="alt"><span>        }  </span></li> <li><span>    }  </span></li> <li class="alt"><span>}  </span></li></ol></div><p>銆銆鑷?#23005;?#38171;宨nit.rc瑙?#37835;愬畬锛屾帴涓嬫潵init?#32048;鎵?#29723;屽嚑涓?#38322;?#29781;佺殑闃舵锛?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">int</span><span> main(</span><span class="keyword">int</span><span> argc, </span><span class="keyword">char</span><span>** argv) {  </span></span></li> <li><span>    <span class="comment">/* 01. 鍒涘缓鏂?#28000;剁郴缁?#37929;?#35120;?#39582;?#37816;傝浇鐩?#37711;崇殑鏂?#28000;剁郴缁?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 02. 灞忚斀鏍囧?#21977;殑?#32237;鍏?#26440;撳嚭/鍒濆?#23338;?#26663;唴鏍竘og?#37108;缁?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 03. 鍒濆?#23338;寲灞?#37804;?#37737;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 04. 瀹?#37812;怱ELinux鐩?#37711;?#23480;?#28003;?nbsp;*/</span><span>•  </span></span></li> <li><span>    <span class="comment">/* 05. 閲?#37826;?#29825;剧疆灞?#37804;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 06. 鍒涘缓epoll鍙?#37836;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 07. 瑁?#26462;?#28699;?#26473;?#32459;嬩俊鍙?#28598;勭悊鍣?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 08. 璁剧疆榛?#29825;ょ郴缁?#28766;?#37804;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 09. 鍚?#37716;?#38320;嶇疆灞?#37804;х殑鏈?#37716;?#32468;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 10. 鍖归?#23941;懡浠?#37724;屽?#33445;暟涔嬮?#23544;殑瀵?#25652;?#37711;崇郴 */</span><span>  </span></span></li> <li><span>    <span class="comment">/* 11. 瑙?#37835;恑nit.rc*/</span><span>  </span></span></li> <li class="alt"><span>----------------------------------------------------------------------------  </span></li> <li><span>銆銆<span class="comment">/* 12.  鍚?#37813;?#29723;岄槦鍒?#28051;?#23075;?#37716;犲叾浠朼ction */</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">// 鑾?#37721;朅ctionManager瀵硅薄锛岄渶瑕?#38315;?#26473;嘺m瀵瑰懡浠?#37813;?#29723;岄?#21700;簭杩涜?#23678;帶?#22487;</span><span>  </span></span></li> <li><span>    ActionManager& am = ActionManager::GetInstance();  </span></li> <li class="alt"><span>    <span class="comment">// init鎵?#29723;屽懡浠?#29785;?#37721;戝櫒涓?#29781;佸垎涓篹arly-init锛宨nit锛宭ate-init锛宐oot绛?/span><span>  </span></span></li> <li><span>    am.QueueEventTrigger(<span class="string">"early-init"</span><span>);    </span><span class="comment">// 娣?#37716;?#29785;?#37721;戝櫒early-init锛?#37813;?#29723;宱n early-init?#21812;瀹?/span><span>  </span></span></li> <li class="alt"><span>  </span></li> <li><span>    <span class="comment">// Queue an action that waits for coldboot done so we know ueventd has set up all of /dev...</span><span>  </span></span></li> <li class="alt"><span>    am.QueueBuiltinAction(wait_for_coldboot_done_action, <span class="string">"wait_for_coldboot_done"</span><span>);  </span></span></li> <li><span>    <span class="comment">// ... so that we can start queuing up actions that require stuff from /dev.</span><span>  </span></span></li> <li class="alt"><span>    am.QueueBuiltinAction(mix_hwrng_into_linux_rng_action, <span class="string">"mix_hwrng_into_linux_rng"</span><span>);  </span></span></li> <li><span>    am.QueueBuiltinAction(keychord_init_action, <span class="string">"keychord_init"</span><span>);  </span></span></li> <li class="alt"><span>    am.QueueBuiltinAction(console_init_action, <span class="string">"console_init"</span><span>);  </span></span></li> <li><span>  </span></li> <li class="alt"><span>    <span class="comment">// Trigger all the boot actions to get us started.</span><span>  </span></span></li> <li><span>    am.QueueEventTrigger(<span class="string">"init"</span><span>);        </span><span class="comment">// 娣?#37716;?#29785;?#37721;戝櫒init锛?#37813;?#29723;宱n init?#21812;瀹?#38171;?#28051;?#29781;佸寘鎷?#37714;涘缓/鎸?#37734;?#28051;浜?#37929;?#35120;?#38171;?#28000;?#37721;妔ymlink绛?/span><span>  </span></span></li> <li class="alt"><span>  </span></li> <li><span>    <span class="comment">// Repeat mix_hwrng_into_linux_rng in case /dev/hw_random or /dev/random</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">// wasn't ready immediately after wait_for_coldboot_done</span><span>  </span></span></li> <li><span>    am.QueueBuiltinAction(mix_hwrng_into_linux_rng_action, <span class="string">"mix_hwrng_into_linux_rng"</span><span>);  </span></span></li> <li class="alt"><span>  </span></li> <li><span>    <span class="comment">// Don't mount filesystems or start core system services in charger mode.</span><span>  </span></span></li> <li class="alt"><span>    <span class="keyword">if</span><span> (bootmode == </span><span class="string">"charger"</span><span>) {  </span></span></li> <li><span>    am.QueueEventTrigger(<span class="string">"charger"</span><span>);     </span><span class="comment">// on charger闃舵</span><span>  </span></span></li> <li class="alt"><span>    } <span class="keyword">else</span><span> </span><span class="keyword">if</span><span> (strncmp(bootmode.c_str(), </span><span class="string">"ffbm"</span><span>, </span><span class="number">4</span><span>) == </span><span class="number">0</span><span>) {  </span></span></li> <li><span>    NOTICE(<span class="string">"Booting into ffbm mode\n"</span><span>);  </span></span></li> <li class="alt"><span>    am.QueueEventTrigger(<span class="string">"ffbm"</span><span>);  </span></span></li> <li><span>    } <span class="keyword">else</span><span> {  </span></span></li> <li class="alt"><span>    am.QueueEventTrigger(<span class="string">"late-init"</span><span>);          </span><span class="comment">// 闈?#37711;呯數妯?#23534;忔坊鍔?#29785;?#37721;戝櫒last-init</span><span>  </span></span></li> <li><span>    }  </span></li> <li class="alt"><span>  </span></li> <li><span>    <span class="comment">// Run all property triggers based on current state of the properties.</span><span>  </span></span></li> <li class="alt"><span>    am.QueueBuiltinAction(queue_property_triggers_action, <span class="string">"queue_property_triggers"</span><span>);  </span></span></li></ol></div><p>銆銆鍦╨ast-init鏈鍚?#38339;舵鏈?#28641;?#28051;?#28000;g爜锛?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span># Mount filesystems and start core system services.  </span></span></li> <li><span>on late-init  </span></li> <li class="alt"><span>    trigger early-fs  </span></li> <li><span>  </span></li> <li class="alt"><span>    # Mount fstab in init.{$device}.rc by mount_all command. Optional parameter  </span></li> <li><span>    # '--early' can be specified to skip entries with 'latemount'.  </span></li> <li class="alt"><span>    # /system and /vendor must be mounted by the end of the fs stage,  </span></li> <li><span>    # while /data is optional.  </span></li> <li class="alt"><span>    trigger fs  </span></li> <li><span>    trigger post-fs  </span></li> <li class="alt"><span>  </span></li> <li><span>    # Load properties from /system/ + /factory after fs mount. Place  </span></li> <li class="alt"><span>    # this in another action so that the load will be scheduled after the prior  </span></li> <li><span>    # issued fs triggers have completed.  </span></li> <li class="alt"><span>    trigger load_system_props_action  </span></li> <li><span>  </span></li> <li class="alt"><span>    # Mount fstab in init.{$device}.rc by mount_all with '--late' parameter  </span></li> <li><span>    # to only mount entries with 'latemount'. This is needed if '--early' is  </span></li> <li class="alt"><span>    # specified in the previous mount_all command on the fs stage.  </span></li> <li><span>    # With /system mounted and properties form /system + /factory available,  </span></li> <li class="alt"><span>    # some services can be started.  </span></li> <li><span>    trigger late-fs  </span></li> <li class="alt"><span>  </span></li> <li><span>    # Now we can mount /data. File encryption requires keymaster to decrypt  </span></li> <li class="alt"><span>    # /data, which in turn can only be loaded when system properties are present.  </span></li> <li><span>    trigger post-fs-data  </span></li> <li class="alt"><span>  </span></li> <li><span>    # Load persist properties and override properties (if enabled) from /data.  </span></li> <li class="alt"><span>    trigger load_persist_props_action  </span></li> <li><span>  </span></li> <li class="alt"><span>    # Remove a file to wake up anything waiting for firmware.  </span></li> <li><span>    trigger firmware_mounts_complete  </span></li> <li class="alt"><span>  </span></li> <li><span>    trigger early-boot  </span></li> <li class="alt"><span>銆銆 trigger boot  </span></li></ol></div><p>銆銆鍙?#29785;佸嚭鍙戜簡on early-boot鍜宱n boot涓?#28051;狝ction銆?/p><p>銆銆鎴戜滑鐪?#28051;涓媜n boot锛?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>on boot  </span></span></li> <li><span>    # basic network init  </span></li> <li class="alt"><span>    ifup lo  </span></li> <li><span>    hostname localhost  </span></li> <li class="alt"><span>    domainname localdomain  </span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>    class_start core  </span></li></ol></div><p>銆銆鍦╫n boot ?#27537;鏈鍚巆lass_start core ?#32048;鍚?#37716;╟lass涓篶ore?#27537;鏈?#37716;?#38171;?#26473;?#27996;?#37832;?#37716;?#37718;?#37815;瑄eventd銆乴ogd銆乭ealthd銆乤dbd锛坉isabled锛?#37510;乴mkd锛圠owMemoryKiller锛?#37510;乻ervicemanager銆乿old銆乨ebuggerd銆乻urfaceflinger銆乥ootanim锛坉isabled锛夌瓑銆?/p><p>銆銆鍥炲埌涓?#26864;?#38171;屽垎鏋恡rigger瑙?#37721;戝櫒?#27537;浠g爜锛孮ueueEventTrigger()锛?#28003;嶄?#24023;ystem/core/init/action.cpp</p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">void</span><span> ActionManager::QueueEventTrigger(</span><span class="keyword">const</span><span> std::string& trigger) {  </span></span></li> <li><span>    trigger_queue_.push(std::make_unique<EventTrigger>(trigger));  </span></li> <li class="alt"><span>}  </span></li></ol></div><p>銆銆姝?#28598;凲ueueEventTrigger鍑芥暟灏辨槸鍒╃敤鍙傛暟鏋?#38315;燛ventTrigger锛岀劧鍚?#37716;犲叆?#22476;trigger_queue_涓?#37510;?#37722;?#32513;璱nit杩?#32459;?#28598;勭悊trigger浜?#28000;舵椂锛?#28751;嗕細瑙?#37721;戠浉搴旂殑?#25655;浣?#37510;?/p><p>銆銆鍐嶇湅涓涓婹ueueBuiltinAction()鍑芥暟锛氬?#23678;牱浣嶄?#24023;ystem/core/init/action.cpp</p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">void</span><span> ActionManager::QueueBuiltinAction(BuiltinFunction func,  </span></span></li> <li><span>                                   <span class="keyword">const</span><span> std::string& name) {  </span></span></li> <li class="alt"><span>    <span class="comment">// 鍒涘缓action</span><span>  </span></span></li> <li><span>    auto action = std::make_unique<Action>(<span class="keyword">true</span><span>);  </span></span></li> <li class="alt"><span>    std::vector<std::string> name_vector{name};  </span></li> <li><span>  </span></li> <li class="alt"><span>    <span class="comment">// ?#32346;璇佸敮涓鎬?/span><span>  </span></span></li> <li><span>    <span class="keyword">if</span><span> (!action->InitSingleTrigger(name)) {  </span></span></li> <li class="alt"><span>        <span class="keyword">return</span><span>;  </span></span></li> <li><span>    }  </span></li> <li class="alt"><span>  </span></li> <li><span>    <span class="comment">// 鍒涘缓action?#27537;cmd锛屾寚瀹?#37813;?#29723;屽?#33445;暟鍜?#37721;傛暟</span><span>  </span></span></li> <li class="alt"><span>    action->AddCommand(func, name_vector);  </span></li> <li><span>  </span></li> <li class="alt"><span>    trigger_queue_.push(std::make_unique<BuiltinTrigger>(action.get()));  </span></li> <li><span>    actions_.emplace_back(std::move(action));  </span></li> <li class="alt"><span>}  </span></li></ol></div><p>銆銆QueueBuiltinAction鍑芥暟涓?#37835;?#38315;犳柊?#27537;action鍔犲叆?#22476;actions_涓?#38171;?#32471;?#28051;涓?#37721;傛暟浣?#28051;?#37826;板缓action鎼哄甫cmd?#27537;鎵?#29723;屽?#33445;暟锛?#32471;簩涓?#37721;傛暟?#26854;浣?#28051;篴ction?#27537;trigger name锛?#28052;?#28003;?#28051;篴ction鎼哄甫cmd?#27537;鍙傛暟銆?/p><p>銆銆?#24116;涓嬫潵缁?#32513;垎鏋恗ain鍑芥暟锛?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">int</span><span> main(</span><span class="keyword">int</span><span> argc, </span><span class="keyword">char</span><span>** argv) {  </span></span></li> <li><span>    <span class="comment">/* 01. 鍒涘缓鏂?#28000;剁郴缁?#37929;?#35120;?#39582;?#37816;傝浇鐩?#37711;崇殑鏂?#28000;剁郴缁?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 02. 灞忚斀鏍囧?#21977;殑?#32237;鍏?#26440;撳嚭/鍒濆?#23338;?#26663;唴鏍竘og?#37108;缁?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 03. 鍒濆?#23338;寲灞?#37804;?#37737;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 04. 瀹?#37812;怱ELinux鐩?#37711;?#23480;?#28003;?nbsp;*/</span><span>•  </span></span></li> <li><span>    <span class="comment">/* 05. 閲?#37826;?#29825;剧疆灞?#37804;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 06. 鍒涘缓epoll鍙?#37836;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 07. 瑁?#26462;?#28699;?#26473;?#32459;嬩俊鍙?#28598;勭悊鍣?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 08. 璁剧疆榛?#29825;ょ郴缁?#28766;?#37804;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="comment">/* 09. 鍚?#37716;?#38320;嶇疆灞?#37804;х殑鏈?#37716;?#32468;?nbsp;*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 10. 鍖归?#23941;懡浠?#37724;屽?#33445;暟涔嬮?#23544;殑瀵?#25652;?#37711;崇郴 */</span><span>  </span></span></li> <li><span>    <span class="comment">/* 11. 瑙?#37835;恑nit.rc*/</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">/* 12. 鍚?#37813;?#29723;岄槦鍒?#28051;?#23075;?#37716;犲叾浠朼ction */</span><span>  </span></span></li> <li><span>-------------------------------------------------------------------  </span></li> <li class="alt"><span>    <span class="comment">/* 13. 澶勭悊娣?#37716;犲埌杩?#29723;岄槦鍒楃殑浜?#28000;?nbsp;*/</span><span>  </span></span></li> <li><span>    <span class="keyword">while</span><span> (</span><span class="keyword">true</span><span>) {  </span></span></li> <li class="alt"><span>    <span class="comment">// 鍒?#37826;槸鍚?#37832;変簨浠?#38343;瑕?#28598;勭悊</span><span>  </span></span></li> <li><span>        <span class="keyword">if</span><span> (!waiting_for_exec) {  </span></span></li> <li class="alt"><span>            <span class="comment">// 渚濇鎵?#29723;屾瘡涓猘ction涓?#37820;哄甫command瀵?#25652;旂殑鎵?#29723;屽?#33445;暟</span><span>  </span></span></li> <li><span> 銆銆銆銆am.ExecuteOneCommand();  </span></li> <li class="alt"><span>        <span class="comment">// 閲嶅惎涓浜?#37816;?#37818;夌殑杩?#32459;?/span><span>  </span></span></li> <li><span>            restart_processes();  </span></li> <li class="alt"><span>        }  </span></li> <li><span>  </span></li> <li class="alt"><span>        <span class="comment">// 浠?#28051;嬪喅瀹歵imeout?#27537;鏃堕棿锛?#28751;嗗奖鍝峸hile寰幆?#27537;闂?#38341;?/span><span>  </span></span></li> <li><span>        <span class="keyword">int</span><span> timeout = -</span><span class="number">1</span><span>;  </span></span></li> <li class="alt"><span>        <span class="comment">// 鏈?#26473;?#32459;?#38343;瑕?#38322;嶅惎鏃?#38171;?#32475;?#23536;?#29831;?#26473;?#32459;?#38322;嶅惎</span><span>  </span></span></li> <li><span>        <span class="keyword">if</span><span> (process_needs_restart) {  </span></span></li> <li class="alt"><span>            timeout = (process_needs_restart - gettime()) * <span class="number">1000</span><span>;  </span></span></li> <li><span>            <span class="keyword">if</span><span> (timeout < </span><span class="number">0</span><span>)  </span></span></li> <li class="alt"><span>                timeout = <span class="number">0</span><span>;  </span></span></li> <li><span>        }  </span></li> <li class="alt"><span>  </span></li> <li><span>        <span class="comment">// 鏈塧ction寰?#28598;勭悊锛?#28051;嶇瓑寰?/span><span>  </span></span></li> <li class="alt"><span>        <span class="keyword">if</span><span> (am.HasMoreCommands()) {  </span></span></li> <li><span>            timeout = <span class="number">0</span><span>;  </span></span></li> <li class="alt"><span>        }  </span></li> <li><span>  </span></li> <li class="alt"><span>        <span class="comment">// bootchart_sample搴?#29831;ユ槸杩涜?#23678;ц兘?#26271;鎹?#38322;?#37837;?/span><span>  </span></span></li> <li><span>        bootchart_sample(&timeout);  </span></li> <li class="alt"><span>  </span></li> <li><span>        epoll_event ev;  </span></li> <li class="alt"><span>        <span class="comment">// ?#30149;鏈変簨浠跺埌鏉ョ殑?#30269;锛?#37832;澶?#38339;诲?#28703;imeout鏃堕棿</span><span>  </span></span></li> <li><span>        <span class="keyword">int</span><span> nr = TEMP_FAILURE_RETRY(epoll_wait(epoll_fd, &ev, </span><span class="number">1</span><span>, timeout));  </span></span></li> <li class="alt"><span>        <span class="keyword">if</span><span> (nr == -</span><span class="number">1</span><span>) {  </span></span></li> <li><span>            ERROR(<span class="string">"epoll_wait failed: %s\n"</span><span>, strerror(errno));  </span></span></li> <li class="alt"><span>        } <span class="keyword">else</span><span> </span><span class="keyword">if</span><span> (nr == </span><span class="number">1</span><span>) {  </span></span></li> <li><span>            <span class="comment">//鏈変簨浠跺埌鏉?#38171;?#37813;?#29723;?#28725;?#25652;?#28598;勭悊鍑芥暟</span><span>  </span></span></li> <li class="alt"><span>            <span class="comment">//鏍?#37817;?#28051;?#37826;囩煡閬?#38171;宔poll鍙?#37836;?#38171;?#37719;砮poll_fd锛?#28051;?#29781;?#37929;?#37722;?#28699;?#26473;?#32459;?#32513;?#37833;?#38171;?#37721;?#37711;?#28729;?#26473;?#32459;?#29825;剧疆?#37108;缁?#28766;?#37804;х殑璇锋眰</span><span>  </span></span></li> <li><span>            ((<span class="keyword">void</span><span> (*)()) ev.data.ptr)();  </span></span></li> <li class="alt"><span>        }  </span></li> <li><span>    }  </span></li> <li class="alt"><span>    <span class="keyword">return</span><span> </span><span class="number">0</span><span>;  </span></span></li> <li><span>} <span class="comment">// end main</span><span>  </span></span></li></ol></div><p>銆銆鐪?#28051;涓婨xecuteOneComand()鍑芥暟锛氬?#23678;牱浣嶄?#24023;ystem/core/init/action.cpp</p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">void</span><span> ActionManager::ExecuteOneCommand() {  </span></span></li> <li><span>    <span class="comment">// Loop through the trigger queue until we have an action to execute</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">// ?#32139;鍓嶇殑鍙?#37813;?#29723;宎ction闃?#37714;?#28051;虹┖, trigger_queue_闃?#37714;?#28051;?#28051;虹┖</span><span>  </span></span></li> <li><span>    <span class="keyword">while</span><span> (current_executing_actions_.empty() && !trigger_queue_.empty()) {  </span></span></li> <li class="alt"><span>    <span class="comment">// 寰幆閬嶅巻action_闃?#37714;?鍖?#37722;?#27996;?#37813;鏈?#38343;瑕?#37813;?#29723;岀殑鍛?#28000;?瑙?#37835;恑nit.rc鑾?#23536;?/span><span>  </span></span></li> <li><span>        <span class="keyword">for</span><span> (</span><span class="keyword">const</span><span> auto& action : actions_) {  </span></span></li> <li class="alt"><span>            <span class="comment">// 鑾?#37721;?#38339;?#28598;寸殑trigger, 妫?#29025;actions_鍒?#29723;?#28051;殑action?#27537;trigger,瀵规瘮?#27128;鍚?#37929;?#37722;?/span><span>  </span></span></li> <li><span>            <span class="keyword">if</span><span> (trigger_queue_.front()->CheckTriggers(*action)) {  </span></span></li> <li class="alt"><span>                <span class="comment">// 灏?#37813;鏈?#37711;?#37832;?#37722;?#28051;trigger?#27537;action鍔犲叆?#32139;鍓?#37721;?#37813;?#29723;宎ction闃?#37714;?/span><span>  </span></span></li> <li><span>                current_executing_actions_.emplace(action.get());  </span></li> <li class="alt"><span>            }  </span></li> <li><span>        }  </span></li> <li class="alt"><span>        <span class="comment">// 灏嗛槦澶磘rigger鍑?#37837;?/span><span>  </span></span></li> <li><span>        trigger_queue_.pop();  </span></li> <li class="alt"><span>    }  </span></li> <li><span>  </span></li> <li class="alt"><span>    <span class="keyword">if</span><span> (current_executing_actions_.empty()) {   </span><span class="comment">// ?#32139;鍓?#37721;?#37813;?#29723;岀殑actions闃?#37714;?#28051;虹┖灏?#26473;?#37733;?/span><span>  </span></span></li> <li><span>        <span class="keyword">return</span><span>;  </span></span></li> <li class="alt"><span>    }  </span></li> <li><span>  </span></li> <li class="alt"><span>    auto action = current_executing_actions_.front(); <span class="comment">// 鑾?#37721;栧綋鍓?#37721;?#37813;?#29723;宎ctions闃?#37714;楃殑棣?#28051;猘ction</span><span>  </span></span></li> <li><span>  </span></li> <li class="alt"><span>    <span class="keyword">if</span><span> (current_command_ == </span><span class="number">0</span><span>) {  </span></span></li> <li><span>        std::string trigger_name = action->BuildTriggersString();  </span></li> <li class="alt"><span>        INFO(<span class="string">"processing action (%s)\n"</span><span>, trigger_name.c_str());  </span></span></li> <li><span>    }  </span></li> <li class="alt"><span>  </span></li> <li><span>    action->ExecuteOneCommand(current_command_);     <span class="comment">// 鎵?#29723;屽綋鍓嶇殑鍛?#28000;?/span><span>  </span></span></li> <li class="alt"><span>  </span></li> <li><span>    <span class="comment">// If this was the last command in the current action, then remove</span><span>  </span></span></li> <li class="alt"><span>    <span class="comment">// the action from the executing list.</span><span>  </span></span></li> <li><span>    <span class="comment">// If this action was oneshot, then also remove it from actions_.</span><span>  </span></span></li> <li class="alt"><span>    ++current_command_;      <span class="comment">// 涓?#37826;?#37721;?#37716;?灏哸ction_涓殑鎵鏈?#37723;?#28000;?#37721;栧嚭</span><span>  </span></span></li> <li><span>    <span class="keyword">if</span><span> (current_command_ == action->NumCommands()) {  </span></span></li> <li class="alt"><span>        current_executing_actions_.pop();  </span></li> <li><span>        current_command_ = <span class="number">0</span><span>;  </span></span></li> <li class="alt"><span>        <span class="keyword">if</span><span> (action->oneshot()) {  </span></span></li> <li><span>            auto eraser = [&action] (std::unique_ptr<Action>& a) {  </span></li> <li class="alt"><span>                <span class="keyword">return</span><span> a.get() == action;  </span></span></li> <li><span>            };  </span></li> <li class="alt"><span>            actions_.erase(std::remove_if(actions_.begin(), actions_.end(), eraser));  </span></li> <li><span>        }  </span></li> <li class="alt"><span>    }  </span></li> <li><span>}  </span></li></ol></div><p>銆銆鎴戜滑鏉?#29785;?#28725;?#28051;涓媔nit.rc?#27537;寮澶?#38318;ㄥ垎锛?/p><div class="codeText"><div class="codeHead">Java浠g爜</div><ol start="1" class="dp-j"> <li class="alt"><span><span class="keyword">import</span><span> /init.environ.rc  </span></span></li> <li><span><span class="keyword">import</span><span> /init.usb.rc  </span></span></li> <li class="alt"><span><span class="keyword">import</span><span> /init.${ro.hardware}.rc  </span></span></li> <li><span><span class="keyword">import</span><span> /init.usb.configfs.rc  </span></span></li> <li class="alt"><span><span class="keyword">import</span><span> /init.${ro.zygote}.rc      </span><span class="comment">// 鍚?#38344;?#37812;戜滑鍗?#28751;?#38322;嶇?#29808;垎鏋恴ygote杩?#32459;?/span><span>  </span></span></li></ol></div><p>銆銆閫?#26473;噐o.zygote?#27537;灞?#37804;mport瀵?#25652;旂殑zygote?#27537;rc鏂?#28000;?#37510;?/p><p style="text-align: center;"><img src="http://www.ojizl5.fun/android/upload/820567-20170421140258259-516147864.png" alt="Android鍚?#37716;ㄧ瘒 — init鍘熺悊锛堜簩锛? /></p><p>銆銆鎴戜滑?#29025;鐪媔nit.zygote64_32.rc锛?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>service zygote /system/bin/app_process64 -Xzygote /system/bin --zygote --start-system-server </span><span class="attribute">--socket-name</span><span>=</span><span class="attribute-value">zygote</span><span>  </span></span></li> <li><span>    class main  </span></li> <li class="alt"><span>    socket zygote stream 660 root system  </span></li> <li><span>    onrestart write /sys/android_power/request_state wake  </span></li> <li class="alt"><span>    onrestart write /sys/power/state on  </span></li> <li><span>    onrestart restart audioserver  </span></li> <li class="alt"><span>    onrestart restart cameraserver  </span></li> <li><span>    onrestart restart media  </span></li> <li class="alt"><span>    onrestart restart netd  </span></li> <li><span>    writepid /dev/cpuset/foreground/tasks  </span></li> <li class="alt"><span>  </span></li> <li><span>service zygote_secondary /system/bin/app_process32 -Xzygote /system/bin --zygote <span class="attribute">--socket-name</span><span>=</span><span class="attribute-value">zygote_secondary</span><span>  </span></span></li> <li class="alt"><span>    class main  </span></li> <li><span>    socket zygote_secondary stream 660 root system  </span></li> <li class="alt"><span>    onrestart restart zygote  </span></li> <li><span>    writepid /dev/cpuset/foreground/tasks  </span></li></ol></div><p>銆銆鍙?#28000;?#37930;嬪埌zygote?#27537;class?#27128;main, 瀹冩槸鍦╫n nonencrypted鏃惰鍚?#37716;ㄧ殑锛屽涓?#38171;?/p><div class="codeText"><div class="codeHead">XML/HTML浠g爜</div><ol start="1" class="dp-xml"> <li class="alt"><span><span>on boot  </span></span></li> <li><span>    # basic network init  </span></li> <li class="alt"><span>    ifup lo  </span></li> <li><span>    hostname localhost  </span></li> <li class="alt"><span>    domainname localdomain  </span></li> <li><span>    ... ...  </span></li> <li class="alt"><span>    class_start core  </span></li> <li><span>  </span></li> <li class="alt"><span>on nonencrypted  </span></li> <li><span>    # A/B update verifier that marks a successful boot.  </span></li> <li class="alt"><span>    exec - root cache -- /system/bin/update_verifier nonencrypted  </span></li> <li><span>    class_start main  </span></li> <li class="alt"><span>    class_start late_start  </span></li></ol></div><p>銆銆鑷?#23005;?#38171;孖nit.cpp?#27537;main鍑芥暟?#22414;鏋愬?#23678;瘯锛乮nit杩?#32459;嬪凡缁?#37722;?#37716;?#28729;?#37812;?#38171;?#28051;浜?#38322;?#29781;佺殑鏈?#37716;?#28641;俢ore鏈?#37716;?#37724;宮ain鏈?#37716;?#28052;?#38318;?#37722;?#37716;?#29863;锋潵锛屽苟鍚?#37716;?#27996;唞ygote锛?system/bin/app_process64锛?#26473;?#32459;?#38171;寊ygote鍒濆?#23338;寲鏃朵細鍒涘缓铏?#37815;?#37832;?#38171;屽惎鍔╯ystemserver绛?#37510;?/p>]]></description><category>Android寮鍙戞暀绋?/category><comments>http://www.ojizl5.fun/android/course/712.html#comment</comments><wfw:comment>http://www.ojizl5.fun/android/</wfw:comment><wfw:commentRss>http://www.ojizl5.fun/android/feed.asp?cmt=712</wfw:commentRss><trackback:ping>http://www.ojizl5.fun/android/cmd.asp?act=tb&id=712&key=562b7475</trackback:ping></item><item><title>Android Studio锛堜簩鍗佷竷锛?#38171;欰ndroid Studio?#21812;瀛?/title><author>a@b.com (楦″晞绫?</author><link>http://www.ojizl5.fun/android/environment/711.html</link><pubDate>Wed, 06 Sep 2017 09:31:35 +0800</pubDate><guid>http://www.ojizl5.fun/android/environment/711.html</guid><description><![CDATA[<p>銆銆Android Monitor鎻?#28186;?#27996;?#28051;涓狹emory Monitor锛?#37813;浠?#28003;?#37721;?#28000;?#38344;炲父瀹?#37828;撶殑鐩?#23092;嬪?#26050;敤鎬ц兘鍜屽唴瀛?#28003;跨敤锛?#37721;?#28000;?#37721;戠?#29256;?#29365;敤?#27537;瀵硅薄锛?#37832;?#37734;板唴瀛?#23049;勬紡鍜?#26473;炴帴璁?#28598;囩殑?#21812;瀛?#28003;跨敤銆侻emory Monitor鏄剧ず浣犵殑搴旂敤濡?#28003;?#37714;嗛?#23941;唴瀛?#38171;屽苟涓旂敤鍙?#29785;嗗寲?#27537;鏂?#23534;?#28766;曠?#21700;嚭鏉?#38171;?/p><p>銆銆1銆?鏍?#37817;?#37827;堕棿鏄剧ず涓涓?#37733;?#35120;㈢殑鍙敤鍜屽凡鍒嗛?#23943;殑Java?#21812;瀛?/p><p>銆銆2銆?鏍?#37817;?#37827;堕棿鏄剧?#21700;瀮鍦?#28598;勭悊浜?#28000;?/p><p>銆銆3銆?鍒濆?#23338;?#26663;瀮鍦?#28598;勭悊浜?#28000;?/p><p>銆銆<span style="font-size: medium;"><strong>Memory Monitor宸?#28003;?#23092;?#32459;?/strong></span></p><p>銆銆涓轰?#21976;娴嬪拰浼樺寲浣犵殑?#21812;瀛?#28003;跨敤锛屽?#31295;瀷?#27537;宸?#28003;?#23092;?#32459;嬫槸杩?#29723;?#28003;犵殑搴旂敤锛岀劧鍚?#37813;?#29723;屽涓嬫搷浣?#38171;?/p><p>銆銆1銆?浣跨敤Memory Monitor妫娴嬪?#26050;敤鏉ユ煡鐪嬪瀮鍦?#28598;勭悊?#27128;鍚?#28725;?#37804;ц兘閫犳?#24876;奖鍝?#37510;?/p><p>銆銆2銆?濡?#37835;?#28003;犲湪鐭?#37827;堕棿鍐呯?#23338;埌寰?#28598;氬瀮鍦?#37733;?#37824;朵簨浠?#38171;?#37721;?#28000;?#26473;涜鐩?#37711;崇殑?#22414;鏋?/p><p>銆銆3銆?寮濮嬪?#21979;厤璺熻釜鏉?#32429;?#28729;氭槸鍚?#28003;犵殑浠g爜鏈夐棶棰?#37510;?/p><p>銆銆<span style="font-size: medium;"><strong>鍦∕emory Monitor鏄剧ず涓涓?#26473;?#29723;岀殑搴旂敤</strong></span></p><p>銆銆閫?#26473;?#28000;?#28051;嬫楠?#38171;?#28751;?#26473;?#29723;?#37734;?#37911;?#28729;氱殑璁?#28598;?#37812;?#38095;?#37815;?#37832;?#28051;煡鐪嬪?#26050;敤锛?/p><p>銆銆1銆?鎵?#23534;涓涓?#26916;?#37929;?/p><p>銆銆2銆?鍦?#37911;╃悊璁?#28598;?#37812;?#38095;?#37815;?#37832;?#28051;?#26473;?#29723;屽?#26050;敤</p><p>銆銆3銆?鏄剧?#31688;ndroid Monitor</p><p>銆銆4銆?鐐?#37713;籑onitors鏍囩骞?#37828;剧?#31703;emory Monitor</p>]]></description><category>Android寮鍙戠幆澧?/category><comments>http://www.ojizl5.fun/android/environment/711.html#comment</comments><wfw:comment>http://www.ojizl5.fun/android/</wfw:comment><wfw:commentRss>http://www.ojizl5.fun/android/feed.asp?cmt=711</wfw:commentRss><trackback:ping>http://www.ojizl5.fun/android/cmd.asp?act=tb&id=711&key=efa097a6</trackback:ping></item><item><title>Android寮鍙戣繖浜?#28052;?#37719;?#28003;犻兘鏈変簡鍚?#38171;?/title><author>a@b.com (楦″晞绫?</author><link>http://www.ojizl5.fun/android/book/710.html</link><pubDate>Mon, 04 Sep 2017 11:13:55 +0800</pubDate><guid>http://www.ojizl5.fun/android/book/710.html</guid><description><![CDATA[<p> </p><p><article style="margin: 5px auto ; white-space: normal ; max-width: 100% ; color: rgb( 62 , 62 , 62 ) ; font-size: 14px ; border: 0px ; word-wrap: break-word ; background-color: rgb( 255 , 255 , 255 )"><section style="max-width: 100% ; font-family: ; font-size: 13px ; line-height: 24px ; word-wrap: break-word"><section style="margin-top: 0.8em ; margin-bottom: 0.3em ; max-width: 100% ; border: none rgb( 216 , 40 , 33 ) ; word-wrap: break-word"><section style="max-width: 100% ; text-align: center ; text-decoration: inherit ; color: rgb( 255 , 255 , 255 ) ; word-wrap: break-word"><section style="padding: 0.5em ; max-width: 100% ; border: 0px rgb( 5 , 157 , 127 ) ; line-height: 1.2em ; font-size: 1em ; color: inherit ; border-radius: 4px ; word-wrap: break-word ; background-color: rgb( 5 , 157 , 127 )"></section></section></section></section></article></p><p> </p><p style="font-size: 16px ; white-space: normal ; max-width: 100% ; min-height: 1em ; color: rgb( 62 , 62 , 62 ) ; line-height: normal ; word-wrap: break-word ; background-color: rgb( 255 , 255 , 255 )"> </p><p> </p><p><section style="line-height: 25.6px ; white-space: normal"><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section style="margin-right: auto ; margin-left: auto"><section><section class="yead_bgc" style="width: 50px ; height: 4px ; background-color: rgb( 0 , 167 , 141 )"></section></section><section style="margin-top: -4px ; padding: 10px ; background-color: rgb( 243 , 243 , 243 )"><p style="border: 0px ; color: rgb( 51 , 51 , 51 ) ; line-height: 1.5em"><span style="font-family: , "simhei" ; line-height: 25.6px">Android鍙?#28766;?#28641;傛棩涓?#28598;?#38171;屽?#20914;?#22248;瘡澶?#37832;?50涓?#38318;ㄧ殑Android璁?#28598;?#29722;縺娲?#38171;屽叏鐞?#37832;夎秴杩囦簩鍗佷?#36328;殑璁?#28598;?#28729;夎?#21266;ndroid?#25655;浣滅郴缁?#37510;?#37832;?#37833;ndroid?#37108;缁熺殑搴旂敤缁?#28051;?#28000;?#28766;闄?#27996;?#37813;?#37832;轰骇涓?#38171;屽凡杩?#38315;?#37813;?#23534;犲埌鐩?#37711;?#26864;嗗煙锛屽?#20634;钩鏉跨?#20291;剳銆?#26462;?#26462;界郴缁熺瓑銆?#38341;忕潃Android骞?#37721;扮殑鎵?#23534;?#38171;?#23534;?#37721;戜?#21669;ndroid浜?#37813;?#38013;?#38171;?#37929;?#37715;嶇Щ鍔?#23534;鍙戜汉鎵?#38343;?#30512;缂?#37721;?#28751;嗚?#21095;櫨涓?#38171;?#28003;嗙鍚堟潯浠剁殑Android宸?#32459;嬪笀杩樻槸灏戞暟銆侫ndroid寮鍙?#23480;?#32459;嬪?#22559;垚涓篒T琛?#28051;?#37904;?#37813;?#37721;儹?#27537;?#30678;浣?#28052;?#28051;銆?/span><span style="font-family: , "simhei" ; line-height: 25.6px">浠?#28598;?#37825;寸悊浜?#28000;嶢ndroid寮鍙戜粠鍏?#38338;ㄥ埌杩?#38339;剁殑鍗?#37832;?#28610;?#28052;?#37510;?/span></p></section></section></article><p style="line-height: normal"> </p></section><section style="font-size: 16px ; line-height: 25.6px ; white-space: normal ; max-width: 100% ; color: rgb( 62 , 62 , 62 ) ; word-wrap: break-word ; background-color: rgb( 255 , 255 , 255 )"><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">?#32321;鍏ョ悊瑙ndroid?#21812;鏍?#29825;?#29825;?#37804;濇兂锛?#32471;?鐗?#38171;?#38171;堜笂涓嬪唽锛?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605Oibbq2TuDV4fX2AibDictAA9V9BR2BnhFayqTxSUOBsUaY4v14CdowbAFdXIvTuOHQHWfEQ3t4vph3g/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 556px" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">鍥藉唴璧勬繁涓绾?#23534;鍙?#23480;?#32459;嬪?#22559;?#26495;啓銆?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">涓?#28051;?#37722;?#29831;?#38000;?#28729;?#29882;?#26473;囩殑銆佷竴鏈?#29831;诲?#26945;噦銆佺敤寰?#28051;?#38171;屽府鍔?#29785;?#37712;?#23480;?#32459;嬮」鐩?#38341;剧偣?#27537;?#28488;濞佹寚鍗?#37510;?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">鍩轰?#23970;ndroidSDK鏂?#37911;堟湰锛?#27996;?#28051;滅伀?#20793;棰勫敭涓?#37510;?/span></p> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"> </p> </li></ul><p style="line-height: normal"> </p><article class="yead_editor yead-selected" style="margin: 5px auto ; line-height: 25.6px ; font-size: 14px ; border: 0px"><section><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1706e8783d5b2256644f" width="150" style="border: 1px solid #585858" alt="" /></p><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">Android 婧愮爜璁?#29825;?#22959;?#23534;?#29785;?#37835;?#28051;?#28729;?#37812;?#38171;?#32471;?鐗?#38171;?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605Oibbq2TuDV4fX2AibDictAA9V9BR2BnhFayqTxSUOBsUaY4v14CdowbAFdXIvTuOHQHWfEQ3t4vph3g/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="line-height: 25.6px ; text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px ; line-height: 25.6px"> <li> <p style="line-height: 1.75em"><span style="font-family: , "simhei" ; line-height: normal ; color: rgb( 0 , 167 , 141 )">涓氱晫绗?#28051;鏈珹ndroid婧愮爜璁茶В璁?#29825;?#22959;?#23534;忕殑涔?/span></p> </li></ul><p style="line-height: normal"> </p><ul class=" list-paddingleft-2" style="width: 528.188px ; line-height: 25.6px"> <li><section> <p style="line-height: 1.75em"><span style="font-family: , "simhei" ; line-height: normal ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid杩?#38339;?#38000;?#38171;孋SDN绀?#37718;?#28051;?#28729;剁簿蹇冩?#26495;啓锛?#28051;氱晫涓?#28729;堕?#25779;嚒骞?#37510;?#38318;?#38343;?#37510;佷?#33636;帀鍒?#37510;佸?#24876;疁鐢熺?#22800;紟鍔?#37818;ㄨ崘</span></p> </section></li></ul><p style="text-align: center ; line-height: normal"> </p><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/170537b04c7a8785580c" width="150" style="border: 1px solid #585858" alt="" /></p><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"> </p><p style="line-height: normal"> </p><article class="yead_editor yead-selected" style="margin: 5px auto ; line-height: 25.6px ; font-size: 14px ; border: 0px"><section> <section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">Android Studio搴旂敤寮鍙?#28729;?#37812;?#29831;?#29785;?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605Oibbq2TuDV4fX2AibDictAA9V9BR2BnhFayqTxSUOBsUaY4v14CdowbAFdXIvTuOHQHWfEQ3t4vph3g/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="line-height: 25.6px ; text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px ; line-height: 25.6px"> <li> <p style="line-height: 1.75em"><span style="font-family: , "simhei" ; line-height: normal ; color: rgb( 0 , 167 , 141 )">鍑?#28052;庢兜鐩?#27996;咥ndroid Studio搴旂敤寮鍙?#37813;?#20824;娑?#37721;婂埌?#27537;鎵鏈?#26864;嗗煙锛岀敤鍏?#28003;?#28729;?#28186;嬪?#35826;簳鍓?#37835;?#27996;咥ndroid Studio寮鍙戠殑?#30241;涓涓煡?#30225;鐐?#37510;?/span></p> </li></ul><p style="line-height: normal"> </p><ul class=" list-paddingleft-2" style="width: 528.188px ; line-height: 25.6px"> <li><section> <p style="line-height: 1.75em"><span style="font-family: , "simhei" ; line-height: normal ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid鍒?#32510;?#29831;?#38000;?#38171;岃禒閫?#37832;?#28052;?#37813;鏈夌殑?#31790;浠g爜銆?00涓?#28729;?#28186;?#28000;g爜锛?000椤礟DF鐢?#28699;?#28052;?#38171;?0灏忔椂?#27537;Android?#26240;瀛?#29785;嗛銆?/span></p> </section></li></ul><p style="text-align: center ; line-height: normal"> </p><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1701184d7afe6504770a" width="150" style="border: 1px solid #585858" alt="" /></p><p> </p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><strong><span style="line-height: 30px ; color: rgb( 255 , 255 , 255 ) ; font-family: , "simhei" ; font-size: 16px">?#32321;鍏?#29785;?#37835;怉ndroid铏?#37815;?#37832;?/span></strong></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><p> </p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid鍒?#28699;?#38000;?#38171;?/span><span style="color: rgb( 0 , 167 , 141 ) ; font-family: , "simhei" ; font-size: 16px ; line-height: 1.75em">渚濇璁茶В浜咼ava铏?#37815;?#37832;哄熀纭銆丄ndroid铏?#37815;?#37832;哄熀纭锛岃?#33590;ВJava铏?#37815;?#37832;?#37826;?#38344;?#26440;?#37711;ㄧ殑涓鏈?#37721;?#38000;?#28052;?#37510;?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"> </p><p style="line-height: normal"> </p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閬?#23536;?ldquo;鍩?#32429;璁茶В—婧愮爜?#22414;鏋?mdash;鏍?#36423;冩妧鏈?#37715;?#37835;?rdquo;杩?#28051;涓?#32510;?#37510;?/span></p> </li></ul><p> </p></section><p style="text-align: center ; line-height: normal"> </p><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1610851963cc772dd58a" width="150" style="border: 1px solid #585858" alt="" /></p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">Android浼犳?#29111;櫒寮鍙?#28051;庢?#40511;兘璁?#28598;?#22935;堜?#23338;疄鎴?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid鍒?#28699;?#38000;?#38171;屽叏闈?#37715;?#37835;?#27996;?#28051;嶢ndroid浼犳?#29111;櫒鍜?#28598;?#29825;?#25652;旂敤寮鍙戠浉鍏崇殑鏍?#36423;冩妧鏈?#37510;?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">瀹炵敤鎬?#23534;?閫?#26473;?#37711;?#28003;?#28729;?#28186;?#26473;涜浜?#28729;?#29882;?#23125;?#32513;?#38171;屽唴瀹硅緝鍏?#38344;㈢殑涓鏈珹ndroid浼犳?#29111;櫒鍜?#28598;?#29825;?#25652;旂敤寮鍙?#28052;?#37510;?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"> </p><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1605b3bfbe9d236ea125" width="150" style="border: 1px solid #585858" alt="" /></p><p style="line-height: normal"> </p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">鏋勫缓瀹?#37711;ㄧ殑Android App</span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid寮鍙戜?#21700;憳锛孉ndroid瀹?#37711;?#28051;?#28729;剁殑缁忛獙涔?#28003;?#37510;?nbsp;</span></p> </li></ul><p style="line-height: normal"> </p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">鎵?#38315;犲?#27692;?#34425;殑APP搴旂敤绋嬪簭?#27537;瀹?#29882;垫寚鍗?#38171;?#37930;?#28729;?#37734;?#28766;曠?#31688;ndroid App搴旂敤涓?#28699;?#37734;ㄧ殑瀹?#37711;?#38338;?#26864;?#37510;?/span></p> </li></ul><p style="line-height: normal"> </p><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/16049c7b0d230e7374d2" width="150" style="border: 1px solid #585858" alt="" /></p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">Android搴旂敤娴嬭瘯?#23514;鍗?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;堟?#23341;瘯浜哄憳銆?#23092;嬭瘯寮鍙戜?#21700;憳銆?#23092;嬭瘯缁忕悊銆佺Щ鍔?#23534;鍙戜?#21700;憳闃?#29831;?#38171;?#28051;鏈?#32457;?#37716;?#23092;嬭瘯瀹炵敤宸?#37711;?#28052;?#37510;?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">鏉ヨ嚜Android娴嬭瘯涓?#28729;剁殑?#25010;浣?#38171;岄?#26473;囩?#28355;瘑?#27537;娴嬭瘯鎵?#38315;犻浂Bug ?#27537;Android搴旂敤銆?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"> </p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1603d1b860ba09917f38" width="150" style="border: 1px solid #585858" alt="" /></p><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">?#31807;閫欰ndroid缃戠粶寮鍙?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">瀹?#28186;?#28051;?#28725;?#38171;屾?#22796;収Android 5 鏂?#37911;堟湰缂栧啓銆?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid鍒?#28699;?#38000;?#38171;屽唴瀹硅緝鍏?#38344;㈢殑涓鏈珹ndroid缃戠粶搴旂敤寮鍙?#28052;?#37510;?/span></p> </li></ul><p style="line-height: normal"> </p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/16034e9d8dd7bdfac729" width="150" style="border: 1px solid #585858" alt="" /></p><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><strong><span style="color: rgb( 255 , 255 , 255 ) ; font-family: , "simhei" ; font-size: 16px">Java鍜孉ndroid寮鍙?#28699;?#28052;犳寚鍗?#38171;?#32471;?鐗?#38171;?/span></strong></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605NyLM9IzKIsbFzDyxnrZXqwibUgdLMWKia2k6Fb6W6WmFUH4moRoibk01ZJNgxKxl3EibF4mrNvUflzEQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px ; line-height: 25.6px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;堟兂瑕?#28699;︿範Java璇?#29815;锛屾兂瑕?#26473;涜?#23369;ndroid搴旂敤绋嬪簭寮鍙戠殑浜?#37510;?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px ; line-height: 25.6px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">涓鏈?#28052;?#37818;屾彙Java寮鍙?#37837;?#36423;冪煡?#30225;鍜孉ndroid骞?#37721;癆pp寮鍙戞妧?#20824; 锛孒ow Tomcat Works浣?#38000;?#37716;?#28003;?#37510;?/span></p> </li></ul><p style="line-height: normal"> </p></section></section><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1602beca5e57248635d1" width="150" style="border: 1px solid #585858" alt="" /></p><section><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><span style="color: rgb( 255 , 255 , 255 )"><strong><span style="line-height: 30px ; font-family: , "simhei" ; font-size: 16px">Android寮鍙戣繘闃?#38171;?#28000;?#28751;?#23480;ュ埌涓?#28729;?/span></strong></span></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">閫?#37722;圓ndroid寮鍙?#37714;?#28699;?#38000;?#38171;?#28051;鏈?#28051;?#38338;?#28000;?#32513;岮ndroid寮鍙戠殑鍥?#28052;?nbsp;銆?/span></p> </li></ul><p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: normal"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )"><br /></span></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="margin-top: 5px ; margin-bottom: 5px ; font-family: "helvitica neue" , "helvitica" , "arial" , "hiragino sans gb" , "microsoft yahei" , "arial regular" , sans-serif ; font-size: 14px ; line-height: 1.75em"><span style="font-family: , "simhei" ; font-size: 16px ; color: rgb( 0 , 167 , 141 )">涓?#23005;?#28000;?#37711;?#38338;ㄥ埌?#31807;閫??#27967;?#32321;鍏?#29825;茶В寮鍙戠紪绋嬫牳蹇冪煡?#30225;鐐?#38171;?#37510;夾ndroid 婧愮爜璁?#29825;?#22959;?#23534;?#29785;?#37835;?#28051;?#28729;?#37812;?#37510;?#28003;?#38000;?#28003;?#32510;?#26440;?#37716;?#28003;?#37510;?nbsp;</span></p> </li></ul><p style="line-height: normal"><span style="font-family: , "simhei""> </span></p><section><article class="yead_editor yead-selected" style="margin: 5px auto ; font-size: 14px ; border: 0px"><section><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/16012f71578f1f0a5c78" width="150" style="border: 1px solid #585858" alt="" /></p><section class="yead_bgc" style="padding: 10px ; color: rgb( 102 , 102 , 102 ) ; text-align: justify ; background-color: rgb( 0 , 167 , 141 )"><p style="word-wrap: break-word ; color: inherit ; text-align: center"><strong><span style="line-height: 30px ; color: rgb( 255 , 255 , 255 ) ; font-family: , "simhei" ; font-size: 16px">Android妗嗘灦鎻?#32457;?/span></strong></p></section><section class="wx-bg" style="height: 20px ; background-image: url("http://mmbiz.qpic.cn/mmbiz_png/iaibvmyz4605N0Gvre8cpoW90soXa2zJ3RqgFFQvrWBFiam1NeEKoJOZ2icYEkw9Qic4vQt4RRpNv6QQwa6JZkHRoiaQ/0?wx_fmt=png") ; background-repeat: no-repeat"></section></section></article><p style="text-align: center"> </p><p style="text-align: center"> </p><p style="text-align: center"><img style="width: 100% ; height: auto" alt="" /></p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="line-height: 1.75em"><span style="font-family: , "simhei" ; color: rgb( 0 , 167 , 141 )">閫?#37722;堟湁涓瀹?#23534;鍙戠粡楠岀殑Android寮鍙戜?#21700;憳锛岄煩鍥?#39582;?#25652;?#37923;?#38335;涔?#38171;孉ndroid?#21812;鏍?#23534;鍙戠殑寰堝ソ閫?#37815;?#37510;?nbsp;</span></p> </li></ul><p style="line-height: normal"> </p><ul class=" list-paddingleft-2" style="width: 528.188px"> <li> <p style="line-height: 1.75em"><span style="font-family: , "simhei" ; color: rgb( 0 , 167 , 141 )">?#32321;鍏?#37934;旂?#36346;垎鏋怉ndroid妗嗘?#36346;唴閮?#26473;?#29723;屽?#29114;悊涓?#37832;哄埗锛?011骞?#25652;?#38346;?#37733;?#37826;囧寲浣撹?#33590;鍏?#38318;?#28028;樼瀛?#37832;?#37733;?#28052;?#37510;?/span></p> </li></ul></section></section></section></section></section></section></section></p><p> </p><p style="line-height: 25.6px ; white-space: normal ; text-align: center"><img style="color: rgb( 62 , 62 , 62 ) ; font-size: 16px ; line-height: normal ; word-wrap: break-word ; visibility: visible ; width: auto" alt="" /></p><p align="center"><img src="http://file.epubit.com.cn/ScreenShow/1501043e4dc737729a3a" width="150" style="border: 1px solid #585858" alt="" /></p>]]></description><category>Android寮鍙?#28052;?#32491;?/category><comments>http://www.ojizl5.fun/android/book/710.html#comment</comments><wfw:comment>http://www.ojizl5.fun/android/</wfw:comment><wfw:commentRss>http://www.ojizl5.fun/android/feed.asp?cmt=710</wfw:commentRss><trackback:ping>http://www.ojizl5.fun/android/cmd.asp?act=tb&id=710&key=6eed8c8d</trackback:ping></item><item><title>Android鎵?#37832;?#37719;?#28601;?#38171;堜簩鍗?#38171;?#38171;?#28725;硅瘽鍒濇璁剧疆?#30225;?#29212;楠岃瘉杩囩▼a@b.com (楦″晞绫?http://www.ojizl5.fun/android/example/709.htmlFri, 01 Sep 2017 10:24:57 +0800http://www.ojizl5.fun/android/example/709.htmlAndroid鎵?#37832;?#37719;?#28601;?#38171;堜簩鍗?#38171;?#38171;?#28725;硅瘽鍒濇璁剧疆?#30225;?#29212;楠岃瘉杩囩▼

       棣?#37711;堟坊鍔?#28051;?#37733;?#37816;夐挳?#27537;鐩?#37722;?#27996;?#28000;?#28000;g爜

Java浠g爜
  1. /** 
  2.  * 璁剧疆?#30225;?#29212;瀵硅瘽妗?/span> 
  3.  */  
  4. private void showSetPsdDialog() {  
  5.     //闇瑕佽嚜宸?#37720;?#28729;?#28052;?#28725;硅瘽妗嗙殑鏄剧ず鏍?#23534;?#38171;?#37813;浠?#29781;佽皟?#25956;dialog.setView(view);  
  6.     Builder builder = new Builder(this);  
  7.     final AlertDialog dialog = builder.create();  
  8.     final View view = inflate(this, R.layout.dialog_set_psd, null);  
  9.     //璁?#28725;硅瘽妗?#37828;剧ず涓涓嚜宸?#28729;?#28052;夌殑瀵硅瘽妗嗙晫闈?#37825;堟灉  
  10.     dialog.setView(view);  
  11.     dialog.show();  
  12.   
  13.     Button bt_submit = (Button) view.findViewById(R.id.bt_submit);  
  14.     Button bt_cancel = (Button) view.findViewById(R.id.bt_cancel);  
  15.   
  16.     bt_submit.setOnClickListener(new OnClickListener() {  
  17.         @Override  
  18.         public void onClick(View v) {  
  19.             EditText et_set_psd = (EditText) view.findViewById(R.id.et_set_psd);  
  20.             EditText et_confirm_psd = (EditText) view.findViewById(R.id.et_confirm_psd);  
  21.             String psd = et_set_psd.getText().toString();  
  22.             String confirmPsd = et_confirm_psd.getText().toString();  
  23.             if(!TextUtils.isEmpty(psd) && !TextUtils.isEmpty(confirmPsd)){  
  24.                 //杩?#37711;ョ敤鎴?#37813;?#37832;?#38339;茬?#26945;ā?#28513;  
  25.                 if(psd.equals(confirmPsd)) {  
  26.                     Intent intent = new Intent(getApplicationContext(), testActivity.class);  
  27.                     startActivity(intent);  
  28.                     //璺?#26462;埌鏂扮殑?#26219;闈?#28000;?#37722;?#38343;瑕?#37720;?#38341;愯棌瀵硅瘽妗?/span>  
  29.                     dialog.dismiss();  
  30.                 } else {  
  31.                     ToastUtil.show(getApplicationContext(),"?#30225;鐮佷笉涓鑷?quot;);  
  32.                 }  
  33.   
  34.             }else{  
  35.                 //鎻愮?#34425;敤鎴峰瘑?#29212;?#32237;鍏?#28051;虹?#34425;殑?#20751;鍐?/span>  
  36.                 ToastUtil.show(getApplicationContext(),"璇疯緭鍏ュ瘑?#29212;");  
  37.             }  
  38.         }  
  39.     });  
  40.     bt_cancel.setOnClickListener(new OnClickListener() {  
  41.         @Override  
  42.         public void onClick(View view) {  
  43.             dialog.dismiss();  
  44.         }  
  45.     });  
  46. }  

      杩?#38322;?#37826;板缓涓涓猘ctivity锛歵estActivity?#25956;鏉?#23092;嬭瘯锛屽厛鐪嬪埌鏁堟灉锛屽叿浣?#37722;?#38344;?#37712;?#28729;炵幇

Java浠g爜
  1. public class testActivity extends Activity {  
  2.     @Override  
  3.     protected void onCreate(Bundle savedInstanceState) {  
  4.         super.onCreate(savedInstanceState);  
  5.   
  6.         TextView textView = new TextView(this);  
  7.         textView.setText("testActivity!");  
  8.   
  9.         setContentView(textView);  
  10.     }  
  11. }  

      ?#21159;鍚?#37734;ㄦ竻鍗?#37826;?#28000;?#28051;?#23075;?#37716;?#28051;?#38344;㈢殑浠g爜锛?/p>

XML/HTML浠g爜
  1. <activity android:name="com.wuyudong.mobilesafe.activity.testActivity"></activity>
]]>
Android寮鍙?#28729;?#28186;?/category>http://www.ojizl5.fun/android/example/709.html#commenthttp://www.ojizl5.fun/android/http://www.ojizl5.fun/android/feed.asp?cmt=709http://www.ojizl5.fun/android/cmd.asp?act=tb&id=709&key=5d36a465
Android?#29238;鎴?#23534;鍙?#28729;?#29882;?#28052;婲DK涓嶫NI寮鍙?3a@b.com (楦″晞绫?http://www.ojizl5.fun/android/game/708.htmlWed, 30 Aug 2017 10:45:55 +0800http://www.ojizl5.fun/android/game/708.html鏈?#37826;囩殑鐩?#35120;?#28641;?#28051;?#38171;?/p>

1銆??#24134;澧冩惌寤?/span>

瑕?#29825;〢ndroidStudio鏀?#37816;丯DK寮鍙?#38171;岄櫎浜?#38343;瀹夎?#21266;ndroidStudio2.2浠?#28051;婄殑鐗堟湰銆?#26473;樺緱瀹夎NDK銆?code>CMake銆?code>LLDB绛?#23480;?#37711;?#37510;?br />鍦ˋndroidStudio涓?#38315;?#37815;㏕ools->Android->SDK Manager->SDK Tools銆?#28641;?#37733;?#38171;?br />

杩?#38322;?#32480;鍗?#28000;?#32513;?#28051;?#38171;?br />NDK锛氭槸Android寮鍙?#37832;?#37734;癈/C++浠g爜?#27537;涓濂?#23480;?#37711;?#38342;?#37510;?br />CMake锛?#28051;濂?#29882;?#39582;?#37721;扮殑鏋勫缓宸?#37711;?#38171;?#37721;?#28000;radle鑴?#37832;?#38320;嶅?#22556;?#36328;敤鏉?#37835;勫缓浣犵殑鏈?#37734;?#25652;?#37510;?#37734;ˋndroidStudio涓?#38171;孏oogle榛?#29825;?#37724;屾帹?#23832;浣跨敤CMake杩涜缂?#29831;?#38171;屽綋?#21159;锛?#28003;?#28000;嶇劧鍙?#28000;?#32513;?#32513;?#28003;跨敤ndk-build鏉?#32514;?#29831;戜?#29365;殑鏈?#37734;?#28000;g爜銆傛敞鎰?#38171;?2浣嶇殑?#25655;浣滅郴缁?#37721;兘?#32048;瑁?#28051;?#28051;?#37510;?br />LLDB锛?涓绉嶈皟?#30255;鍣?#38171;孉ndroid Studio涓?#37721;?#28000;?#28003;跨敤瀹?#37833;ヨ皟?#30255;鏈?#37734;?#28000;g爜銆?/p>

2銆?鍒涘缓涓涓?#37824;?#37816;丆/C++?#27537;椤?#37929;?/span>

杩?#38322;?#37813;璇寸殑鍒涘缓涓涓?#37824;?#37816;丆/C++?#27537;椤?#37929;?#38171;?#37721;?#28000;ョ悊瑙?#28051;哄?#28056;缓涓涓狽DK椤?#37929;?#38171;?#28003;?#37721;堝寘鍚?#28051;?#32457;?#37826;?#23534;?#38171;屽?#21975;埆?#27128;浠庨浂寮濮嬫柊寤?#28051;涓?#37824;?#37816;丆/C++寮鍙戠殑椤?#37929;?#37724;?#37734;?#37720;?#37832;夐」鐩殑鍩?#32429;涓?#29825;?#28729;冩敮鎸丆/C++寮鍙?#37510;?#28051;?#38344;?#28725;?#26473;?#28051;?#32457;?#37826;?#23534;?#37714;嗗埆杩涜?#23683;鏄?#28051;?#37510;?/p>

2.1 鏂板缓椤?#37929;?/span>

濡?#37835;?#28729;夎?#21613;ソ浜?#38171;?#28051;?#38344;?#28000;?#32513;嶇殑鍑?#28051;?#23480;?#37711;?涓?#29781;佹槸NDK)锛屽苟涓擜ndroidStudio2.2浠?#28051;婄殑鐗堟湰锛?#37826;板缓椤?#37929;殑鏃跺?#38171;屼細鐪嬪埌杩?#28051;?#38315;夐」銆?#28641;?#37733;?#38171;?br />
鍒涘缓椤?#37929;?#37827;?#38171;屽嬀閫塁++鏀?#37816;?#37510;?/p>


椤?#37929;?#28051;?#37813;?#25956;?#27537;C++鏍囧噯鍙?#28000;?#38315;?#37815;?#27035;?#29825;?#37812;?#38000;呮敮鎸丆++11锛?#28000;?#37721;婃槸鍚?#37824;?#37816;?#23534;傚父鍜?code>rtti鐗?#37804;?#37510;?/p>


鍒涘缓瀹岄」鐩?#38171;屼細?#30254;涓鑸殑Android椤?#37929;?#28598;氬嚭cpp鐩?#35120;?#28000;?#37721;奀MakeLists.txt?#27537;鏂?#28000;?#37510;?/p>


杩?#38322;屾寚瀹歂DK?#27537;璺?#23536;?#37510;?#37719;?#38171;?#28051;?#38344;㈢幆澧冩惌寤?#38322;屽畨瑁呯殑ndk锛屼細涓?#26462;藉埌AndroidStudio鏍?#37929;?#35120;?#28051;嬬殑ndk-bundle鏂?#28000;?#28598;?#28051;?#37510;?/p>


make涓涓嬪綋鍓?#37826;?#37714;涘?#34425;殑宸?#32459;?#38171;岄粯璁や細鍦╞uild/cmake/debug/obj/涓?#37922;?#37812;愮浉搴旂殑鍔?#37804;佸簱銆?/p>

2.2 鎵?#28766;曠幇鏈夐」鐩?/span>

瑕?#29825;╃幇鏈夌殑Android椤?#37929;兘?#30367;?#25956;鏈?#37734;癈/C++浠g爜鎴?#38000;呮敮鎸丆/C++寮鍙?#38171;?#37721;?#38343;瑕?#37734;?#37720;熸潵椤?#37929;殑鍩?#32429;绋?#37716;?#28103;?#37824;?#37719;?#37721;?#37510;?#23005;?#26976;?#28641;?#28051;?#38171;?br />
鍒囨崲?#22476;project瑙?#37733;?#38171;?#37813;?#23534;module鍗?#28051;?#37733;剧殑app妯″潡锛?#37734;╯rc/main涓?#37721;?#38335;甆ew->Directory锛屽~?#21843;涓涓?#37826;?#28000;?#37722;?#38171;?#28186;嬪锛?code>cpp銆?/p>


鍦?#37714;氬?#34425;殑cpp璺?#23536;?#28051;?#38171;?#37721;?#38335;甆ew->C/C++ Source File锛岃緭鍏?#37826;?#28000;?#37722;?#38171;岃嫢瑕佷竴骞?#37922;?#37812;愮浉搴旂殑.h鏂?#28000;?#38171;屽嬀閫塁reate an associated header閫夐」鍗?#37721;?#37510;傛敞鎰?#38171;屽悗闈?#37721;?#28000;ユ寚瀹氭簮鏂?#28000;剁殑鍚?#32514;锛?#28186;嬪锛?code>.cxx,.hxx銆?/p>


鍦╩odule?#27537;鏍?#37929;?#35120;?#37719;?#28051;?#37733;剧殑app鏍?#37929;?#35120;?#38171;?#37721;?#38335;甆ew->File锛岃緭鍏?code>CMakeLists.txt銆傛敞鎰?#38171;?#37826;?#28000;?#37722;嶅繀椤?#28051;?strong>CMakeLists.txt


鍦╩odule?#27537;鏍?#37929;?#35120;?#37719;?#28051;?#37733;剧殑app鏍?#37929;?#35120;?#38171;岄?#37815;㎜ink C++ Project with Gradle锛岀劧鍚?#38171;?#37813;惧埌鍒氬?#28056;?#34425;殑CMakeLists.txt鏂?#28000;?#37510;?#28751;?code>CMakeLists.txt鍏宠?#26047;埌椤?#37929;?#28051;?#37510;傛敞鎰?#38171;孊uild System浠?#37721;?#28000;?#38315;?#37815;?code>ndk-build鏂?#23534;?#26473;涜缂?#29831;?#37510;?/p>

?#32139;?#21159;锛?#26473;欐?#25655;浣?#28052;?#37721;?#28000;?#37813;?#37716;?#28729;?#37812;?#38171;?#37929;稿綋浜?#37734;ㄥ綋鍓峬odule涓嬬殑build.gradle鑴?#37832;?#28051;?#38171;屾坊鍔?#27996;?#28641;?#28051;?#28000;g爜锛?/p>

XML/HTML浠g爜
  1. android {  
  2.     //?#23514;瀹?#28003;跨敤CMake缂?#29831;?---------------  
  3.     externalNativeBuild {  
  4.         cmake {  
  5.             path 'CMakeLists.txt'  
  6.         }  
  7.     }  
  8.     //--------------------------------  
  9. }   
鎵?#23534;鏂板?#34425;殑CMakeLists.txt鏂?#28000;?#38171;岃緭鍏?#28641;?#28051;?#28000;g爜锛?/pre>
XML/HTML浠g爜
  1. cmake_minimum_required (VERSION 3.4.1)  
  2.   
  3. add_library (hellojni SHARED src/main/cpp/hellojni.cpp)  
鍒嗗埆?#23514;瀹欳Make瑕佹眰?#27537;鐗堟湰锛宎dd_library涓?#37721;傛暟鍒嗗埆?#27128;锛屾寚瀹?#37922;?#37812;愬?#25782;殑鍚嶇О锛?#37922;?#37812;愬?#25782;殑绫诲瀷锛岄粯璁ゆ槸闈欐佸潡锛?#37719;?#38171;?code>·a锛屾?#24878;爜?#27537;璺?#23536;?#37510;?#26473;?#38322;屽疄渚?#37721;?#32480;鍗?#28000;?#32513;?#28051;婥Make?#27537;?#25956;?#30838;锛屽悗缁細鏈?#28051;?#38338;?#28051;?#30226;鏉?#28000;?#32513;?#28051;婥Make?#27967;澶?#26946;?#32510;х殑?#25956;?#30838;銆?/pre>

浠?#28051;?#28729;屾瘯锛?#37734;╩ake涓涓嬪綋鍓嶅伐绋?#38171;?#37812;?#38000;卹ebuild涓涓?#38171;?#28051;嶅?#28888;剰澶栦細鍦?code>build/intermediates/cmake/debug璺?#23536;?#28051;?#37922;?#37812;愬?#21229;libhellojni.so鏂?#28000;?#37510;?/p>

3銆丄ndroidStudio涓嶨radle

涓?#38344;?#37819;愬埌锛?#28751;咰MakeLists.txt鍏宠?#26047;埌椤?#37929;?#28051;?#38171;屼細鍦╞uild.gradle鑴?#37832;?#28051;?#38171;屾坊鍔?#28051;娈?#28000;g爜鍗?#37721;?#37510;?#37721;兘鍒氭帴瑙ndroidStudio(鐗?#37714;槸浣跨敤鍏?#28729;僆DE寮鍙戠殑锛?#28186;嬪锛歟clipse绛?瀵笹radle涓嶆槸寰堜?#21978;В锛?#26473;?#38322;?#28751;?#37814;?#37934;?#23534;?#37916;?#28051;?#38171;?#32480;瑕?#29825;?#26473;?#28051;媑radle鑴?#37832;殑浣跨敤銆?/p>

棣?#37711;?#38171;孉ndroidStudio?#27128;鍩轰簬IntelliJ IDEA?#27537;IDE锛?#37734;ˋndroidStudio涓?#37826;?#37714;涘?#34425;殑Android宸?#32459;?#38318;?#35120;?#28641;?#28641;?#28051;?#32513;?#37835;?#38171;?/p>

XML/HTML浠g爜
  1. MyApp    
  2. 鈹?#37433;鈹 build.gradle    
  3. 鈹?#37433;鈹 settings.gradle    
  4. 鈹?#37433;鈹 app    
  5.     鈹?#37433;鈹 build.gradle    
  6.     鈹?#37433;鈹 build    
  7.     鈹?#37433;鈹 libs    
  8.     鈹?#37433;鈹 src    
  9.         鈹?#37433;鈹 main    
  10.             鈹?#37433;鈹 java    
  11.             鈹?nbsp;  鈹?#37433;鈹 com.package.myapp    
  12.             鈹?#37433;鈹 res    
  13.                 鈹?#37433;鈹 drawable    
  14.                 鈹?#37433;鈹 layout    
  15.                 鈹?#37433;鈹 etc.    
MyApp?#27128;椤?#37929;?#37722;?#38171;宎pp?#27128;妯″潡鍚?#38171;?#28051;涓?#26916;?#37929;?#28051;?#37721;?#28000;?#37718;?#37722;嫢骞?#28051;?#22959;″潡銆?#26473;?#28051;巈clipse?#27537;缁?#37835;?#28051;嶅悓锛?#28725;?#25652;斿埌eclipse涓?#38171;宎pp灏?#37929;稿綋浜庨」鐩?#37722;?#38171;孧yApp鐩稿綋浜?#23480;?#28003;滅┖闂?#37510;?#37812;?#38000;呯被浼?#27996;嶸S涓?#29785;?#37712;?#37826;?#22935;堜?#24232;」鐩殑鍏崇郴銆?#28000;?#28051;?#37929;?#35120;?#32513;?#37835;?#37711;崇郴锛屽苟涓?#28051;?#28729;?#38340;呯鐩?#28051;婄殑鐩?#35120;?#32513;?#37835;?#28725;?#25652;?#37510;?#37721;?#28000;?#37930;嬪埌锛?#37734;?#26916;?#37929;?#37837;?#37929;?#35120;?#28051;?#28000;?#37721;?#22959;?#37735;楃洰褰?#28051;?#38171;屽?#21975;埆鏈?#28051;?#28051;?code>.gradle鏂?#28000;?#37510;?#28051;?#38344;?#38171;?#28751;?#37714;嗗埆浠?#32513;?#26473;?#28051;?#28051;猤radle鑴?#37832;殑?#25956;閫?#38171;屽綋?#21159;杩?#38322;?#28051;?#29781;佽?#23544;殑?#27128;鍦ˋndroidStudio涓嬬殑gradle?#27537;鐩?#37711;?#28003;跨敤銆?/pre>

鍦ˋndroidStudio涓璦ndroid椤?#37929;槸鍩轰簬gradle杩涜?#23678;?#21227;?#34425;殑(eclipse涓?#37721;?#28000;?#28003;跨敤ant鏉?#37707;?#32491;?#28028;肩殑宸?#28003;?锛?#38000;実radle?#27128;涓绉嶅?#36720;簬Groovy璇?#29815;?#27537;DSL(domain-specific language锛岄?#21975;煙涓撶敤璇?#29815;)锛?#38000;孏roovy鍙堟槸涓绉嶅?#36720;簬JVM?#27537;鍔?#37804;佽瑷銆?#37813;浠?#38171;?#37832;塲ava鍩?#32429;?#27537;?#30269;锛岀悊瑙roovy?#32048;?#27967;瀹?#37828;?#37510;?#37832;?#37711;矴radle鏂?#22935;?#37721;?#28000;?#37930;?#37930;?#26473;?#28051;?#38171;?a rel="nofollow" href="https://docs.gradle.org/current/dsl/" class="uri">https://docs.gradle.org/current/dsl/

3.1 project/build.gradle

璇uild.gradle浣嶄?#24232;」鐩殑鏍?#37929;?#35120;?#38171;岃鏂?#28000;舵槸瀹?#28052;?#37734;?#26473;?#28051;?#23480;?#32459;?#28051;嬬殑鎵鏈?#22959;?#37735;楃殑鍏?#37711;?#28766;?#37804;?#37510;?#27035;?#29825;?#28641;?#28051;?#38171;?/p>

XML/HTML浠g爜
  1. // Top-level build file where you can add configuration options common to all sub-projects/modules.  
  2.   
  3. buildscript {  
  4.     repositories {  
  5.         jcenter()  
  6.     }  
  7.     dependencies {  
  8.         classpath 'com.android.tools.build:gradle:2.2.3'  
  9.   
  10.         // NOTE: Do not place your application dependencies here; they belong  
  11.         // in the individual module build.gradle files  
  12.     }  
  13. }  
  14.   
  15. allprojects {  
  16.     repositories {  
  17.         jcenter()  
  18.     }  
  19. }  
  20.   
  21. task clean(type: Delete) {  
  22.     delete rootProject.buildDir  
  23. }  
浠?#28051;?#37721;槸浠?#29723;ㄨ薄璇?#37828;?#28051;?#38171;?#28003;?#28729;?#29840;ㄦ槸Groovy鐩?#25652;旂殑?#26271;鎹?#32513;?#37835;?闂?#37718;?#38171;孧ap绛??#30367;?#25956;鐩?#25652;?#37826;规硶鏉?#37716;?#37804;?#37818;у埗鏁?#28051;?#37835;勫缓杩囩▼銆?#37832;?#37711;矴roovy?#27537;璁?#29825;?#37721;?#28000;?#37930;?#37930;?a href="#as-module">3.3 module/build.gradle銆?br />buildscript锛?#28729;?#28052;変簡鍏?#28766;?#27537;鐩?#37711;?#28766;?#37804;?#37510;?br />repositories锛?#28729;?#28052;変簡杩?#32459;?#28000;撳?#25782;殑?#31790;锛?#37719;?#28000;?#29723;?#28003;犵殑渚?#29863;栧?#21615;殑鏉ユ簮銆?#26473;?#38322;?#28751;唈center()浣?#28051;?#28000;撳簱銆?br />dependencies锛?#28729;?#28052;変簡android gradle plugin?#27537;鐗堟湰銆?br />allprojects锛?#37721;?#28000;ョ敤鏉?#28729;?#28052;?#37722;?#28051;?#22959;?#37735;楃殑榛?#29825;?#28766;?#37804;?#38171;?#28003;?#37721;?#28000;?#28051;?#28000;?#28000;?#28766;闄?#27996;庨粯璁ょ殑閰嶇疆锛?#37832;?#37833;?#28003;?#37721;?#28000;ヨ嚜宸?#37714;?#38315;爐asks鍦╝llprojects鏂规硶浣撳唴锛?#26473;?#27996;泃asks灏嗕細鍦?#37813;鏈?#22959;″潡涓?#37721;?#29785;?#37510;?br />task clean锛?#37813;?#29723;?#37929;?#37711;崇殑娓呯悊浠?#37716;?#37510;?/pre>
3.2 project/settings.gradle

璇?#37826;?#28000;?#28003;嶄?#24232;」鐩?#37837;?#37929;?#35120;?#28051;?#38171;?#28052;熸槸椤?#37929;殑鍏?#28766;閰嶇疆鏂?#28000;?#38171;岃鏂?#28000;剁殑?#21812;瀹?#28641;?#28051;?#38171;?/p>

include ':app'

濡?#37835;?#38171;?#28003;犵殑椤?#37929;?#28051;?#37832;?#28598;?#28051;?#22959;?#37735;楁椂锛?#37721;?#28000;?#28186;濇娣?#37716;犲埌璇?#37826;?#28000;?#28051;?#37510;備?#23338;锛?/p>

include ':app',':librarys:Mylibrary'

鍗?#37734;?#26916;?#37929;?#37837;?#37929;?#35120;?#28051;嬬殑librarys鐩?#35120;?#38322;?#37832;?#28051;狹ylibrary搴?#23480;?#32459;?#37510;?/p>

3.3 module/build.gradle

璇?#37826;?#28000;?#28003;嶄?#24225;綋鍓?#22959;?#37735;楃殑鏍?#37929;?#35120;?#28051;?#38171;岄氬父?#20751;鍐?#28051;?#38171;岃鏂?#28000;?#37721;?#28725;瑰綋鍓?#22959;″潡璧?#28003;滅敤銆備?#23338;锛?/p>

XML/HTML浠g爜
  1. apply plugin: 'com.android.application'  
  2.   
  3. android {  
  4.     compileSdkVersion 24  
  5.     buildToolsVersion "24.0.2"  
  6.     defaultConfig {  
  7.         applicationId "com.alphagl.test"  
  8.         minSdkVersion 19  
  9.         targetSdkVersion 24  
  10.         versionCode 1  
  11.         versionName "1.0"  
  12.     }  
  13.     buildTypes {  
  14.         release {  
  15.             minifyEnabled false  
  16.             proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'  
  17.         }  
  18.     }  
  19.   
  20.     externalNativeBuild {  
  21.         cmake {  
  22.             path 'CMakeLists.txt'  
  23.         }  
  24.     }  
  25. }  
  26.   
  27. dependencies {  
  28.     compile fileTree(dir: 'libs', include: ['*.jar'])  
  29.     compile 'com.android.support:appcompat-v7:24.2.1'  
  30. }  
浠?#28051;婂唴瀹?#38171;岃?#20344;?#35826;簳寮勬?#21614;锛屽?#26945;繁绌?#28051;婫roovy璇硶銆?#26473;?#38322;?#38171;?#37721;?#23092;?#37835;?#28051;?#37510;?br />apply plugin: 'com.android.application'锛?#37734;℅roovy涓殑?#30367;?#25956;涓簆roject.apply([plugin: 'com.android.application'])锛?code>plugin: 'com.android.application?#32048;琚?#28003;?#28051;?#28051;涓狹ap鍙傛暟浼?#38315;?#32513;檃pply?#27537;鏂规硶銆?#26473;?#38322;屾槸瑕?#28751;嗚妯?#37735;楁?#21227;缓涓?#28051;涓?#25652;旂敤锛岃嫢瑕?#28751;嗘ā鍧楁?#21227;?#21700;?#25779;舰寮?#38171;?#37721;?#28000;?#28028;?#37721;?#28051;?code>plugin: 'com.android.library銆?/pre>

鍦℅roovy涓?#38010;?#37815;?#37721;峰寘鍚殑閮?#37714;嗙О涓?#28051;涓?#38338;?#37718;?Closure)銆?#28051;?#38344;㈢殑涓?#29781;佷袱閮ㄥ垎android鍜?strong>dependencies锛屽?#21975;埆瀵?#25652;攑roject涓殑鏂规硶锛?#38000;?#37721;傛暟?#27128;鐩?#25652;旂殑闂?#37718;呯粨鏋?#37510;?#38315;?#26473;?#28051;?#38344;㈢殑缁?#37835;?#38171;?#37721;?#28000;ョ煡閬?#29831;?#38338;?#37718;呯粨鏋?#26473;?#37832;夐棴鍖呭?#23677;鍜?#37929;?#25652;旂殑鏂规硶銆?br />android锛?#29831;?#37826;规硶鍖?#37722;?#27996;?#37813;鏈夌殑Android灞?#37804;?#38171;?#38000;屽敮涓蹇?#26916;诲寘鍚?#28766;?#37804;?#28051;篶ompileSdkVersion鍜宐uildToolsVersion銆?br />compileSdkVersion锛?#29831;?#37826;规硶鍖?#37722;?#32514;?#29831;戣app鏃跺?#38171;?#28003;跨敤?#22476;?#27537;api鐗堟湰銆?br />buildToolsVersion锛?#29831;?#37826;规硶鍖?#37722;?#37835;勫缓宸?#37711;风殑鐗堟湰鍙?#37510;?br />defaultConfig锛?#29831;?#37826;规硶鍖?#37722;玜pp?#27537;鏍?#36423;?#28766;?#37804;?#38171;岃灞?#37804;т細瑕嗙洊鍦ˋndroidManifest.xml涓殑瀵?#25652;?#28766;?#37804;?#37510;?br />applicationId锛?#29831;?#37826;规硶瀹?#28052;夌殑灞?#37804;т細瑕嗙洊AndroidManifest鏂?#28000;?#28051;殑鍖?#37722;峱ackage name灞?#37804;?#37510;?br />minSdkVersion锛?#29831;?#37826;规硶瀹?#28052;夌殑灞?#37804;?#29723;?#32448;?#37832;灏忔敮鎸乤pi鐗堟湰銆?#37722;孉ndroidManifest涓?#28725;?#25652;旂殑灞?#37804;?#37510;?br />targetSdkVersion锛?#29831;?#37826;规硶瀹?#28052;夌殑灞?#37804;?#29723;?#32448;虹洰鏍囧钩鍙癮pi鐗堟湰銆?#37722;孉ndroidManifest涓?#28725;?#25652;旂殑灞?#37804;?#37510;?br />buildTypes锛?#29831;?#37826;规硶瀹?#28052;変?#21976;?#21227;缓涓嶅悓鐗堟湰?#27537;app鐩?#37711;崇殑灞?#37804;?#37510;?br />release锛氶?#23943;疆release鐗堟湰鐩?#37711;崇殑灞?#37804;?#37510;?br />minifyEnabled锛氭槸鍚?#26473;涜?#23678;?#38155;穯銆?br />proguardFiles锛?#28729;?#28052;夋?#38155;穯鏂?#28000;剁殑浣嶇疆銆?#38315;?#26473;噂etDefaultProguardFile鏂规硶鑾?#37721;?#37510;?br />externalNativeBuild锛歯ative浣跨敤cmake缂?#29831;?#37510;?br />dependencies锛歡radle榛?#29825;ょ殑灞?#37804;?#28052;?#28051;锛屽畾涔変簡鎵鏈夌殑渚?#29863;栧寘銆?br />compile锛?#32514;?#29831;戠浉搴?#28186;?#29863;栫殑jar鍖?#37510;?#32513;?#32513;?#37722;?#38171;屽寘鍚?#38171;?#37911;堟湰鍙风殑缁?#37835;?#37510;?/p>

浠?#28051;?#37721;?#32480;鍗曠殑鍒?#28051;?#27996;?#28051;?#38318;ㄥ垎灞?#37804;?#38171;?#28725;筭radle鑴?#37832;?#37832;?#37714;濇?#27537;浜嗚В銆傚綋?#21159;锛孏roovy鍦╦ava棰嗗煙杩樻槸鏈?#23536;?#28598;氬?#26050;敤?#27537;銆傛劅鍏磋叮?#27537;锛?#37721;?#28000;ユ繁鍏?#27996;嗚В涓?#37510;?/p>

Groovy鏂?#22935;?#38171;?br />Groovy-Documentation


浣?#38000;?#38171;欰lphaGL
鍑?#28598;?#38171;歨ttp://www.cnblogs.com/alphagl/

]]>Android?#29238;鎴?#23534;鍙?/category>http://www.ojizl5.fun/android/game/708.html#commenthttp://www.ojizl5.fun/android/http://www.ojizl5.fun/android/feed.asp?cmt=708http://www.ojizl5.fun/android/cmd.asp?act=tb&id=708&key=6a7cad7c 江西时时彩三星和