安装Titanium过程地址:
在Titanium Studio 中SDK的升级:
Help---> Install titanium sdk from url ---->添加SDK的URL--->确定
所有的SDK的URL列表:
2.0的完整路径为:
http://builds.appcelerator.com.s3.amazonaws.com/mobile/2_0_X/mobilesdk-2.0.2.v20120418121806-win32.zip
1 >.OperationalError: Could not decode to UTF-8 column 'pat 解决不能安装APP到android虚拟机的问题 .
I made a mistake for the name of a file, i used non-american letter. After that i get an error like;
[ERROR] Exception occured while building Android project: [ERROR] Traceback (most recent call last): [ERROR] File "C:\Users\Guray\AppData\Roaming\Titanium\mobilesdk\win32\1.7.5\android\builder.py", line 1971, in <module> [ERROR] s.build_and_run(False, avd_id, debugger_host=debugger_host) [ERROR] File "C:\Users\Guray\AppData\Roaming\Titanium\mobilesdk\win32\1.7.5\android\builder.py", line 1705, in build_and_run [ERROR] self.copy_project_resources() [ERROR] File "C:\Users\Guray\AppData\Roaming\Titanium\mobilesdk\win32\1.7.5\android\builder.py", line 574, in copy_project_resources [ERROR] self.project_deltas = self.project_deltafy.scan() [ERROR] File "C:\Users\Guray\AppData\Roaming\Titanium\mobilesdk\win32\1.7.5\android\deltafy.py", line 167, in scan [ERROR] for path in self.get_paths(): [ERROR] File "C:\Users\Guray\AppData\Roaming\Titanium\mobilesdk\win32\1.7.5\android\deltafy.py", line 141, in get_paths [ERROR] rows = c.fetchall() [ERROR] OperationalError: Could not decode to UTF-8 column 'path' with text 'C:\Users\Guray\My Documents\Titanium Studio Workspace\AVMGenel\Resources\Examples\katplan?.js'
After that i deleted project from my computer, from my account and i re-install titanium. However i still get same error. What can i do to get over that problem??
-
原因:Titanium缓存原因。
在工程中存在有中文的文件,比如校长的一个中文名字的DOC文档,
在安装APP到android虚拟机的时候就会在控制台输出一段代码:[ERROR] OperationalError: Could not decode to UTF-8 column 'path' with text
导致不能安装到虚拟机,在网上找了解决方法
1.请到以下地址
C:\Users\ 当前登录用户\.deltafy或者C:\Documents and Settings\当前登录用户\.deltafy
2.删除deltas文件
3. 删除之后再重新发布到虚拟机即可
所有的INTENT列表
android.intent.action.ALL_APPS
android.intent.action.ANSWER
android.intent.action.ATTACH_DATA
android.intent.action.BUG_REPORT
android.intent.action.CALL
android.intent.action.CALL_BUTTON
android.intent.action.CHOOSER
android.intent.action.CREATE_LIVE_FOLDER
android.intent.action.CREATE_SHORTCUT
android.intent.action.DELETE
android.intent.action.DIAL
android.intent.action.EDIT
android.intent.action.GET_CONTENT
android.intent.action.INSERT
android.intent.action.INSERT_OR_EDIT
android.intent.action.MAIN
android.intent.action.MEDIA_SEARCH
android.intent.action.PICK
android.intent.action.PICK_ACTIVITY
android.intent.action.RINGTONE_PICKER
android.intent.action.RUN
android.intent.action.SEARCH
android.intent.action.SEARCH_LONG_PRESS
android.intent.action.SEND
android.intent.action.SENDTO
android.intent.action.SET_WALLPAPER
android.intent.action.SYNC
android.intent.action.SYSTEM_TUTORIAL
android.intent.action.VIEW
android.intent.action.VOICE_COMMAND
android.intent.action.WEB_SEARCH
android.net.wifi.PICK_WIFI_NETWORK
android.settings.AIRPLANE_MODE_SETTINGS
android.settings.APN_SETTINGS
android.settings.APPLICATION_DEVELOPMENT_SETTINGS
android.settings.APPLICATION_SETTINGS
android.settings.BLUETOOTH_SETTINGS
android.settings.DATA_ROAMING_SETTINGS
android.settings.DATE_SETTINGS
android.settings.DISPLAY_SETTINGS
android.settings.INPUT_METHOD_SETTINGS
android.settings.INTERNAL_STORAGE_SETTINGS
android.settings.LOCALE_SETTINGS
android.settings.LOCATION_SOURCE_SETTINGS
android.settings.MANAGE_APPLICATIONS_SETTINGS
android.settings.MEMORY_CARD_SETTINGS
android.settings.NETWORK_OPERATOR_SETTINGS
android.settings.QUICK_LAUNCH_SETTINGS
android.settings.SECURITY_SETTINGS
android.settings.SETTINGS
android.settings.SOUND_SETTINGS
android.settings.SYNC_SETTINGS
android.settings.USER_DICTIONARY_SETTINGS
android.settings.WIFI_IP_SETTINGS
android.settings.WIFI_SETTINGS
android.settings.WIRELESS_SETTINGS
android.bluetooth.a2dp.intent.action.SINK_STATE_CHANGED
android.bluetooth.intent.action.BLUETOOTH_STATE_CHANGED
android.bluetooth.intent.action.BOND_STATE_CHANGED_ACTION
android.bluetooth.intent.action.DISCOVERY_COMPLETED
android.bluetooth.intent.action.DISCOVERY_STARTED
android.bluetooth.intent.action.HEADSET_ADUIO_STATE_CHANGED
android.bluetooth.intent.action.HEADSET_STATE_CHANGED
android.bluetooth.intent.action.NAME_CHANGED
android.bluetooth.intent.action.PAIRING_CANCEL
android.bluetooth.intent.action.PAIRING_REQUEST
android.bluetooth.intent.action.REMOTE_DEVICE_CONNECTED
android.bluetooth.intent.action.REMOTE_DEVICE_DISAPPEARED
android.bluetooth.intent.action.REMOTE_DEVICE_DISAPPEARED
android.bluetooth.intent.action.REMOTE_DEVICE_DISCONNECTED
android.bluetooth.intent.action.REMOTE_DEVICE_DISCONNECT_REQUESTED
android.bluetooth.intent.action.REMOTE_DEVICE_FOUND
android.bluetooth.intent.action.REMOTE_NAME_FAILED
android.bluetooth.intent.action.REMOTE_NAME_UPDATED
android.bluetooth.intent.action.SCAN_MODE_CHANGED
android.intent.action.AIRPLANE_MODE
android.intent.action.BATTERY_CHANGED
android.intent.action.BATTERY_LOW
android.intent.action.BOOT_COMPLETED
android.intent.action.CAMERA_BUTTON
android.intent.action.CONFIGURATION_CHANGED
android.intent.action.DATA_SMS_RECEIVED
android.intent.action.DATE_CHANGED
android.intent.action.DEVICE_STORAGE_LOW
android.intent.action.DEVICE_STORAGE_OK
android.intent.action.GTALK_CONNECTED
android.intent.action.GTALK_DISCONNECTED
android.intent.action.HEADSET_PLUG
android.intent.action.INPUT_METHOD_CHANGED
android.intent.action.MANAGE_PACKAGE_STORAGE
android.intent.action.MEDIA_BAD_REMOVAL
android.intent.action.MEDIA_BUTTON
android.intent.action.MEDIA_CHECKING
android.intent.action.MEDIA_EJECT
android.intent.action.MEDIA_MOUNTED
android.intent.action.MEDIA_NOFS
android.intent.action.MEDIA_REMOVED
android.intent.action.MEDIA_SCANNER_FINISHED
android.intent.action.MEDIA_SCANNER_SCAN_FILE
android.intent.action.MEDIA_SCANNER_STARTED
android.intent.action.MEDIA_SHARED
android.intent.action.MEDIA_UNMOUNTABLE
android.intent.action.MEDIA_UNMOUNTED
android.intent.action.NEW_OUTGOING_CALL
android.intent.action.PACKAGE_ADDED
android.intent.action.PACKAGE_CHANGED
android.intent.action.PACKAGE_DATA_CLEARED
android.intent.action.PACKAGE_INSTALL
android.intent.action.PACKAGE_REMOVED
android.intent.action.PACKAGE_REPLACED
android.intent.action.PACKAGE_RESTARTED
android.intent.action.PHONE_STATE
android.intent.action.PROVIDER_CHANGED
android.intent.action.REBOOT
android.intent.action.SCREEN_OFF
android.intent.action.SCREEN_ON
android.intent.action.TIMEZONE_CHANGED
android.intent.action.TIME_SET
android.intent.action.TIME_TICK
android.intent.action.UID_REMOVED
android.intent.action.UMS_CONNECTED
android.intent.action.UMS_DISCONNECTED
android.intent.action.USER_PRESENT
android.intent.action.WALLPAPER_CHANGED
android.media.AUDIO_BECOMING_NOISY
android.media.RINGER_MODE_CHANGED
android.media.VIBRATE_SETTING_CHANGED
android.net.conn.BACKGROUND_DATA_SETTING_CHANGED
android.net.wifi.NETWORK_IDS_CHANGED
android.net.wifi.RSSI_CHANGED
android.net.wifi.SCAN_RESULTS
android.net.wifi.STATE_CHANGE
android.net.wifi.WIFI_STATE_CHANGED
android.net.wifi.supplicant.CONNECTION_CHANGE
android.net.wifi.supplicant.STATE_CHANGE
android.provider.Telephony.SIM_FULL
android.provider.Telephony.SMS_RECEIVED
android.provider.Telephony.WAP_PUSH_RECEIVED
com.google.gservices.intent.action.GSERVICES_CHANGED
Android 1.6 API Level4
android.intent.action.POWER_USAGE_SUMMARY
android.intent.action.SEND_MULTIPLE
android.speech.tts.engine.CHECK_TTS_DATA
android.speech.tts.engine.INSTALL_TTS_DATA
android.intent.action.ACTION_POWER_CONNECTED
android.intent.action.ACTION_POWER_DISCONNECTED
android.intent.action.ACTION_SHUTDOWN
android.intent.action.BATTERY_OKAY
android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED
android.speech.tts.engine.TTS_DATA_INSTALLED
com.android123.action.CWJ_DEMO
com.google.gservices.intent.action.GSERVICES_OVERRIDE
Android 2.0,2..01,2.1 API Level5,6,7
android.bluetooth.adapter.action.REQUEST_DISCOVERABLE
android.bluetooth.adapter.action.REQUEST_ENABLE
android.settings.ACCESSIBILITY_SETTINGS
android.settings.PRIVACY_SETTINGS
android.bluetooth.a2dp.action.SINK_STATE_CHANGED
android.bluetooth.adapter.action.DISCOVERY_FINISHED
android.bluetooth.adapter.action.DISCOVERY_STARTED
android.bluetooth.adapter.action.LOCAL_NAME_CHANGED
android.bluetooth.adapter.action.SCAN_MODE_CHANGED
android.bluetooth.adapter.action.STATE_CHANGED
android.bluetooth.device.action.ACL_CONNECTED
android.bluetooth.device.action.ACL_DISCONNECTED
android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED
android.bluetooth.device.action.BOND_STATE_CHANGED
android.bluetooth.device.action.CLASS_CHANGED
android.bluetooth.device.action.FOUND
android.bluetooth.device.action.NAME_CHANGED
android.bluetooth.devicepicker.action.DEVICE_SELECTED
android.bluetooth.devicepicker.action.LAUNCH
android.bluetooth.headset.action.AUDIO_STATE_CHANGED
android.bluetooth.headset.action.STATE_CHANGED
android.intent.action.DOCK_EVENT
android.provider.Telephony.SMS_REJECTED
android.intent.action.LOCALE_CHANGED
Android 2.2 API Level8
android.app.action.ADD_DEVICE_ADMIN
android.app.action.SET_NEW_PASSWORD
android.intent.action.MUSIC_PLAYER
android.search.action.SEARCH_SETTINGS
android.settings.ADD_ACCOUNT_SETTINGS
android.settings.DEVICE_INFO_SETTINGS
android.app.action.ACTION_PASSWORD_CHANGED
android.app.action.ACTION_PASSWORD_FAILED
android.app.action.ACTION_PASSWORD_SUCCEEDED
android.app.action.DEVICE_ADMIN_DISABLED
android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED
android.app.action.DEVICE_ADMIN_ENABLED
android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE
android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE
android.media.SCO_AUDIO_STATE_CHANGED
Toast和Looper,Handler消息循环机制[size=large][/size][align=center][/align]
博客分类: Android
AndroidthreadOS
(1) Looper类别用来为一个线程开启一个消息循环。默认情况下Android中新诞生的线程是没有开启消息循环的。(主线程除外,主线程系统会自动为其创建Looper对象,开启消息循环)
Looper对象通过MessageQueue来存放消息和事件。一个线程只能有一个Looper,对应一个MessageQueue。
(2) 通常是通过Handler对象来与Looper交互的。Handler可看做是Looper的一个接口,用来向指定的Looper发送消息及定义处理方法。
默认情况下Handler会与其被定义时所在线程的Looper绑定,比如,在主线程中定义,其是与主线程的Looper绑定。
mainHandler = new Handler() 等价于new Handler(Looper.myLooper()).
Looper.myLooper():Return the Looper object associated with the current thread 获取当前进程的looper对象。
还有一个类似的 Looper.getMainLooper() 用于获取主线程的Looper对象。
(3) 在非主线程中直接new Handler() 会报如下的错误:
E/AndroidRuntime( 6173): Uncaught handler: thread Thread-8 exiting due to uncaught exception
E/AndroidRuntime( 6173): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
原因是非主线程中默认没有创建Looper对象,需要先调用Looper.prepare()启用Looper。
(4) Looper.loop(); 让Looper开始工作,从消息队列里取消息,处理消息。
注意:写在Looper.loop()之后的代码不会被执行,这个函数内部应该是一个循环,当调用mHandler.getLooper().quit()后,loop才会中止,其后的代码才能得以运行。
(5) 基于以上知识,可实现主线程给子线程(非主线程)发送消息。
Toast或者Dialog中都有一个Handler的成员变量,在初始化时都会跟着初始化,而Toast或者Dialog中的Handler都需要一个Looper,所以需要在包含该Toast或者Dialog的线程中(如下面的Timer线程)初始化Looper。Looper.prepare();
问题代码:
Java代码
private Handler myHandler = new Handler() {
public void handleMessage(Message msg) {
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
InputMethodManager m = (InputMethodManager) editText
.getContext().getSystemService(
Context.INPUT_METHOD_SERVICE);
m.showSoftInput(editText, 0);
//
Looper.prepare();
Toast.makeText(Main.this, "show", Toast.LENGTH_LONG).show();
Looper.loop();
}
}, 1000);
}
}
Toast 和 Looper,一个属于 android.widget,一个属于 android.os,两个貌似联系不怎么紧密的类,却通过下面这个异常联系到了一起:
Java代码
E/AndroidRuntime( 1819): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
E/AndroidRuntime( 1819): at android.os.Handler.<init>(Handler.java:121)
E/AndroidRuntime( 1819): at android.widget.Toast.<init>(Toast.java:68)
E/AndroidRuntime( 1819): at android.widget.Toast.makeText(Toast.java:231)
Handler.java:121
Java代码
119 mLooper = Looper.myLooper();
120 if (mLooper == null) {
121 throw new RuntimeException(
122 "Can't create handler inside thread that has not called Looper.prepare()");}
Toast.java:68 ——>成员变量,在初始化时会跟着初始化
Java代码
68 final Handler mHandler = new Handler();
由以上的错误信息可以看出:程序要创建 handler,但是发现Looper.prepare还没有被调用。通过 Android SDK 中的Reference可以看到,Looper、Handler 的调用是非常有讲究的,如下面示例代码:
Java代码
class LooperThread extends Thread {
public Handler mHandler;
public void run() {
Looper.prepare();
mHandler = new Handler() {
public void handleMessage(Message msg) {
// process incoming messages here
}
};
Looper.loop();
}
}
言归正题,继续寻找 Toast、Looper 和 Handler 三者之间的联系,也许谜底就能解开了。欲揭谜底,从源码入手是一条捷径。
Toast.java 的第231行的代码是创建一个新的Toast实例,而实例化的过程中,就需要执行第68行,也就是声明并创建Handler(成员变量)的实例。那么来看Handler.java的第121行到底做了什么,如下所示:
Java代码
119 mLooper = Looper.myLooper();
120 if (mLooper == null) {
121 throw new RuntimeException(
122 "Can't create handler inside thread that has not called Looper.prepare()");}
到此,距离真相的解开近了一大步,既然抛出了 RuntimeException,那么 mLooper 肯定是 null,但是为什么 Looper.myLooper() 会返回 null?继续进入到 Looper.java 中寻根究底。
Java代码
/**
* Return the Looper object associated with the current thread. Returns
* null if the calling thread is not associated with a Looper.
*/
public static final Looper myLooper() {
return (Looper)sThreadLocal.get();
}
以上就是 myLooper() 方法的真实面貌,通过注释可以看出问题的真正原因在于当前线程并没有绑定 Looper,返回为 null 是正确但非正常的结果。
属于转载,写得很好的博客,收藏了