将cantk runtime嵌入到现有的APP中的方法

发布时间:2020-09-15 15:02:57 作者:李先静
来源:脚本之家 阅读:155

1,先取cantk-runtime-demos到本地:

git clone https://github.com/drawapp8/cantk-runtime-demos

2,创建一个Android App(或者拷贝现有的项目):

cd cantk-runtime-demos
android create project -n MyApp -k com.demo -a MyAppActivity -p ./MyApp -t 
cd MyApp

3,合并phonegap和cantk-runtime相关文件。

GAMERUNNER=../GameRunner/platforms/android
mkdir -p assets
cp -rvf $GAMERUNNER/libs .
cp -rvf $GAMERUNNER/src/* src/.
cp -arvf $GAMERUNNER/res/xml res
cp -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 debug
adb install -r bin/MyApp-debug.apk

如果编译不过,请修改project.properties:

target=android-21

示例:https://github.com/drawapp8/cantk-runtime-demos/tree/master/EmbedDemo

总结

以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对亿速云的支持。如果你想了解更多相关内容请查看下面相关链接

推荐阅读:
  1. 将FormView视图封装到DLL中
  2. 怎么在将matplotlib绘图嵌入到pyqt中

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

android cantk runtime

上一篇:如何选择美国服务器

下一篇:域名如何接入服务器

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》