Error
[2013-11-22 15:34:58 - group] Installation failed due to invalid APK file!
[2013-11-22 15:34:58 - group] Please check logcat output for more details.
[2013-11-22 15:34:58 - group] Launch canceled!
[2013-11-22 16:02:45 - group] The library 'xxxx.jar' contains native libraries that will not run on the device.
[2013-11-22 16:02:45 - group] The following libraries were found:
[2013-11-22 16:02:45 - group] - assets/xxxx.so
Solution
jar library 中不能包含 .so 檔
可放入 project assets/
* Reference
http://www.v-key.com/solutions/v-guard/
http://www.cnblogs.com/mengshu-lbq/archive/2011/11/19/2255566.html
2013年12月8日 星期日
2013年9月19日 星期四
[Android] Zygote, Dalvik and JVM
Android 系統開啟時 由 init.rc 來啟動外部程式
其中 Zygote 是 Android 的 monitor process,負責:
1. Listening Socket (Forking child process, 執行 Android 應用程式)
2. Preload Resource
3. Preload Class
4. Start System Server
5. Enter Zygote Fork Mode
「System Server」是由 Zygote 所建立的另外一個 process
「Zygote Mode」: 在 socket 做 listening,並依據命令來 fork() 並執行外部 Android 應用程式。
Dalvik VM Class preloading
* Reference
- Jollen 的 Android 觀念解析, #1: Zygote Mode
- Dalvik VM 與 JVM 差異比較:Zygote 與 Class Preload
其中 Zygote 是 Android 的 monitor process,負責:
1. Listening Socket (Forking child process, 執行 Android 應用程式)
2. Preload Resource
3. Preload Class
4. Start System Server
5. Enter Zygote Fork Mode
「System Server」是由 Zygote 所建立的另外一個 process
- 建立的方式是使用典型的 Linux system call - fork()。
- 當 Zygote 成功建立 system server 後,便進入 socket listening 模式。在此模式下,zygote 會監聽(listen)由 socket 所傳入的「命令」,並依據命令的內容啟動 Android 應用程式。
「Zygote Mode」: 在 socket 做 listening,並依據命令來 fork() 並執行外部 Android 應用程式。
Dalvik VM Class preloading
- 與 JVM 最大的不同是,Dalvik VM 透過 Zygote 進行「Class Preloading」,是 Dalvik VM 最重要的特色之一。
- 意思是,把絕大部份的「Java class file」載入記憶體。
- Java class file 被打包成 *.jar 檔,Java class file 就是 Java library,提供 Android 應用程式與框架所需的 API。
- 所載入的 class file,幾乎包含所有的 API,當然,大部份自已都用不到,因此稱之為「preload」,也就是「預載」。
- 透過 preload,讓 Android 應用程式在載入時,不需要重覆「class loading」的動作,除了加快應用程式啟動速度外,也達到許多效果。
- 在 Android 裝置開機時進行,可能產生的不良效應之一就是「開機變慢」,不過,已經有一些方法可以解決這個問題。
* Reference
- Jollen 的 Android 觀念解析, #1: Zygote Mode
- Dalvik VM 與 JVM 差異比較:Zygote 與 Class Preload
2013年9月2日 星期一
[Android] The key must be an application-specific resource id.
Error
E/AndroidRuntime(15393): java.lang.IllegalArgumentException: The key must be an application-specific resource id.
Solution
新增 id resource
使用此 resource 作為 key 以確定為 unique.
E/AndroidRuntime(15393): java.lang.IllegalArgumentException: The key must be an application-specific resource id.
Solution
新增 id resource
使用此 resource 作為 key 以確定為 unique.
2013年8月25日 星期日
[Android] Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Error Message
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Solution
在 local 設定 external build path 使用 library xxxx
並在 AndroidManifest.xml 宣告
<uses-library android:name="xxxx">
使用系統上共用的 library.
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
Solution
在 local 設定 external build path 使用 library xxxx
並在 AndroidManifest.xml 宣告
<uses-library android:name="xxxx">
使用系統上共用的 library.
2012年12月1日 星期六
[AndroidLayout] status selector
<item android:state_selected="true" android:state_pressed="true"></item>
selector status 的判斷 是在行為發生時生效
若想維持該狀態下的設定
可藉 APIs
button.setEnabled(true);
button.setSelected(false);
設定 widgets 的狀態 以固定 selector 中的對應結果
selector status 的判斷 是在行為發生時生效
若想維持該狀態下的設定
可藉 APIs
button.setEnabled(true);
button.setSelected(false);
設定 widgets 的狀態 以固定 selector 中的對應結果
2012年8月25日 星期六
[Android] MSISDN, ICCID, IMEI, IMSI
下列值在以下情況會被改變或是取不到正確值:
Related
MSISDN, ICCID, IMEI, IMSI
- ICCID
- 換了 SIM card
- IMEI
- 山寨機
- ANDROID_ID
- 恢復原廠設定
Related
MSISDN, ICCID, IMEI, IMSI
2012年5月13日 星期日
[Android] The way to parser xml - SAX
Parser XML 可以用以下 API 達成:
SAX
DefaultHandler 執行方式:
* Reference
- android解析xml文件的方式(其二) - 东子哥 - 博客园
- 使用SAXParser取得XML文件里的属性值 - XML - AJava
- Android RSS解析步骤 | 易网联信
- SAX之:SAXParserFactory与SAXParser - 小文字 - 博客园
- SAX
- Digester
SAX
- Simple API for XML。
- 實作方式:
- extends DefaultHandler。
- new SAXParserFactory 。
- SAXParserFactory sAXParserFactory = SAXParserFactory.newInstance();
- new SAXParser:
- SAXParser sAXParser = sAXParserFactory.newSAXParser();
- 從 SAXParser 中得到一個 XMLReader 的實例:
- XMLReader xMLReader = sAXParser.getXMLReader();
- Set Handler 到 XMLReader
- xMLReader.setContentHandler(rssParser);
- 藉 InputStream 取得 XML,用 handler 進行 parser。
- xMLReader.parse(is);
DefaultHandler 執行方式:
- startDocument()
- 適合建立儲存物的集合 (ex: list)。
- startElement(String namespaceURI, String localName, String qName, Attributes atts)
- 解析過程中,遇到 XML 中的 tag 時,此 method 會被呼叫,可以由 localName 得知解析到那個 element 了。
- 可以適當的建立相對物件。
- attributes.getValue(NAME)
- characters(char ch[], int start, int length)
- 在執行 startElement() 後,此 method 會被呼叫,参数 ch[] 就是 element 中所帶的内容。
- endElement(String namespaceURI, String localName, String qName)
- endDocument()
* Reference
- android解析xml文件的方式(其二) - 东子哥 - 博客园
- 使用SAXParser取得XML文件里的属性值 - XML - AJava
- Android RSS解析步骤 | 易网联信
- SAX之:SAXParserFactory与SAXParser - 小文字 - 博客园
2012年3月25日 星期日
[Android] Log
The order in terms of verbosity, from least to most is ERROR, WARN, INFO, DEBUG, VERBOSE.
* Reference
- Log | Android Developers
- Verbose should never be compiled into an application except during development.
- Debug logs are compiled in but stripped at runtime.
- Error, warning and info logs are always kept.
- When you're building the string to pass into Log.d, the compiler uses a StringBuilder and at least three allocations occur:
- the StringBuilder itself
- the buffer
- the String object.
- Realistically, there is also another buffer allocation and copy, and even more pressure on the gc.
- That means that if your log message is filtered out, you might be doing significant work and incurring significant overhead.
* Reference
- Log | Android Developers
2011年11月10日 星期四
[Android] Other app types
android 除了主要的四元件(activity, broadcastReceiver, service, content provider)
從這四元件所延伸的應用,有些可被歸類的項目
從這四元件所延伸的應用,有些可被歸類的項目
- Widget: BroadcastReceiver
- Live wallpaper: Service (Supported from API 7)
- Input: Service
2011年10月30日 星期日
[Android] A glance at Android 4.0 features.
* 在 android 4.0 主要是整合了手機與平板上的開發,因此在 4.0 中,在 UI 上可以看融合了 3.0 的設計。
* 在幾篇文章介紹中,認為主要改變可分為:
以上不是所有功能,詳細內容可參考以下 references。
* Reference
- Android4.0 SDK新功能详解 ****
- Galaxy Nexus 和 Android Ice Cream Sandwich 報導大集合
- Android 4.0 Ice Cream Sandwich 正式發表!
- Android 4.0 發表 新功能、新介面搶先看 ***
- Android 4.0 (Ice Cream Sandwich)正式發表, 主要新功能簡介 - 小丰子俱樂部 - Yahoo!奇摩部落格 **
- Samsung Galaxy Nexus / Google Android ICS 發表會重點整理
- Android 4.0的那些新玩意們 **
- Android 4.0 Platform ****
* 在幾篇文章介紹中,認為主要改變可分為:
- UI: 加入了 tablet 上的元素
- Lasted Recently Used - LRU 的顯示方與 3.0 相同,是縮圖。
- Resize widget - 可直接改變桌面上 widget 的大小。(Supported in Android 3.1)
- Quick Unlock/incoming Call - 有螢幕鎖時來電,可直接選擇接/不接/以簡訊回覆。
- Action Bar - Home 底下新增個常用 app 的 action bar。(Supported in Android 3.0)
- User behaviour and new functions: 對於 user 使用習慣加強與新增功能
- New
- App Management - 可直接從 app 選擇要對它的操作,ex: 捷徑、解安裝...。
- Folder in Home - 在桌面上,可直接拉 app 疊在一起,即是變成是在同一個資料中。
- Face detection - 臉部偵測,可用於解鎖。
- Data Usage - (new) 可看到手機網路資訊傳輸量統計;可設定 threshold 通知。
- Blue Health Devices - for 健康管理功能。
- Accessibility - 輔助視障用戶操作。
- Enhance
- Notification - 可在不解鎖的狀況下查看; 用 swipe 方式關閉通知...。
- Browser - 可開 16 個 tab、Sync bookmarks with Chrome...
- Input - 在輸入時可做拼字檢查。
- Calendar(read/write) - 可對 google calendar 做更多操作。
- Camera - 快速拍照、全景拍攝、編輯圖片....。
- Photo(Gallery)
- Share(Social Activities): 結合社群功能
- Contact(ME, status update...) - 新增 "ME" profile;與 facebook 等社群訊息整合。
- Android Beam(NFC) - 利用 NFC 新增此功能,讓兩台 device 能更容易的分享。
以上不是所有功能,詳細內容可參考以下 references。
* Reference
- Android4.0 SDK新功能详解 ****
- Galaxy Nexus 和 Android Ice Cream Sandwich 報導大集合
- Android 4.0 Ice Cream Sandwich 正式發表!
- Android 4.0 發表 新功能、新介面搶先看 ***
- Android 4.0 (Ice Cream Sandwich)正式發表, 主要新功能簡介 - 小丰子俱樂部 - Yahoo!奇摩部落格 **
- Samsung Galaxy Nexus / Google Android ICS 發表會重點整理
- Android 4.0的那些新玩意們 **
- Android 4.0 Platform ****
[Android] SyncException: Too many open files
Error Message
尚不知道在什麼情況下會發生
com.android.ddmlib.SyncException: Too many open files Switch DEBUG USB off and on again. It works for me. It seems to be some sort of problem with USB sync when debuggin in my device. Essentially, that means you have a memory problem. More than likely it is a leak. First restart your phone and verify you are still getting the error. If so you are going to need to start digging in your code and find out where you are leaking! Need more help? Post some code!
尚不知道在什麼情況下會發生
2011年9月14日 星期三
[Android] Android Framework
Android Framework
* Reference
- Multiple phone web-based application framework
- Android 開發教學筆記 - 使用 PhoneGap、jQuery Mobile 與台北市政府開放資料(Open Data)
- appinventor
- LWUIT
- Titanium
- PhoneGap
* Reference
- Multiple phone web-based application framework
- Android 開發教學筆記 - 使用 PhoneGap、jQuery Mobile 與台北市政府開放資料(Open Data)
2011年9月8日 星期四
[Android] INSTALL_FAILED_CONTAINER_ERROR
* Solutions:
- 將 android:installLocation="preferExternal" 改為 "auto"
- Remove smdl2tmp1.asec, through adb or mount SD card to delete it.
* Reference
- android Installation error: INSTALL_FAILED_CONTAINER_ERROR
- Application install Failed due to INSTALL_FAILED_CONTAINER_ERROR
- What does this mean: Failure [INSTALL_FAILED_CONTAINER_ERROR]?
- 安装到SD卡失败,install-failed-container-error !
- 將 android:installLocation="preferExternal" 改為 "auto"
- Remove smdl2tmp1.asec, through adb or mount SD card to delete it.
adb shell su rm /mnt/secure/asec/smdl2tmp1.asec
* Reference
- android Installation error: INSTALL_FAILED_CONTAINER_ERROR
- Application install Failed due to INSTALL_FAILED_CONTAINER_ERROR
- What does this mean: Failure [INSTALL_FAILED_CONTAINER_ERROR]?
- 安装到SD卡失败,install-failed-container-error !
2011年9月4日 星期日
[Android] INSTALL_FAILED_INSUFFICIENT_STORAGE error
* Error
- message:
* Solution
* Reference
- Solution: Android INSTALL_FAILED_INSUFFICIENT_STORAGE error - Stack Overflow *
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE - Android 问题&解答 - eoe·Android开发者门户 - Powered by Discuz!
- message:
Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE Please check logcat output for more details. Launch canceled!- It happens regardless of app size, or how much storage is available.
* Solution
- 先移除再重新安裝,可解決,但可能還是會再發生相同問題。
- If your test device is running Android 2.2 or later then add the android:installLocation attribute to your application's manifest file, with the value "preferExternal". This will force the app to be installed on the device's external storage, such as a phone's SD card.
- assets內過大的資源放在(載到)SD card,再重SD card 讀取。
- process internal memory default is 16M,可改變 RUNTIME_HEAP_MAX 的大小:
// 尚未試過以下這方法 #ifdef CUSTOM_RUNTIME_HEAP_MAX #define __make_max_heap_opt(val) #val #define _make_max_heap_opt(val) "-Xmx" __make_max_heap_opt(val) opt.optionString = _make_max_heap_opt(CUSTOM_RUNTIME_HEAP_MAX); #undef __make_max_heap_opt #undef _make_max_heap_opt #else /* limit memory use to 16MB */ opt.optionString = "-Xmx16m"; #endif mOptions.add(opt);
* Reference
- Solution: Android INSTALL_FAILED_INSUFFICIENT_STORAGE error - Stack Overflow *
- Installation error: INSTALL_FAILED_INSUFFICIENT_STORAGE - Android 问题&解答 - eoe·Android开发者门户 - Powered by Discuz!
2011年9月3日 星期六
[Android] ANDROID_ID
* Definition
- A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)
- 第一次啟動 Android 設備時隨機生成的64位數(以十六進制字符串表示), "應在"保持設備一生不變的. (當設備執行重置出廠值時, 該值可能改變.)
* from level 3
* How to get?
- Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
- but you will get "null" on emulator.
* Is it unique for each Device?
Update on 20111106
* Reference
- Settings.Secure | Android Developers
- 獲取 Android 設備的 ID,Settings.Secure.ANDROID_ID
- A 64-bit number (as a hex string) that is randomly generated on the device's first boot and should remain constant for the lifetime of the device. (The value may change if a factory reset is performed on the device.)
- 第一次啟動 Android 設備時隨機生成的64位數(以十六進制字符串表示), "應在"保持設備一生不變的. (當設備執行重置出廠值時, 該值可能改變.)
* from level 3
* How to get?
- Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
- but you will get "null" on emulator.
* Is it unique for each Device?
Update on 20111106
- 透過設定中的選項恢復原廠設定後,ANDROID_ID 仍是相同。
- 若是更新系統,是否仍會相同?
- 重新刷ROM的話,是否仍會相同?
* Reference
- Settings.Secure | Android Developers
- 獲取 Android 設備的 ID,Settings.Secure.ANDROID_ID
2011年7月23日 星期六
[Android] Device screen size
Mobile screen size depend on LCD size
xLarge: 七吋(不含)以上
* Reference
- Android Developers Blog: New Tools For Managing Screen Sizes
xLarge: 七吋(不含)以上
* Reference
- Android Developers Blog: New Tools For Managing Screen Sizes
2011年5月28日 星期六
[Android] Notices
* 手機預設是會隨手機方向轉向,轉向後會使 activity 會重啟,所有狀態會回到初使值。
* dialog 字數會影響 dialog size in version 1.5 and 1.6 (?)
* Reference
- Android Screen Orientation Behavior
* dialog 字數會影響 dialog size in version 1.5 and 1.6 (?)
* Reference
- Android Screen Orientation Behavior
2011年4月7日 星期四
訂閱:
文章 (Atom)