简体   繁体   English

将android应用程序转换为库导致错误

[英]Convert android application to library causes errors

I want to create a Pro version of my android app. 我想创建我的Android应用的专业版。 After some investigation I think the best way to do that is to make my current application a library and create two applications that reference this lib. 经过一番调查,我认为最好的方法是使当前应用程序成为一个库并创建两个引用此lib的应用程序。

Unfortunately I don't come very far. 不幸的是我走的并不远。 My problems start in the first step I do. 我的问题始于我要做的第一步。 When I check the "Is library" checkbox in eclipse and perform a project -> clean I get a lot of errors. 当我在Eclipse中选中“是库”复选框并执行一个项目-> clean时,我会遇到很多错误。 Unfortunately I don't get an error that tells me what causes the problem. 不幸的是,我没有得到告诉我是什么原因引起的错误。 I just get the 233 errors telling me that my “R” cannot be found… 我刚收到233个错误,告诉我找不到“ R”…

Can anyone help me with that? 有人可以帮我吗?

UPDATE: 更新:

This error comes up in the middle of the build but does not show up when the build is over: 该错误会在构建过程中出现,但在构建结束时不会出现:

The container 'Android Dependencies' references non existing library 'C:\Users\Stefan\Documents\codefarm\time\google-play-services_lib\bin\google-play-services_lib.jar'

But this lib is definately existing and it seems not to be a problem when the "Is library" isn't checked... 但是这个lib绝对存在,并且当不检查“ Is库”时似乎没有问题...

UPDATE2: I figured out how I can make this work but still need a better solution. UPDATE2:我想出了如何进行这项工作,但仍然需要更好的解决方案。 When I check the "Is library" checkbox I can add it to my new application project as library. 选中“是库”复选框时,可以将其作为库添加到新的应用程序项目中。 Now I have to uncheck the "Is library" again so that the project compiles. 现在,我必须再次取消选中“ Is库”,以便编译项目。 The project successfully starts but everytime I exit eclipse I have to do these steps again... Impossible to work this way! 项目成功启动,但是每次退出eclipse时,我都必须再次执行这些步骤...无法以这种方式工作!

Finaly I figured out what caused the problem. 最后,我弄清楚了导致问题的原因。 Some time ago I switched from the default android context menu to my own but I was to lazy to update my switch/case with new Id's. 前一段时间,我从默认的android上下文菜单切换到了自己的菜单,但我懒得用新的ID更新我的switch / case。

case R.id.mi_Delete_Calendar_timerecord: {

After I changed that to 在我将其更改为

    private final int mi_Delete_Calendar_timerecord = 1;

it was working… I have no explanation why this is not working when I create a library. 它正在工作...我无法解释为什么在创建库时这不起作用。 I didn't care because I thought that a int is a int and it doesn't matter if I define it or I reuse it from the genreated R (however, I know this is no clean code but I don't understand why it does not compile as library)... 我不在乎,因为我以为int是int,定义它还是从生成的R中重用它都没关系(但是,我知道这不是干净的代码,但我不明白为什么会这样)不能编译为库)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM