• 将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

  • 相关阅读:
    对组件库对再次封装
    cube-ui修改按钮颜色
    移动端框架
    mac环境变量
    Promise {<pending>
    MAC升级node及npm
    create-react-app项目中的eslint
    查看删除分支
    git分支的相关问题
    centos7系统下安装php-fpm并配置nginx支持并开启网站gzip压缩
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13333020.html
Copyright © 2020-2023  润新知