华域联盟 Andriod 将cantk runtime嵌入到现有的APP中的方法

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

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

总结

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

本文由 华域联盟 原创撰写:华域联盟 » 将cantk runtime嵌入到现有的APP中的方法

转载请保留出处和原文链接:https://www.cnhackhy.com/106297.htm

本文来自网络,不代表华域联盟立场,转载请注明出处。

作者: sterben

关于Touch Panel AA区要做外扩的原因解析

Kotlin如何直接使用控件ID原理详析

发表回复

联系我们

联系我们

2551209778

在线咨询: QQ交谈

邮箱: [email protected]

工作时间:周一至周五,9:00-17:30,节假日休息

关注微信
微信扫一扫关注我们

微信扫一扫关注我们