共享代码的两个代号项目 [英] Two Codename One Projects with Shared Code

查看:148
本文介绍了共享代码的两个代号项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个有专业版和免费版的应用,两者几乎完全相同,我希望尽可能多地使用通用代码来避免复制和放大从一个项目移动到下一个项目时粘贴问题。

I've got an app that has a pro and free version, both are almost identical and I'd like to have as much common code as possible to avoid copy & paste issues when moving from one project to the next.

据我所知,应用程序商店根据其软件包名称识别应用程序但我明白更改软件包的名称完成的应用程序很难。

As far as I understand app stores recognize apps based on their package names but I understood that changing the package name of a completed app is difficult.

这种情况是否有最佳做法?

Is there a best practice for such a situation?

目前我唯一的事情是可以想到的是尝试将尽可能多的逻辑移动到cn1lib文件中并拥有两个单独的应用程序。其他的想法/方法将不胜感激。

Currently the only thing I can think of is to try to move as much of the logic into a cn1lib file and have two separate apps. Other ideas/approaches would be appreciated.

推荐答案

cn1lib方法绝对是一个好方法,但并不总是简单或实用。

The cn1lib approach is definitely a good one but not always easy or practical.

我们向一些开发人员提供的方法是像往常一样创建一个版本的应用程序(免费或专业版),然后为另一个版本添加新的包名称,例如如果您的应用程序是 com.mycompany.myfreeapp ,那么您可以在事后添加包 com.mycompany.myproversion

An approach we offered to some developers is to create one version of the app as usual (free or pro) then add a new package name for the other version e.g. if your app is com.mycompany.myfreeapp then you can add the package com.mycompany.myproversion after the fact.

您的专业主类可以派生出免费的主类,甚至具有相同的名称(因为它们位于不同的包中),因此您可以拥有一个包含两个版本的项目。

Your pro main class can derive the free main class and even have the same exact name (since they are in different packages) and so you can have one project with two versions.

要实现此功能,您需要两个技巧,复制 codenameone_settings.properties 文件并替换所有文件提到包(和主要类,如果你也改变了)到pro / free版本。您还需要替换iOS的配置文件(只需重新运行向导)。

To get this to actually work you will need two tricks, copy your codenameone_settings.properties files and replace all mentions of the package (and main class if you changed that too) to the pro/free version. You will also need to replace the provisioning profiles for iOS (just re-run the wizard).

要在调试器中运行它,只需编辑项目首选项中的运行部分指向正确的主要课程。

To run this in the debugger just edit the run section in the project preferences to point at the right main class.

你可以把它编成一个小脚本,一旦你完成这个过程就可以完成所有这些事情。

You can codify this into a small script that does all of those things once you go thru this process.

这篇关于共享代码的两个代号项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆