2012年12月25日 星期二

AlertDialog



package com.example.alertdialog;

import android.os.Bundle;
import android.app.Activity;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class MainActivity extends Activity {



@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Button btn1 = (Button) findViewById(R.id.button1);


// button1 click event
btn1.setOnClickListener(new Button.OnClickListener() {

@Override
public void onClick(View v) {
// // TODO Auto-generated method stub
Builder ad = new Builder(MainActivity.this);
ad.setTitle("確認");
ad.setMessage("您輸入的資料為:");

DialogInterface.OnClickListener onClick = new DialogInterface.OnClickListener() {



ad.setPositiveButton("確定", onClick);   //  which 為 -1
ad.setNeutralButton("取消", onClick);   // which 為 -3
ad.setNegativeButton("取消2", onClick); //  which  為 -2


                                @Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
Log.e("which",which+"");
}
};

ad.show();
}
});

}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}

}


2012年12月20日 星期四

Google Map API V1 API Key

Google Map API V1  API Key現在需從

https://developers.google.com/maps/documentation/android/v1/maps-api-signup

這裡申請,

因為api v2 v3 出了一些時間

此api v1不再提供更新了, 但有必要時可由此在申請到api key

2012年12月17日 星期一

google map keytool 錯誤

今天要產生Google map的keystore出現了 


keytool 錯誤: java.lang.Exception: Keystore 檔案不存在

之前有發生過,後來用力回想才回想起來

在mac底下應該去到你的使用者目錄後

進入./android的資料夾  再去產生keystore。

在mac底下,keystore會存放在

使用者→使用者的名稱-> .android的資料夾下面  (cd /Users/name/.android/ )

這是一個隱藏資料夾,可以過finder的前往到.android去存取你的keystore檔

====================================
產生keystore的方法 可以參考 
http://wangshifuola.blogspot.tw/2011/06/androidgoogle-map-api-key.html


輸入

keytool -genkey -v -keystore keystore名稱.keystore -alias alias名稱 -keyalg RSA -validity 10000

這個語法可以產生keystore


再去抓取fingerprints

下 keytool -list -v -keystore keystore的檔案

上面都是全名xxx.keystore

就可以產生fingerprints了  再去consols api產生 api key


2012年12月10日 星期一

iOS開發手冊指南-中文版

iOS開發手冊指南 有中文版的囉!

http://developer.apple.com/library/ios/#referencelibrary/GettingStarted/RoadMapiOSCh/chapters/Introduction.html

2012年12月9日 星期日

android多螢幕設計

可以參考 android數據  看哪個sdk為大宗去執行程式開發


網路找到一篇可以參考的文章可以閱讀一下


Supporting Multiple Screens

2012年11月28日 星期三

我的健康管理MyHealthApp Version 2.0 版

wow~

我的健康管理MyHealthApp Version 2.0 版更新發佈囉!!!

此次更新包含了


1.修正『我的記錄』資料重覆出現問題。

2.修正『我的記錄』」月」無法正常點擊。

3.圖表內容新增放大功能。

4.替換圖表顯示方式。

5.新增loading未出現問題。

6.修正無血壓或無血糖顯示方式。

7.健康資訊資料內容改由動態讀取顯示。

8.新增支援4 inch螢幕大小顯示。 (也就是iPhone5也可以使用呦!!)

9.標題顏色修改




2012年11月24日 星期六

滑鼠移上切換圖片

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
       

            icon = new Image();
            icon.src = "../image/1.png";
            icon2 = new Image();
            icon2.src = "../image/2.jpg";
            icon3 = new Image();
            icon3.src = "../image/3.jpg";
            icon4 = new Image();
            icon4.src = "../image/4.png";
            function showImages(obj) {
                // DOM
               // var theImg = document.getElementById("myID");
                // theImg.src = obj;
                // BOM
                document.images[0].src = obj;
        }
    </script>
</head>
<body>
<a href="#" onmouseover="showImages(icon.src)">icon1</a> | <a href="#" onmouseover="showImages(icon2.src)">icon2</a> | <a href="#" onmouseover="showImages(icon3.src)">icon3</a> | <a href="#" onmouseover="showImages(icon4.src)">icon4</a>
<hr />
<img id="myID" src="../image/1.png" width="200px" />
</body>
</html>

2012年11月23日 星期五

置換網頁,不出現上一頁

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
    </script>
</head>
<body>
    <input type="button" value="href"  onclick="location.href='http://www.yahoo.com.tw'"/>
    <input type="button" value="replace"  onclick="location.replace('http://www.yahoo.com.tw')"/>
</body>
</html>



通常用reload會出現上一頁的按鈕讓使用者回去前一頁,

但今天如果不想讓使用者回前一頁的話,

可以使用replace()的方式就不會有這個問題出現

[javascript]抓取螢幕屬性

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--螢幕物件-->
<head>
    <title></title>
    <script type="text/javascript">
        window.onload = function () {
            with (document) {
                write("<pre>");
                writeln("螢幕可用高度:" + screen.availHeight);
                writeln("螢幕可用寬度:" + screen.availWidth);
                writeln("高度:" + screen.height);
                writeln("寬 度:" + screen.width);
                writeln("色彩:" + screen.colorDepth);
                write("</pre>");
            }
        }
    </script>
</head>
<body></body>

2012年11月20日 星期二

ios APNS文字補充

1.鑰匙圈存取→憑證輔助程式→從憑證授權要求憑證…
 Common Name要記得填入什麼,等下會用到。

2. 儲存到磁碟(saved to disk) ,此時會是你的 檔名.cerSigningRequest。

3.前往→工具程式→鑰匙圈存取→點左下方類別的 鑰匙,會看見多出兩個剛才Common Name   輸入的文字密鑰(公用密鑰、專用密鑰)



5.登入iOS Provisioning Portal (就是要申請憑證的那裡)

6.新建一個App IDs 建立好後,找到剛才新建的App IDs項目,點選Configure→將Enable for Apple Push Notification service打勾,點選Configure,上傳剛才第一步得到的cerSigningRequest副檔名。

7. 選擇好後,按下Generate(產生),將產生的SSL檔下載下來,此時下載下來的預設檔名為 aps_development.cer,要記先點擊兩下!

8. (4).    在與剛才Common Name相同的專用密鑰上點選右鍵 Export ”Common Name輸入的名稱",此 時檔案格式會是 .p12檔→按下存儲後,會跳出密碼,請輸入要設定的密碼,之後會用到  唷( .net使用只要到此步即可)。

8. 下載完成後,點選done 此時你會看見Status會變為Enabled的綠燈

9.  現在你應該會有三個檔案,副檔名分別是  .cerSigningRequest  、 p12 、cer 三個檔

10.  現在要來合併提供給PHP使用的檔案,請開啟終端機

11. 首先我們要透過指令將 cer檔轉成.pem檔

12. 將終端機移到剛才三個檔案的位置,並且下下方指令:


openssl x509 -in aps_developer_identity.cer -inform der 

    -out 轉換出的檔.pem


13.  此時會產出       轉出來的檔案.pem

14.  再來我們要把 剛才的.p12 檔 轉出另個key的pem檔 到時要把兩個pem檔合併起來

15.



openssl pkcs12 -nocerts -out 轉出來的Key.pem -in 剛才你的p12檔檔名.p12

Enter Import Password:
MAC verified OK
Enter PEM pass phrase:
Verifying - Enter PEM pass phrase:


16. 再來 要將剛才產生的兩個pem檔 合併  下指令:



cat 剛才轉出來的Cert.pem 剛才轉出來的Key.pem > ck.pem






2012年11月6日 星期二

改變canvas原點座標到左下角

在HTML5裡頭,畫面的原點座標在左上角,

但要來做一些與我們一般數學座標系相同的事情時,

就會產生一些不方便,

來示範一下如何將canvas的座標(0,0)改到左下角


原始的程式
=========================================


<html>

<title></title>
<head></head>
<body>
<canvas id="square" width="400" height="400" style="border:1px solid #000000;"></canvas>
<script>
var canvas = document.getElementById("square");

var context = canvas.getContext("2d");

context.beginPath();
context.moveTo(0,0);
context.lineTo(200,200);

context.stroke();

</script>
</body>
</html>




=======================================

其實加上兩行就可以了,


context.translate(0, canvas.height);
context.scale(1, -1);

完整程式
=======================================



<html>

<title></title>
<head></head>
<body>
<canvas id="square" width="400" height="400" style="border:1px solid #000000;"></canvas>
<script>
var canvas = document.getElementById("square");

var context = canvas.getContext("2d");
context.translate(0, canvas.height);
context.scale(1, -1);
context.beginPath();
context.moveTo(0,0);
context.lineTo(200,200);

context.stroke();

</script>
</body>
</html>




=======================================



2012年11月1日 星期四

我的健康管理version 1.1

我的健康管理version 1.1版  已經上架了!

此次發佈上架花費8天

更新項目 包含

1. 新增loading畫面

2. 我的健康儀表板跑位問題




關於點選日 會死當問題等下一版v1.2會更新



2012年10月26日 星期五

動態註冊BroadCastReceiver

前一篇是在說明 利用AndroidMainifest去註冊BroadcastReceiver

這篇來介紹如何始用程式來動態註冊BroadcastReceiver 不需直接在AndroidMainifest寫死指定

在要註冊的程式寫下

IntentFilter message = new IntentFilter("mybroadcast");



  若要新增broadcast Receiver的話   可以利用addAction的指令   例如  
message.addAction("broadcast2"); 
  然後和上一篇一樣去實作Broadcast Receiver並extends BroadcastReceiver   然後去new出來你要註冊的地方
MyReceiver receiver = new MyReceiver(); 


並註冊偵聽broadcast

registerReceiver(receivr,message);



  若要發送broadcast的話   就下
sendBroadcast( new Intent(broadcast)); 


這樣在MyReceiver內就會收到發送的broadcast了

若要取消監聽Broadcast則下

unregisterReceiver(receiver);




注意的一點就是如果已經取消過監聽的Broadcast的註冊

又再去叫一次unregisterReceiver的話

會跳出IllegalArgumentException的error

所以我們可以使用 try catch去預防這個錯誤發生

可以下
try{
   unregisterReceiver(receiver);
}
   catch(IllegalArgumentException)
{
   Toast.makeText(MainActivity.this,"已經取消過了啦!笨蛋!", Toast.LENGTH_SHORT).show
}


來預防



2012年10月23日 星期二

BroadCastReceiver收到簡訊通知


在Android要實現 收到簡訊通知出上方的訊息其實很容易,

只要實作BroadcastReceiver這個功能就可以了,

首先要先到AndroidMainifest.xml設定uses-permission

再去註冊指定的BroadcastReceiver



開一個指定的class去extends BroadCastReceiver


再開啟DDMS發送簡訊模擬,

找不到DDMS的人可以由window→open perspectiv→other裡面找到DDMS面版




按下sned就可以由DDMS發送SMS到模擬器 

會出現下方跳出通知的訊息

點開訊息就會看見剛才輸入的簡訊內容了








2012年10月18日 星期四

第一個iphone APP「我的健康管理MyHealthApp APP」上架!

我的健康管理MyHealthApp


===================

千呼萬喚始出來

我做的第一個APP終於上架了

其實做完將近兩個月了

但上架的過程有點艱辛

過程就不闡述了

反正apple有疑惑就等待時間又要再後延

為了趕上架

此版的還是舊版的呢==

新版還在等待中

舊版有小bug所以就將就一下等待新版上架發佈吧

可以去app store查詢

我的健康管理MyHealthApp













是免費軟體喔~!

評分請給多一點的星星吧~



2012年10月16日 星期二

使用ACS發push notification到Android手機

Titanium有個cloud服務提供了push notification

今天將進行使用  ACS 來傳送notification

先登入 ACS

選擇你要發送notification的app名稱

點選  Manage ACS 再輸入帳號密碼

因為是開發測試

所以又上要記得點選 Development

移至最下面點選Users

再點Create a Users

把資料填一填 待會會用到email與密碼

填完按下 create User

再點 左上方的Back to App Management 回去

點選push notification

然後開始寫程式


使用Titanium設定tiapp.xml


    <modules>
        <module platform="commonjs" version="2.3.0">ti.cloud</module>
        <module platform="android">ti.cloudpush</module>
    </modules>

新增紅色的

接下來請參考  這裡



2012年10月11日 星期四

push notification for iphone

試了很久的 push notification for iphone

終於

試出來了!

感謝 JustFly 的協助

---------------------------------------

詳細可以參考 這篇

靜下心花點時間按照此步驟一步一步的做

應該可以做到最後產生 .pem檔

此篇在後續titanium的部分





---------------------------------------


// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

var win = Titanium.UI.createWindow({
    title : 'Tab 1',
    backgroundColor : '#fff'
});
Titanium.Network.unregisterForPushNotifications;
Ti.API.info("unregisterForPushNotifications");
Titanium.Network.registerForPushNotifications({
        types:[
                
                Ti.Network.NOTIFICATION_TYPE_ALERT,
                Ti.Network.NOTIFICATION_TYPE_BADGE,
                Ti.Network.NOTIFICATION_TYPE_SOUND
        ],
        
        success: successCallback,
        error: errorCallback,
        callback: messageCallback
});

function successCallback(e) {
        alert(e);
        alert( e.deviceToken+'');
        var deviceToken = e.deviceToken;
        // var deviceToken=Ti.Network.remoteDeviceUUID;
         // alert('deviceToken:' + Ti.Network.remoteDeviceUUID);
}

// error callBack
function errorCallback(e) {
        alert(e);
        alert('Push errorCallback' + e.error +'');
}

// message callBack
function messageCallback(e) {
        alert(e);
        alert('Push messageCallback');
}


win.open();


------------------------
記得 e.deviceToken+''要轉成字串才可以抓到deviceToken


抓到deviceToken之後

將deviceToken貼到網站裡的simplePush.php的範例

為了讓push notification能夠傳遞中文

所以要多加上轉換成UTF-8編碼


$message = '傳遞中文通知!';
$message = iconv('Big5','UTF-8',$message);

由於發佈發現一直無法出現傳遞成功的字樣

後來發現式pem路徑問題

我也是將pem放在同樣www的資料夾 (我使用appserv)但就抓不到

後來將程式改成


$apnsCert = dirname(__FILE__) . '/' . 'ck.pem';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert',  $apnsCert );

這樣就可一順利發佈push notification了






2012年9月27日 星期四

Titanium設定suds 編碼

suds 0.39前版本預設無使用utf - 8的版本

若要使用UTF-8的話

在 xhr.setRequestHeader('Content-Type','text/xml;cahrset=UTF-8'); 加入即可。

titanium降階發佈ios sdk 4.3以下版本

ios6剛出來

xcode也升級到4.5版本 ios sdk到6的版本

使用titanium studio升級之後就無法選擇sdk 4.3版本了

若要使用sdk 4.3版本需要到 titanium studio -> preferences -> Aptana Studio->Titanium

去設定ios SDK Home的路徑,

但會發現無法選擇路徑

需開啟mac的終端機

使用 sudo xcode-select -switch /Developer

(要改回來就下


sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

)  -> for xcode 4.3


會要求輸入root的密碼

若使用者帳戶未設密碼請輸入一個使用者帳號的密碼才可以用sudo指令

此時按下設定後 在titanium內就可以選擇 4.3以下的sdk版本對iphone3來進行模擬測試

reference:
http://docs.appcelerator.com/titanium/2.0/index.html#!/guide/Configuring_XCode_inside_Titanium_Studio

2012年9月19日 星期三

推薦Bare Tail小工具

推薦一個好用的小工具

叫做  Bare Tail

幫助我們觀看Log檔的時候,

有即時更新資料不需關閉log檔重開即可立即顯示。

視個非昌方變得小工具

除此之外

在Preferences->Highlighting內可以設定自己想要的格式色彩

讚!


reference:

http://www.baremetalsoft.com/baretail/index.php

http://www.cnblogs.com/greenerycn/archive/2010/07/15/windows_log_viewer_baretail.html

2012年9月2日 星期日

eclipse常用熱鍵


自動排版:ctrl+shift+f
自動完成:alt+/
Debug提示:F2
•自動import:ctrl + shift + o
•add unimplement: ctrl + 1
•註解:ctrl + /
•複製同一行:ctrl + alt + down



2012年8月29日 星期三

eclipse背景主題與字型大小

http://eclipsecolorthemes.org/

修改背景主題:

到上面網址下載喜歡的EPF檔,

進入eclilpse

1. file → import


2.general→preferences


 3. 選擇剛才下載的epf檔→finsih

改變字型大小:

windows→preference→General→Appearance→Colors and Fonts→TextFont→Edit


再按確定就可以改變大小囉

2012年8月22日 星期三

設定中文app name for iphone

此篇記錄設定中文名字for iphone版本

android版請看

其實iphone版與android差不多

反而更容易

建立資料夾 i18n / zh_TW  

zh_TW為繁體中文

zh_CN為簡體中文




再建立app.xml檔

內容如
<?xml version="1.0" encoding="UTF-8"?>
<resources>
    <string name="appname">中文名字</string>
</resources>


即可

Admob Module設置

今天在設置Admob的module時,

找不到應該安裝的資料夾==

官網是寫於這裡  (這是mac版本)

/Library/Application Support/Titanium/module/iphone


window版本位置:

C:\Users\username\AppData\Roaming\Titanium\modules\android



安裝方式可參考

https://wiki.appcelerator.org/display/tis/Using+Titanium+Modules


但我這台mac就是找不到

最後只好由另個方式

在 此路徑建立modules


/--build
 --tiapp.xml
--Resources
--modules
----iphone
-------ti.admob
---------1.3
...


// -----
最後有問到 這個檔可能在mac是隱藏檔
所以下  Shift+Command+G
輸入 ~/Library

就可以從裡面找到安裝的地方了

2012年8月21日 星期二

Android安裝

ADT location:

https://dl-ssl.google.com/android/eclipse/



今天重新安裝Eclipse要撰寫Android時

當按下run時 跳出了


An internal error occurred during: "Launching New_configuration".Path for project must have only one segment

錯誤訊息

後來查了google發現

只要到
Project -> Properties  -> Run/Debug Settings裡
選擇 "Launching New_configuration
點選Delete
按下確定

即可發佈

2012年8月13日 星期一

看不見Ti.API.info()訊息

今天在使用Titanium時,

升級完Titanium SDK 後 發生了看不到 Ti.API.info()的情況

我升級完的版本是


Titanium Studio, build: 2.1.1.201207271312

當我下Ti.API.info()時  

console出現以下訊息


[INFO] Found 4.3.2 patch installed



Ti.API.info()的內容就此消失了

查官網此篇

http://developer.appcelerator.com/question/118667/titanium-161-and-xcode-43---debuginfo-problem

先到


cd ~/Library/Application\ Support/iPhone\ Simulator

內容大約是把 4.3的資料夾 備份, 再把 4.3的資料夾做與4.3.2連結 ,

這樣就可看見Ti.API.info()的內容了

mv 4.3 4.3.old
ln -s 4.3.2 4.3


2012年7月1日 星期日

將tabgroup移置下方

Titanium Studio裡的tabgroup預設是在上方

要如何將tabgroup移到下方(bottom)呢?

可以參考
http://www.titaniumtutorial.com/2012/03/titanium-android-bottom-tabgroup.html

大意是說先建立資料夾

platform/android/res/layout/

並建立titanium_tabgroup.xml的檔案

內容放置



<?xml version="1.0" encoding="utf-8"?>

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"

    android:id="@android:id/tabhost"

    android:layout_width="fill_parent"

    android:layout_height="fill_parent">



    <LinearLayout

        android:orientation="vertical"

        android:layout_width="fill_parent"

        android:layout_height="fill_parent"

        android:padding="0dp">



        <FrameLayout

            android:id="@android:id/tabcontent"

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:padding="0dp"

            android:layout_weight="1"/>



        <TabWidget

            android:id="@android:id/tabs"

            android:layout_width="fill_parent"

            android:layout_height="wrap_content"

            android:layout_weight="0"/>



    </LinearLayout>



</TabHost>


這樣執行就能將tabgroup移到下方顯示囉

2012年6月29日 星期五

設定中文app name for Android


使用Titanium Studio設定中文app name

可依照 http://developer.appcelerator.com/blog/2012/02/internationalization-of-app-names.html

實作

但Android方面有點不同

首先 先發佈一次你的程式 發佈成功後

新建platform資料夾

platform裡 再新建 android資料夾

android內再新建res資料夾

並分別建立你想要對應的語系資料夾

中文則用values-zh 資料夾  英文則用values-en

再到build/android/AndroidManifest.xml (要先發佈過一次才會產生)  把此檔copy到

platform/android資料夾裡 (這是自己建立的資料夾)

與上面網址教學圖片不同  教學網站圖有誤

真正的路徑圖會變這樣



然後建立你的語系檔strings.xml為名

內容




<?xml version="1.0" encoding="UTF-8"?>

<resources>  

     <string name="app_name">中文測試</string>

</resources>





接下來 開啟AndroidMainifest.xml  修改成以下紅色地方



    <!-- TI_MANIFEST -->

    <application android:icon="@drawable/appicon"
        android:label=&quot;@string/app_name" android:name="TestApplication"
        android:debuggable="false">

        <!-- TI_APPLICATION -->

        <activity android:name=".TestActivity"
            android:label="@string/app_name" android:theme="@style/Theme.Titanium"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>



原本以為這樣就可以了  在Titanium Studio 1.8.2 記得是這樣的做法

但發現到Titanium Studio, build: 2.1.1.201206271720版本一直產生不出中文app name

後來 我到 tiapp.xml 內

將  的內容改成



<name>@string/app_name</name> 



就可以順利變中文囉

記得若用中文為名的話,在模擬器記得要去setting改語系才會顯示你對應的語系哦





================================================================
2012.12.18更新
若上述無法成功,

請試看看把build/android/AndroidManifest.xml 把此檔copy到

platform/android/res資料夾裡 (這是自己建立的資料夾)


此處要更新一下,在tiapp.xml內的



<name>是英文</name> 

不能改成最上面說的那樣,不然在distribute的時候會無正常發佈

2012年6月27日 星期三

Titanium:The Desktop-SDK問題


裝了Titanium Studio 2.0.2的版本後

在setting的部份會出現 Titanium SDK Home有警告訊息

[Titanium SDK Home] The Desktop-SDK root path'c:\Users\.....\Titanium\sdk\win32' is not a directory

雖然程式是可以run不影響






後來到論壇問得到的回答是:



mosluce :
Desktop SDK 目前已不支援 Windows 囉!
這部份可以不需要設定,Titanium Mobile Project 使用上應該不會有問題


2012年6月26日 星期二

Titanium Studio 2.0.2安裝

重灌電腦後

裝了新版的Titanium Studio2.0.2版

發現安裝過程出現好多問題= =

記錄一下以免之後忘記

首先 Titanium Studio 2.0.2似乎目前不支援JDK 1.7版

所以請安裝JDK 1.6的版本 http://www.oracle.com/technetwork/java/javase/downloads/index.html

JRE我是裝6的版本

若發佈時 出現下圖 錯誤訊息

[ERROR] JDK version ' javac' .......... detected, but 1.6 is required

不要緊張

這就是沒有抓到jdk jre的樣子

此時要在環境變數設定

開啟我的電腦右鍵 內容 進階系統設定

下面的系統變數按下新增
變數名稱打上:JAVA_HOME
變數值打上:C:\Program Files\Java\jdk1.6.0_33   //這就看你的路徑放哪

再新增一個
變數名稱打上:Path
變數值打上:C:\Program Files\Java\jdk1.6.0_33\bin     //這就看你的路徑放哪



重新開啟你的Titanium Studio 再發佈一次 即可

至於Android的設定  2.0.2 感覺和之前1.8.1 1.8.2有些許不同

windows→preferences裡我找不到Titanium Studio的選項 


可能是舊版的圖

所以要設定Android SDK的地方 我是在建立新專案的地方  點選Set-up/confiqure SDKs去選

Android SDK與Android NDK的位置(這之前要先下載下來)




2012年6月14日 星期四

提升Android simulator記億體出現error

用模擬器跑Android實在是太過緩慢

 於是google了一下

 找到其中一種方式就是調整hw.ramSize的大小 

先找到android的資料夾

我的是存在(C:\Users\james\.android\avd\API_14.avd)

 因為我用API_14的 所以找到他的.avd

 將裡頭config.ini打開

 找到

 sdcard.size=200

 hw.ramSize=512

 我把sdcard.size改成512

 hw.ramSize改成1024

卻出現以下

error Failed to allocate memory: 8

 不知為何會出現此error

 但改成hw.ramSize=820

 就可以正常run囉

 試看看會不會快一點點

2012年6月10日 星期日

Android Error問題

今天在測試時

 發現Android compile一直出現 以下訊息

  ERROR: Application requires API version 15. Device API version is 14 (Android 4.0.2). 

之前都沒發生這個事

 後來去 AndroidManifest.xml裡的

  改成 對應到的版本 comiple就可以順利通過囉