1,先取cantk-runtime-demos到本地:
git clone https://github.com/drawapp8/cantk-runtime-demos
2,創建一個Android App(或者拷貝現有的項目):
cd cantk-runtime-demosandroid create project -n MyApp -k com.demo -a MyAppActivity -p ./MyApp -t cd MyApp
3,合并phonegap和cantk-runtime相關文件。
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,啟動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);
(請把游戲放在SDCARD中,路徑與上面指定的URL一致, EmbedDemo/examples/里有測試游戲)
6,編譯安裝
ant debugadb install -r bin/MyApp-debug.apk
如果編譯不過,請修改project.properties:
target=android-21
示例:https://github.com/drawapp8/cantk-runtime-demos/tree/master/EmbedDemo
總結
以上就是這篇文章的全部內容了,希望本文的內容對大家的學習或者工作具有一定的參考學習價值,謝謝大家對VEVB武林網的支持。
新聞熱點
疑難解答