1,先取cantk-runtime-demos到本地:
git clone https://github.com/drawapp8/cantk-runtime-demos
2,創(chuàng)建一個(gè)Android App(或者拷貝現(xiàn)有的項(xiàng)目):
cd cantk-runtime-demosandroid create project -n MyApp -k com.demo -a MyAppActivity -p ./MyApp -t cd MyApp
3,合并phonegap和cantk-runtime相關(guān)文件。
GAMERUNNER=../GameRunner/platforms/androidmkdir -p assetscp -rvf $GAMERUNNER/libs .cp -rvf $GAMERUNNER/src/* src/.cp -arvf $GAMERUNNER/res/xml rescp -arvf $GAMERUNNER/assets/www assets/cp -rfv $GAMERUNNER/CordovaLib/src/* src/.rm -rf assets/www/cordova-js-src/
4,修改AndroidManifest.xml,增加activity
<activity android:name="com.tangide.GameRunnerActivity" android:label="@string/app_name"></activity>
5,啟動(dòng)GameRunnerActivity
import com.tangide.GameRunnerActivity;...Intent intent = new Intent();Bundle bundle = new Bundle(); intent.setClass(EmbedDemoActivity.this, GameRunnerActivity.class);bundle.putString("url", "file:///mnt/sdcard-ext/cantk-rt-root/game1/index.html");intent.putExtras(bundle);startActivity(intent);
(請(qǐng)把游戲放在SDCARD中,路徑與上面指定的URL一致, EmbedDemo/examples/里有測(cè)試游戲)
6,編譯安裝
ant debugadb install -r bin/MyApp-debug.apk
如果編譯不過(guò),請(qǐng)修改project.properties:
target=android-21
示例:https://github.com/drawapp8/cantk-runtime-demos/tree/master/EmbedDemo
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)VEVB武林網(wǎng)的支持。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注