/*********************************************************************** * I.MX6 Ethernet UI patch failed * 说明: * 最近想要在I.MX6的Android上添加Ethernet UI界面,但是使用NXP提供的 * patch,结果失败了。 * * 2016-4-21 深圳 南山平山村 曾剑锋 **********************************************************************/ 一、参考文档: 1. How to Add Ethernet UI Support in ICS https://community.freescale.com/docs/DOC-93626 2. Couldn't parse API file “frameworks/base/api/current.txt” http://*.com/questions/14622020/couldnt-parse-api-file-frameworks-base-api-current-txt 二、Introduction If you want to add Ethernet UI support , you need manually apply the attached patches in this file which is based on Android ICS and i.MX6. About what the patches do, here is some comments: 1. framework/base-----0001-ENGR00220371-Ethernet-add-support-for-ethernet.patch By default, Android has no support for Ethernet UI. So if you want to add Ethernet UI , add Ethernet state tracker & Ethernet service & Ethernet manager & Ethernet monitor like WiFi. Meanwhile we need add Ethernet display support in status bar. Here this patch can solve it. 2. Build---0001-ENGR00220371-Ethernet-add-ethernet-support.patch add package directory compile. 3. packages\apps\Settings---0001-ENGR00220371-Ethernet-add-app-UI-in-setting.patch add UI logic in setting app. 4. packages\providers\DownloadProvider---0001-ENGR00220371-Ethernet-add-downloadinfo.patch add ConnectivityManager.TYPE_ETHERNET type support in download provider’s DownloadInfo. 三、decompress: zengjf@zengjf:~/myandroid$ unzip imx6-ics-ethernet-v3.zip Archive: imx6-ics-ethernet-v3.zip inflating: build/0001-ENGR00220371-Ethernet-add-ethernet-support.patch creating: Frameworks/ creating: Frameworks/base/ inflating: Frameworks/base/0001-enhance-ethernet-handling-thanks-to-Android-x86-proj.patch inflating: packages/apps/Settings/0001-Adds-Ethernet-Settings-Android-x86-patch.patch inflating: packages/providers/DownloadProvider/0001-Adds-Ethernet-support-for-Freescale-platform.patch zengjf@zengjf:~/myandroid$ cp Frameworks/base/0001-enhance-ethernet-handling-thanks-to-Android-x86-proj.patch frameworks/base/ 四、patch: 1. 0001-ENGR00220371-Ethernet-add-ethernet-support.patch zengjf@zengjf:~/myandroid/build$ patch -p1 < 0001-ENGR00220371-Ethernet-add-ethernet-support.patch patching file core/pathmap.mk Hunk #1 succeeded at 94 (offset 7 lines). 2. 0001-Adds-Ethernet-Settings-Android-x86-patch.patch zengjf@zengjf:~/myandroid/packages/apps/Settings$ patch -p1 < 0001-Adds-Ethernet-Settings-Android-x86-patch.patch patching file AndroidManifest.xml Hunk #1 succeeded at 133 (offset 45 lines). patching file proguard.flags Hunk #1 FAILED at 11. 1 out of 1 hunk FAILED -- saving rejects to file proguard.flags.rej patching file res/drawable/ic_settings_ethernet.xml patching file res/layout/eth_configure.xml patching file res/values/strings.xml Hunk #1 succeeded at 1237 with fuzz 2 (offset 85 lines). patching file res/xml/ethernet_settings.xml patching file res/xml/settings_headers.xml Hunk #1 succeeded at 58 with fuzz 2 (offset 1 line). patching file src/com/android/settings/ethernet/EthernetConfigDialog.java patching file src/com/android/settings/ethernet/EthernetEnabler.java patching file src/com/android/settings/ethernet/EthernetLayer.java patching file src/com/android/settings/ethernet/EthernetSettings.java 3. 0001-Adds-Ethernet-support-for-Freescale-platform.patch zengjf@zengjf:~/myandroid/packages/providers/DownloadProvider$ patch -p1 < 0001-Adds-Ethernet-support-for-Freescale-platform.patch patching file src/com/android/providers/downloads/DownloadInfo.java Hunk #1 succeeded at 424 with fuzz 2 (offset 6 lines). Hunk #2 succeeded at 443 (offset 6 lines). 4. 0001-enhance-ethernet-handling-thanks-to-Android-x86-proj.patch zengjf@zengjf:~/myandroid/frameworks/base$ patch -p1 < 0001-enhance-ethernet-handling-thanks-to-Android-x86-proj.patch patching file Android.mk Hunk #1 FAILED at 197. 1 out of 1 hunk FAILED -- saving rejects to file Android.mk.rej patching file api/current.txt Hunk #1 succeeded at 3352 (offset 154 lines). Hunk #2 succeeded at 5439 with fuzz 2 (offset 328 lines). Hunk #3 succeeded at 12937 (offset 946 lines). Hunk #4 FAILED at 17632. 1 out of 4 hunks FAILED -- saving rejects to file api/current.txt.rej patching file core/java/android/app/ContextImpl.java Hunk #1 succeeded at 74 (offset 13 lines). Hunk #2 succeeded at 520 with fuzz 1 (offset 62 lines). patching file core/java/android/app/DownloadManager.java Hunk #1 succeeded at 351 with fuzz 2 (offset 10 lines). patching file core/java/android/content/Context.java Hunk #1 succeeded at 1838 (offset 377 lines). patching file core/java/android/net/EthernetDataTracker.java Hunk #1 FAILED at 139. 1 out of 1 hunk FAILED -- saving rejects to file core/java/android/net/EthernetDataTracker.java.rej patching file core/java/android/provider/Settings.java Hunk #1 FAILED at 3220. 1 out of 1 hunk FAILED -- saving rejects to file core/java/android/provider/Settings.java.rej patching file core/jni/Android.mk Hunk #1 succeeded at 76 with fuzz 2 (offset 2 lines). patching file core/jni/AndroidRuntime.cpp Hunk #1 succeeded at 146 with fuzz 1. Hunk #2 FAILED at 1160. 1 out of 2 hunks FAILED -- saving rejects to file core/jni/AndroidRuntime.cpp.rej patching file core/jni/android_net_ethernet.cpp patching file core/res/res/values/config.xml Hunk #1 succeeded at 34 (offset -1 lines). Hunk #2 succeeded at 146 (offset 30 lines). Hunk #3 succeeded at 169 (offset 30 lines). patching file ethernet/java/android/net/ethernet/EthernetDevInfo.aidl patching file ethernet/java/android/net/ethernet/EthernetDevInfo.java patching file ethernet/java/android/net/ethernet/EthernetManager.java patching file ethernet/java/android/net/ethernet/EthernetMonitor.java patching file ethernet/java/android/net/ethernet/EthernetNative.java patching file ethernet/java/android/net/ethernet/EthernetStateTracker.java patching file ethernet/java/android/net/ethernet/IEthernetManager.aidl patching file packages/SystemUI/res/layout/signal_cluster_view.xml patching file packages/SystemUI/res/values/strings.xml Hunk #1 succeeded at 413 (offset 66 lines). patching file packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java Hunk #1 FAILED at 41. Hunk #2 succeeded at 75 (offset 1 line). Hunk #3 succeeded at 92 (offset 2 lines). Hunk #4 FAILED at 110. Hunk #5 FAILED at 144. 3 out of 5 hunks FAILED -- saving rejects to file packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java.rej patching file packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java Hunk #1 succeeded at 26 (offset -5 lines). Hunk #2 succeeded at 60 (offset -3 lines). Hunk #4 succeeded at 115 (offset 1 line). Hunk #5 succeeded at 154 (offset 6 lines). Hunk #6 succeeded at 169 (offset 9 lines). Hunk #7 succeeded at 185 with fuzz 1 (offset 9 lines). Hunk #8 succeeded at 210 (offset 18 lines). Hunk #9 succeeded at 250 with fuzz 2 (offset 18 lines). Hunk #10 succeeded at 296 (offset 26 lines). Hunk #11 succeeded at 347 (offset 36 lines). Hunk #12 succeeded at 432 (offset 63 lines). Hunk #13 succeeded at 938 (offset 96 lines). Hunk #14 succeeded at 1025 (offset 108 lines). Hunk #15 succeeded at 1067 with fuzz 2 (offset 111 lines). Hunk #16 succeeded at 1081 with fuzz 1 (offset 113 lines). Hunk #17 succeeded at 1153 (offset 115 lines). Hunk #18 FAILED at 1090. Hunk #19 succeeded at 1237 (offset 127 lines). Hunk #20 FAILED at 1125. Hunk #21 succeeded at 1325 (offset 142 lines). Hunk #22 succeeded at 1356 (offset 142 lines). Hunk #23 succeeded at 1375 (offset 142 lines). Hunk #24 succeeded at 1452 with fuzz 1 (offset 154 lines). Hunk #25 succeeded at 1550 (offset 166 lines). 2 out of 25 hunks FAILED -- saving rejects to file packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java.rej patching file packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java Hunk #1 succeeded at 272 (offset 38 lines). patching file services/java/com/android/server/ConnectivityService.java Hunk #1 succeeded at 68 (offset 14 lines). Hunk #2 succeeded at 449 (offset 34 lines). Hunk #3 FAILED at 511. 1 out of 3 hunks FAILED -- saving rejects to file services/java/com/android/server/ConnectivityService.java.rej patching file services/java/com/android/server/EthernetService.java zengjf@zengjf:~/myandroid/frameworks/base$ 五、manual for patch Faileds: 1. 以下是打补丁出现问题的部分,需要手动打补丁。 2. 1 out of 1 hunk FAILED -- saving rejects to file proguard.flags.rej 1. cat packages/apps/Settings/proguard.flags.rej --- proguard.flags +++ proguard.flags @@ -11,4 +11,4 @@ -keep class com.android.settings.MasterClearConfirm -keep class com.android.settings.accounts.* -keep class com.android.settings.fuelgauge.* - +-keep class com.android.settings.ethernet.* 3. 1 out of 1 hunk FAILED -- saving rejects to file Android.mk.rej 1. cat framework/base/Android.mk.rej --- Android.mk +++ Android.mk @@ -197,6 +197,7 @@ telephony/java/com/android/internal/telephony/IWapPushManager.aidl \ wifi/java/android/net/wifi/IWifiManager.aidl \ wifi/java/android/net/wifi/p2p/IWifiP2pManager.aidl \ + ethernet/java/android/net/ethernet/IEthernetManager.aidl \ telephony/java/com/android/internal/telephony/IExtendedNetworkService.aidl \ voip/java/android/net/sip/ISipSession.aidl \ voip/java/android/net/sip/ISipSessionListener.aidl \ 4. 1 out of 4 hunks FAILED -- saving rejects to file api/current.txt.rej 1. cat framework/base/api/current.txt.rej --- api/current.txt +++ api/current.txt @@ -17632,6 +17758,14 @@ field public static final java.lang.String DEVICE_PROVISIONED = "device_provisioned"; field public static final java.lang.String ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_ser vices"; field public static final java.lang.String ENABLED_INPUT_METHODS = "enabled_input_methods"; + field public static final java.lang.String ETHERNET_CONF = "ethernet_conf"; + field public static final java.lang.String ETHERNET_DNS = "ethernet_dns"; + field public static final java.lang.String ETHERNET_IFNAME = "ethernet_ifname"; + field public static final java.lang.String ETHERNET_IP = "ethernet_ip"; + field public static final java.lang.String ETHERNET_MASK = "ethernet_netmask"; + field public static final java.lang.String ETHERNET_MODE = "ethernet_mode"; + field public static final java.lang.String ETHERNET_ON = "ethernet_on"; + field public static final java.lang.String ETHERNET_ROUTE = "ethernet_iproute"; field public static final java.lang.String HTTP_PROXY = "http_proxy"; field public static final java.lang.String INPUT_METHOD_SELECTOR_VISIBILITY = "input_method_selector_v isibility"; field public static final java.lang.String INSTALL_NON_MARKET_APPS = "install_non_market_apps"; 5. 1 out of 1 hunk FAILED -- saving rejects to file core/java/android/net/EthernetDataTracker.java.rej 1. cat framework/base/core/java/android/net/EthernetDataTracker.java.rej --- core/java/android/net/EthernetDataTracker.java +++ core/java/android/net/EthernetDataTracker.java @@ -139,20 +139,18 @@ mNetworkInfo.setIsAvailable(false); mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, null); - Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); - msg.sendToTarget(); - - msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); + Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); msg.sendToTarget(); - if (mClearIp){ - IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); - INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); - try { - service.clearInterfaceAddresses(mIface); - } catch (Exception e) { - Log.e(TAG, "Failed to clear addresses or disable ip" + e); - } - } + + if (mClearIp){ + IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); + INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); + try { + service.clearInterfaceAddresses(mIface); + } catch (Exception e) { + Log.e(TAG, "Failed to clear addresses or disable ip" + e); + } + } } private void interfaceRemoved(String iface) { 6. 1 out of 1 hunk FAILED -- saving rejects to file core/java/android/provider/Settings.java.rej 1. cat frameworks/base/core/java/android/provider/Settings.java.rej --- core/java/android/provider/Settings.java +++ core/java/android/provider/Settings.java @@ -3220,6 +3220,18 @@ "wifi_mobile_data_transition_wakelock_timeout_ms"; /** + * Ethernet related configurations + */ + public static final String ETHERNET_ON = "ethernet_on"; + public static final String ETHERNET_MODE = "ethernet_mode"; + public static final String ETHERNET_IP = "ethernet_ip"; + public static final String ETHERNET_MASK = "ethernet_netmask"; + public static final String ETHERNET_DNS = "ethernet_dns"; + public static final String ETHERNET_ROUTE = "ethernet_iproute"; + public static final String ETHERNET_CONF = "ethernet_conf"; + public static final String ETHERNET_IFNAME = "ethernet_ifname"; + + /** * Whether background data usage is allowed by the user. See * ConnectivityManager for more info. */ 7. 1 out of 2 hunks FAILED -- saving rejects to file core/jni/AndroidRuntime.cpp.rej 1. cat framework/base/core/jni/AndroidRuntime.cpp.rej --- core/jni/AndroidRuntime.cpp +++ core/jni/AndroidRuntime.cpp @@ -1160,6 +1161,7 @@ REG_JNI(register_android_net_NetworkUtils), REG_JNI(register_android_net_TrafficStats), REG_JNI(register_android_net_wifi_WifiManager), + REG_JNI(register_android_net_ethernet_EthernetManager), REG_JNI(register_android_nfc_NdefMessage), REG_JNI(register_android_nfc_NdefRecord), REG_JNI(register_android_os_MemoryFile), 8. 3 out of 5 hunks FAILED -- saving rejects to file packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java.rej 1. cat framework/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java.rej --- packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java +++ packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java @@ -41,13 +41,15 @@ private boolean mWifiVisible = false; private int mWifiStrengthId = 0, mWifiActivityId = 0; + private boolean mEthernetVisible = false; + private int mEthernetId = 0; private boolean mMobileVisible = false; private int mMobileStrengthId = 0, mMobileActivityId = 0, mMobileTypeId = 0; private boolean mIsAirplaneMode = false; - private String mWifiDescription, mMobileDescription, mMobileTypeDescription; + private String mWifiDescription, mEthernetDescription, mMobileDescription, mMobileTypeDescription; - ViewGroup mWifiGroup, mMobileGroup; - ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType; + ViewGroup mWifiGroup, mEthernetGroup, mMobileGroup; + ImageView mWifi, mEthernet, mMobile, mWifiActivity, mMobileActivity, mMobileType; View mSpacer; public SignalClusterView(Context context) { @@ -110,6 +116,15 @@ apply(); } + public void setEthernetIndicators(boolean visible, int statusIcon, + String contentDescription) { + mEthernetVisible = visible; + mEthernetId = statusIcon; + mEthernetDescription = contentDescription; + + apply(); + } + public void setMobileDataIndicators(boolean visible, int strengthIcon, int activityIcon, int typeIcon, String contentDescription, String typeContentDescription) { mMobileVisible = visible; @@ -144,6 +159,14 @@ (mWifiVisible ? "VISIBLE" : "GONE"), mWifiStrengthId, mWifiActivityId)); + if (mEthernetVisible) { + mEthernetGroup.setVisibility(View.VISIBLE); + mEthernet.setImageResource(mEthernetId); + mEthernetGroup.setContentDescription(mEthernetDescription); + } else { + mEthernetGroup.setVisibility(View.GONE); + } + if (mMobileVisible) { mMobileGroup.setVisibility(View.VISIBLE); mMobile.setImageResource(mMobileStrengthId); 9. 2 out of 25 hunks FAILED -- saving rejects to file packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java.rej 1. cat framework/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java.rej --- packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java +++ packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java @@ -1090,7 +1163,7 @@ combinedSignalIconId = mDataSignalIconId; } } EthernetService.java:116: cannot find symbol symbol : variable ETHERNET_IP - else if (!mDataConnected && !mWifiConnected && !mBluetoothTethered && !mWimaxConnected) { + else if (!mDataConnected && !mWifiConnected && !mEthernetConnected && !mBluetoothTethered && !mWimaxConnected) { // pretty much totally disconnected combinedLabel = context.getString(R.string.status_bar_settings_signal_meter_disconnected); @@ -1125,12 +1199,14 @@ + " mDataSignalIconId=0x" + Integer.toHexString(mDataSignalIconId) + " mDataTypeIconId=0x" + Integer.toHexString(mDataTypeIconId) + " mWifiIconId=0x" + Integer.toHexString(mWifiIconId) + + " mEthernetIconId=0x" + Integer.toHexString(mEthernetIconId) + " mBluetoothTetherIconId=0x" + Integer.toHexString(mBluetoothTetherIconId)); } if (mLastPhoneSignalIconId != mPhoneSignalIconId || mLastDataDirectionOverlayIconId != combinedActivityIconId || mLastWifiIconId != mWifiIconId + || mLastEthernetIconId != mEthernetIconId || mLastWimaxIconId != mWimaxIconId || mLastDataTypeIconId != mDataTypeIconId) { 10. 1 out of 3 hunks FAILED -- saving rejects to file services/java/com/android/server/ConnectivityService.java.rej 1. cat framework/base/services/java/com/android/server/ConnectivityService.java.rej --- services/java/com/android/server/ConnectivityService.java +++ services/java/com/android/server/ConnectivityService.java @@ -511,8 +512,14 @@ } break; case ConnectivityManager.TYPE_ETHERNET: - mNetTrackers[netType] = EthernetDataTracker.getInstance(); - mNetTrackers[netType].startMonitoring(context, mHandler); + //mNetTrackers[netType] = EthernetDataTracker.getInstance(); + //mNetTrackers[netType].startMonitoring(context, mHandler); + if (DBG) log("Starting Ethernet Service."); + EthernetStateTracker est = new EthernetStateTracker(context, mHandler); + EthernetService ethService = new EthernetService(context, est); + ServiceManager.addService(Context.ETHERNET_SERVICE, ethService); + mNetTrackers[ConnectivityManager.TYPE_ETHERNET] = est; + est.startMonitoring(context, mHandler); break; default: loge("Trying to create a DataStateTracker for an unknown radio type " + 2. 实际修改: case TYPE_WIMAX: return makeWimaxStateTracker(mContext, mTrackerHandler); case TYPE_ETHERNET: //mNetTrackers[netType] = EthernetDataTracker.getInstance(); //mNetTrackers[netType].startMonitoring(context, mHandler); if (DBG) log("Starting Ethernet Service."); EthernetStateTracker est = new EthernetStateTracker(mContext, mTrackerHandler); EthernetService ethService = new EthernetService(mContext, est); ServiceManager.addService(Context.ETHERNET_SERVICE, ethService); //mNetTrackers[ConnectivityManager.TYPE_ETHERNET] = est; est.startMonitoring(mContext, mTrackerHandler); //return EthernetDataTracker.getInstance(); return est; 六、error: 1. error1: 1. 现象: frameworks/base/core/res/res/values/config.xml:1029: Originally defined here. frameworks/base/core/res/res/values/config.xml.orig:1027: error: Resource entry config_notificationFallbackVibePattern already has bag item ^index_2. frameworks/base/core/res/res/values/config.xml:1030: Originally defined here. frameworks/base/core/res/res/values/config.xml.orig:1028: error: Resource entry config_notificationFallbackVibePattern already has bag item ^index_3. frameworks/base/core/res/res/values/config.xml:1031: Originally defined here. frameworks/base/core/res/res/values/config.xml.orig:1032: error: Resource entry config_speed_up_audio_on_mt_calls is already defined. frameworks/base/core/res/res/values/config.xml:1035: Originally defined here. make: *** [out/target/common/obj/APPS/framework-res_intermediates/package-export.apk] Error 1 make: *** Deleting file `out/target/common/obj/APPS/framework-res_intermediates/package-export.apk' 2. 解决办法: zengjf@zengjf:~/myandroid/frameworks/base/core/res/res/values$ rm config.xml.orig 2. error2: 1. 现象: ...... uct/sabresd_6dq/system/etc/permissions/android.software.live_wallpaper.xml' build/core/base_rules.mk:502: warning: ignoring old commands for target `out/target/product/sabresd_6dq/system/etc/permissions/android.software.live_wallpaper.xml' No private recovery resources for TARGET_DEVICE sabresd_6dq target Java: framework (out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes) frameworks/base/core/java/android/net/EthernetDataTracker.java:167: cannot find symbol symbol : variable mClearIp location: class android.net.EthernetDataTracker if (mClearIp){ ^ frameworks/base/ethernet/java/android/net/ethernet/EthernetStateTracker.java:66: android.net.ethernet.EthernetStateTracker is not abstract and does not override abstract method captivePortalCheckComplete() in android.net.NetworkStateTracker public class EthernetStateTracker extends Handler implements NetworkStateTracker { ^ frameworks/base/ethernet/java/android/net/ethernet/EthernetStateTracker.java:210: cannot find symbol symbol : variable addr location: class android.net.InterfaceConfiguration ifcfg.addr = mDhcpInfo.makeLinkAddress(); ^ frameworks/base/ethernet/java/android/net/ethernet/EthernetStateTracker.java:211: cannot find symbol symbol : variable interfaceFlags location: class android.net.InterfaceConfiguration ifcfg.interfaceFlags = "[up]"; ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 4 errors 2. 解决办法: 1. cat frameworks/base/core/java/android/net/EthernetDataTracker.java ...... public class EthernetDataTracker implements NetworkStateTracker { ...... public void disconnect() { NetworkUtils.stopDhcp(mIface); mLinkProperties.clear(); mNetworkInfo.setIsAvailable(false); mNetworkInfo.setDetailedState(DetailedState.DISCONNECTED, null, mHwAddr); //Message msg = mCsHandler.obtainMessage(EVENT_CONFIGURATION_CHANGED, mNetworkInfo); //msg.sendToTarget(); //msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); Message msg = mCsHandler.obtainMessage(EVENT_STATE_CHANGED, mNetworkInfo); msg.sendToTarget(); if (!mNfsmode) { IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); try { service.clearInterfaceAddresses(mIface); } catch (Exception e) { Log.e(TAG, "Failed to clear addresses or disable ipv6" + e); } } /* if (mClearIp){ IBinder b = ServiceManager.getService(Context.NETWORKMANAGEMENT_SERVICE); INetworkManagementService service = INetworkManagementService.Stub.asInterface(b); try { service.clearInterfaceAddresses(mIface); } catch (Exception e) { Log.e(TAG, "Failed to clear addresses or disable ip" + e); } } */ } ...... } 2. cat frameworks/base/ethernet/java/android/net/ethernet/EthernetStateTracker.java ...... public class EthernetStateTracker extends Handler implements NetworkStateTracker { ...... @Override public void captivePortalCheckComplete() { } ...... private boolean configureInterface(EthernetDevInfo info) throws UnknownHostException { ...... try { ifcfg = mNwService.getInterfaceConfig(info.getIfName()); //ifcfg.mAddr = mDhcpInfo.makeLinkAddress(); ifcfg.setLinkAddress(mDhcpInfo.makeLinkAddress()); //ifcfg.interfaceFlags = "[up]"; ifcfg.setFlag("[up]"); mNwService.setInterfaceConfig(info.getIfName(), ifcfg); Slog.i(TAG,"Static IP configuration succeeded"); } catch (RemoteException re){ ...... } ...... } 3. error3: 1. 现象: Docs droiddoc: out/target/common/docs/api-stubs DroidDoc took 14 sec. to write docs to out/target/common/docs/api-stubs Copy: apicheck (out/host/linux-x86/obj/EXECUTABLES/apicheck_intermediates/apicheck) Install: out/host/linux-x86/bin/apicheck Checking API: checkapi-last Checking API: checkapi-current frameworks/base/api/current.txt:19000: error 10: Removed field android.provider.Settings.Secure.ETHERNET_CONF frameworks/base/api/current.txt:19001: error 10: Removed field android.provider.Settings.Secure.ETHERNET_DNS frameworks/base/api/current.txt:19002: error 10: Removed field android.provider.Settings.Secure.ETHERNET_IFNAME frameworks/base/api/current.txt:19003: error 10: Removed field android.provider.Settings.Secure.ETHERNET_IP frameworks/base/api/current.txt:19004: error 10: Removed field android.provider.Settings.Secure.ETHERNET_MASK frameworks/base/api/current.txt:19005: error 10: Removed field android.provider.Settings.Secure.ETHERNET_MODE frameworks/base/api/current.txt:19006: error 10: Removed field android.provider.Settings.Secure.ETHERNET_ON frameworks/base/api/current.txt:19007: error 10: Removed field android.provider.Settings.Secure.ETHERNET_ROUTE out/target/common/obj/PACKAGING/public_api.txt:18870: error 5: Added public field android.provider.Settings.Global.ETHERNET_CONF out/target/common/obj/PACKAGING/public_api.txt:18871: error 5: Added public field android.provider.Settings.Global.ETHERNET_DNS out/target/common/obj/PACKAGING/public_api.txt:18872: error 5: Added public field android.provider.Settings.Global.ETHERNET_IFNAME out/target/common/obj/PACKAGING/public_api.txt:18873: error 5: Added public field android.provider.Settings.Global.ETHERNET_IP out/target/common/obj/PACKAGING/public_api.txt:18874: error 5: Added public field android.provider.Settings.Global.ETHERNET_MASK out/target/common/obj/PACKAGING/public_api.txt:18875: error 5: Added public field android.provider.Settings.Global.ETHERNET_MODE out/target/common/obj/PACKAGING/public_api.txt:18876: error 5: Added public field android.provider.Settings.Global.ETHERNET_ON out/target/common/obj/PACKAGING/public_api.txt:18877: error 5: Added public field android.provider.Settings.Global.ETHERNET_ROUTE ****************************** You have tried to change the API from what has been previously approved. To make these errors go away, you have two choices: 1) You can add "@hide" javadoc comments to the methods, etc. listed in the errors above. 2) You can update current.txt by executing the following command: make update-api To submit the revised current.txt to the main Android repository, you will need approval. ****************************** make: *** [out/target/common/obj/PACKAGING/checkapi-current-timestamp] Error 38 2. 解决办法: make update-api 4. error4: 1. 现象: target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_net_wifi_Wifi.cpp target thumb C++: libandroid_runtime <= frameworks/base/core/jni/android_net_ethernet.cpp In file included from frameworks/base/core/jni/android_net_ethernet.cpp:27:0: bionic/libc/kernel/common/linux/netlink.h:52:2: error: 'sa_family_t' does not name a type frameworks/base/core/jni/android_net_ethernet.cpp: In function '_jstring* android::android_net_ethernet_waitForEvent(JNIEnv*, jobject)': frameworks/base/core/jni/android_net_ethernet.cpp:97:49: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:122:49: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] frameworks/base/core/jni/android_net_ethernet.cpp: In function 'int android::netlink_send_dump_request(int, int, int)': frameworks/base/core/jni/android_net_ethernet.cpp:176:13: error: 'struct sockaddr_nl' has no member named 'nl_family' frameworks/base/core/jni/android_net_ethernet.cpp: In function 'void android::free_int_list()': frameworks/base/core/jni/android_net_ethernet.cpp:209:47: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp: In function 'int android::netlink_init_interfaces_list()': frameworks/base/core/jni/android_net_ethernet.cpp:254:53: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:258:58: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:264:67: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:270:74: error: 'LOGI' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp: In function 'jint android::android_net_ethernet_initEthernetNative(JNIEnv*, jobject)': frameworks/base/core/jni/android_net_ethernet.cpp:290:27: error: 'LOGI' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:292:18: error: 'struct sockaddr_nl' has no member named 'nl_family' frameworks/base/core/jni/android_net_ethernet.cpp:294:19: error: 'struct sockaddr_nl' has no member named 'nl_family' frameworks/base/core/jni/android_net_ethernet.cpp:303:53: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:308:54: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:314:54: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:321:75: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:327:54: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp:330:52: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp: In function '_jstring* android::android_net_ethernet_getInterfaceName(JNIEnv*, jobject, jint)': frameworks/base/core/jni/android_net_ethernet.cpp:349:56: error: 'LOGE' was not declared in this scope frameworks/base/core/jni/android_net_ethernet.cpp: In function 'int android::register_android_net_ethernet_EthernetManager(JNIEnv*)': frameworks/base/core/jni/android_net_ethernet.cpp:385:42: error: 'LOGI' was not declared in this scope make: *** [out/target/product/sabresd_6dq/obj/SHARED_LIBRARIES/libandroid_runtime_intermediates/android_net_ethernet.o] Error 1 2. 参考文档: 1. error: 'LOGE' was not declared in this scope http://blog.csdn.net/yasin_lee/article/details/8668797 2. Android4.0.3/Android4.2.2 添加 Ethernet http://blog.csdn.net/qinyun188/article/details/7991093 3. 解决方法: 1. 将frameworks/base/core/jni/android_net_ethernet.cpp中的LOGE、LOGI宏前面加上A。 2. cat bionic/libc/kernel/common/linux/socket.h ...... typedef unsigned short sa_family_t; ...... 5. error5: 1. 类似错误现象: PRODUCT_COPY_FILES frameworks/base/data/sounds/ringtones/ogg/Scarabaeus.ogg:system/media/audio/ringtones/Scarabaeus.ogg ignored. PRODUCT_COPY_FILES frameworks/base/data/sounds/ringtones/ogg/Solarium.ogg:system/media/audio/ringtones/Solarium.ogg ignored. build/core/Makefile:32: warning: overriding commands for target `out/target/product/sabresd_6dq/system/etc/permissions/android.software.live_wallpaper.xml' build/core/base_rules.mk:502: warning: ignoring old commands for target `out/target/product/sabresd_6dq/system/etc/permissions/android.software.live_wallpaper.xml' No private recovery resources for TARGET_DEVICE sabresd_6dq target Java: framework (out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes) frameworks/base/core/java/android/provider/Settings.java:925: cannot find symbol symbol : variable ETHERNET_ON location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_ON); ^ frameworks/base/core/java/android/provider/Settings.java:926: cannot find symbol symbol : variable ETHERNET_MODE location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_MODE); ^ frameworks/base/core/java/android/provider/Settings.java:927: cannot find symbol symbol : variable ETHERNET_IP location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_IP); ^ frameworks/base/core/java/android/provider/Settings.java:928: cannot find symbol symbol : variable ETHERNET_MASK location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_MASK); ^ frameworks/base/core/java/android/provider/Settings.java:929: cannot find symbol symbol : variable ETHERNET_DNS location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_DNS); ^ frameworks/base/core/java/android/provider/Settings.java:930: cannot find symbol symbol : variable ETHERNET_ROUTE location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_ROUTE); ^ frameworks/base/core/java/android/provider/Settings.java:931: cannot find symbol symbol : variable ETHERNET_CONF location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_CONF); ^ frameworks/base/core/java/android/provider/Settings.java:932: cannot find symbol symbol : variable ETHERNET_IFNAME location: class android.provider.Settings.Secure MOVED_TO_SECURE.add(Secure.ETHERNET_IFNAME); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 8 errors make: *** [out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes-full-debug.jar] Error 41 2. 这是由于手动打补丁的静态变量位置打错了造成的,变量没有打在class Secure类里面,打到class system里去了。 3. 修改正打补丁的位置就解决了。 6. error6: 1. 现象: Generating ScriptField_FragmentShaderConstants_s.java ... #@ out/host/linux-x86/bin/llvm-rs-link # out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/src/renderscript/res/raw/*.bc target Java: android-common-carousel (out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/classes) Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Copying: out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/classes-jarjar.jar Copying: out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/emma_out/lib/classes-jarjar.jar Copying: out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/classes.jar target Static Jar: android-common-carousel (out/target/common/obj/JAVA_LIBRARIES/android-common-carousel_intermediates/javalib.jar) target Java: SystemUI (out/target/common/obj/APPS/SystemUI_intermediates/classes) frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:124: cannot find symbol symbol : variable connect_established location: class com.android.systemui.R.drawable R.drawable.connect_established, ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:125: cannot find symbol symbol : variable connect_no location: class com.android.systemui.R.drawable R.drawable.connect_no, ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:126: cannot find symbol symbol : variable connect_creating location: class com.android.systemui.R.drawable R.drawable.connect_creating ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:944: cannot find symbol symbol : variable stat_sys_ethernet_connected location: class com.android.systemui.R.drawable mEthernetIconId = R.drawable.stat_sys_ethernet_connected; ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:946: cannot find symbol symbol : variable stat_sys_ethernet_disconnected location: class com.android.systemui.R.drawable mEthernetIconId = R.drawable.stat_sys_ethernet_disconnected; ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java:90: cannot find symbol symbol : variable mAirplane location: class com.android.systemui.statusbar.SignalClusterView mAirplane = (ImageView) findViewById(R.id.airplane); ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java:107: cannot find symbol symbol : variable mAirplane location: class com.android.systemui.statusbar.SignalClusterView mAirplane = null; ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java:201: cannot find symbol symbol : variable mAirplane location: class com.android.systemui.statusbar.SignalClusterView mAirplane.setVisibility(View.VISIBLE); ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java:202: cannot find symbol symbol : variable mAirplane location: class com.android.systemui.statusbar.SignalClusterView mAirplane.setImageResource(mAirplaneIconId); ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java:204: cannot find symbol symbol : variable mAirplane location: class com.android.systemui.statusbar.SignalClusterView mAirplane.setVisibility(View.GONE); ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 10 errors make: *** [out/target/common/obj/APPS/SystemUI_intermediates/classes-full-debug.jar] Error 41 zengjf@zengjf:~/myandroid$ 2. frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java ...... //ViewGroup mWifiGroup, mMobileGroup; //ImageView mWifi, mMobile, mWifiActivity, mMobileActivity, mMobileType, mAirplane; //ViewGroup mWifiGroup, mEthernetGroup, mMobileGroup; //ImageView mWifi, mEthernet, mMobile, mWifiActivity, mMobileActivity, mMobileType; ViewGroup mWifiGroup, mEthernetGroup, mMobileGroup; ImageView mWifi, mEthernet, mMobile, mWifiActivity, mMobileActivity, mMobileType, mAirplane; View mSpacer; ...... 7. error7: 1. 现象: target Java: SystemUI (out/target/common/obj/APPS/SystemUI_intermediates/classes) frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:124: cannot find symbol symbol : variable connect_established location: class com.android.systemui.R.drawable R.drawable.connect_established, ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:125: cannot find symbol symbol : variable connect_no location: class com.android.systemui.R.drawable R.drawable.connect_no, ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:126: cannot find symbol symbol : variable connect_creating location: class com.android.systemui.R.drawable R.drawable.connect_creating ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:944: cannot find symbol symbol : variable stat_sys_ethernet_connected location: class com.android.systemui.R.drawable mEthernetIconId = R.drawable.stat_sys_ethernet_connected; ^ frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java:946: cannot find symbol symbol : variable stat_sys_ethernet_disconnected location: class com.android.systemui.R.drawable mEthernetIconId = R.drawable.stat_sys_ethernet_disconnected; ^ Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 5 errors make: *** [out/target/common/obj/APPS/SystemUI_intermediates/classes-full-debug.jar] Error 41 zengjf@zengjf:~/myandroid$ 2. 原因: patch的时候,没有生成图片文件,目前不知道怎么去生成,所只能自己加入图片了; 3. 参考文档: 1. https://gitorious.org/rowboat/frameworks-base/commit/2ac2e1bfdbed5b4895c2302b1f88b7de65ae99a0 core/java/android/net/EthernetDataTracker.java packages/SystemUI/res/drawable-hdpi/stat_sys_ethernet_connected.png packages/SystemUI/res/drawable-hdpi/stat_sys_ethernet_disconnected.png packages/SystemUI/res/drawable-mdpi/stat_sys_ethernet_connected.png packages/SystemUI/res/drawable-mdpi/stat_sys_ethernet_disconnected.png packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_ethernet_connected.png packages/SystemUI/res/drawable-sw600dp-hdpi/stat_sys_ethernet_disconnected.png packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_ethernet_connected.png packages/SystemUI/res/drawable-sw600dp-mdpi/stat_sys_ethernet_disconnected.png packages/SystemUI/res/drawable-sw600dp-xhdpi/stat_sys_ethernet_connected.png packages/SystemUI/res/drawable-sw600dp-xhdpi/stat_sys_ethernet_disconnected.png packages/SystemUI/res/drawable-xhdpi/stat_sys_ethernet_connected.png packages/SystemUI/res/drawable-xhdpi/stat_sys_ethernet_disconnected.png packages/SystemUI/res/layout/signal_cluster_view.xml packages/SystemUI/src/com/android/systemui/statusbar/SignalClusterView.java packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java packages/SystemUI/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java 2. https://gitorious.org/rowboat/frameworks-base/commit/e1e6a3e55275860dc3234ffe5996a002f8391531 Android.mk api/current.txt core/java/android/app/ContextImpl.java core/java/android/app/DownloadManager.java core/java/android/content/Context.java core/java/android/provider/Settings.java core/jni/Android.mk core/jni/AndroidRuntime.cpp core/jni/android_net_ethernet.cpp core/res/res/values/config.xml ethernet/java/android/net/ethernet/EthernetDevInfo.aidl ethernet/java/android/net/ethernet/EthernetDevInfo.java ethernet/java/android/net/ethernet/EthernetManager.java ethernet/java/android/net/ethernet/EthernetMonitor.java ethernet/java/android/net/ethernet/EthernetNative.java ethernet/java/android/net/ethernet/EthernetStateTracker.java ethernet/java/android/net/ethernet/IEthernetManager.aidl packages/SystemUI/res/drawable-hdpi/connect_creating.png packages/SystemUI/res/drawable-hdpi/connect_established.png packages/SystemUI/res/drawable-hdpi/connect_no.png packages/SystemUI/res/drawable-mdpi/connect_creating.png packages/SystemUI/res/drawable-mdpi/connect_established.png packages/SystemUI/res/drawable-mdpi/connect_no.png packages/SystemUI/src/com/android/systemui/statusbar/policy/NetworkController.java services/java/com/android/server/ConnectivityService.java services/java/com/android/server/EthernetService.java 4. 解决办法: 拷贝对应缺少的文件到对应的目录 8. error8: 1. 现象: target thumb C: hostapd_cli <= external/wpa_supplicant_8/hostapd/src/utils/eloop.c target thumb C: hostapd_cli <= external/wpa_supplicant_8/hostapd/src/utils/wpa_debug.c target thumb C: hostapd_cli <= external/wpa_supplicant_8/hostapd/src/utils/edit_simple.c target Executable: hostapd_cli (out/target/product/sabresd_6dq/obj/EXECUTABLES/hostapd_cli_intermediates/LINKED/hostapd_cli) target Symbolic: hostapd_cli (out/target/product/sabresd_6dq/symbols/system/bin/hostapd_cli) Export includes file: external/wpa_supplicant_8/hostapd/Android.mk -- out/target/product/sabresd_6dq/obj/EXECUTABLES/hostapd_cli_intermediates/export_includes target Strip: hostapd_cli (out/target/product/sabresd_6dq/obj/EXECUTABLES/hostapd_cli_intermediates/hostapd_cli) Install: out/target/product/sabresd_6dq/system/bin/hostapd_cli Export includes file: external/i2c-tools/Android.mk -- out/target/product/sabresd_6dq/obj/STATIC_LIBRARIES/i2c-tools_intermediates/export_includes Import includes file: out/target/product/sabresd_6dq/obj/EXECUTABLES/i2cdetect_intermediates/import_includes target thumb C: i2cdetect <= external/i2c-tools/tools/i2cdetect.c Import includes file: out/target/product/sabresd_6dq/obj/STATIC_LIBRARIES/i2c-tools_intermediates/import_includes target thumb C: i2c-tools <= external/i2c-tools/tools/util.c target thumb C: i2c-tools <= external/i2c-tools/tools/i2cbusses.c target StaticLib: i2c-tools (out/target/product/sabresd_6dq/obj/STATIC_LIBRARIES/i2c-tools_intermediates/i2c-tools.a) target Executable: i2cdetect (out/target/product/sabresd_6dq/obj/EXECUTABLES/i2cdetect_intermediates/LINKED/i2cdetect) /home/zengjf/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: out/target/product/sabresd_6dq/obj/EXECUTABLES/i2cdetect_intermediates/tools/i2cdetect.o: in function main:external/i2c-tools/tools/i2cdetect.c:105: error: undefined reference to 'i2c_smbus_write_quick' /home/zengjf/myandroid/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.6/bin/../lib/gcc/arm-linux-androideabi/4.6.x-google/../../../../arm-linux-androideabi/bin/ld: out/target/product/sabresd_6dq/obj/EXECUTABLES/i2cdetect_intermediates/tools/i2cdetect.o: in function main:external/i2c-tools/tools/i2cdetect.c:111: error: undefined reference to 'i2c_smbus_read_byte' collect2: ld returned 1 exit status make: *** [out/target/product/sabresd_6dq/obj/EXECUTABLES/i2cdetect_intermediates/LINKED/i2cdetect] Error 1 zengjf@zengjf:~/myandroid$ ls 2. 原因是找不到lib/smbus.c 3. 解决办法: # external/i2c-tools/Android.mk LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE_TAGS := eng LOCAL_C_INCLUDES += $(LOCAL_PATH) $(LOCAL_PATH)/$(KERNEL_DIR)/include # 问题主要是在lib/smbus.c文件需要加入该文件。 LOCAL_SRC_FILES :=tools/util.c tools/i2cbusses.c lib/smbus.c LOCAL_MODULE := i2c-tools include $(BUILD_STATIC_LIBRARY) ...... 9. error9: 1. 现象: 01-01 00:10:02.190: E/AndroidRuntime(4195): FATAL EXCEPTION: main 01-01 00:10:02.190: E/AndroidRuntime(4195): java.lang.*Error 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.obtainAttributes(Resources.java:1381) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:117) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.loadDrawable(Resources.java:1950) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources.getDrawable(Resources.java:660) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:885) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.graphics.drawable.Drawable.createFromXml(Drawable.java:822) 01-01 00:10:02.190: E/AndroidRuntime(4195): at android.content.res.Resources 2. 错误原因: 未找到。