Titanium android module中,view proxy 不能与 module同名
访问量: 2803
花了我一天时间解决这个问题。
It cost my 1 day to solve this problem.
to successfully create and run a ViewProxy, you have to:
1. change its file/class name (from ExampleProxy) to ViewProxy
2. clean the dirty files, including: `build/`, `dist/`, and some "lib<your package name>.so " files in `libs/` folder.
3. execute `ti clean` in your "Titanium app" folder.
4. your ViewProxy is `not the same` as the module name. e.g. your module name is: "GaodeMapModule", your proxy name should not be: "GaodeMapProxy", it doesn't work.
各种版本都试过了。
另外收获一点儿经验:
当你遇到非常不可思议的问题时,要一点儿一点儿的替换条件,测试。例如,我这次遇到无法命名view proxy的问题,我是:
1. 先 新建一个空白项目,在上面试。
2. 往这个空白项目中,添加集成 高德地图的代码。通过。
3. 修改默认生成的ExampleView 的名字,失败
4. 查询(grep)相关的信息,发现遗留的脏文件和文件夹中存在相关信息, get新技能: 清理无用的文件/文件夹
5. 重试,还是不行。
6. 继续新建空白module项目, 从0开始,一点儿一点儿改:
6.1 新建一个view proxy, 重命名,好用!
6.2 新建另外一个view proxy, 重命名,好用!
7. 把上述步骤应用于 出问题的项目中,发现不行!
8. 把 6.2中的 view proxy 放过来, 可用! 觉得我的理论没问题。
9. 各种清理脏文件方法用上了,读代码,还是不行。找到了stackover上的问题和解决办法。用在我这里还不行。
10. 为什么有的view proxy 就可以(6.2) 有的 view proxy就不行? 一对比,发现,不行的view proxy,名字与module的名字相同了。
11. 一改,搞定。