机器人:如何启动活动在库项目中定义 [英] android : how to start activity defined in library project

查看:153
本文介绍了机器人:如何启动活动在库项目中定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个使用androidVNC浏览器作为一个库项目的Andr​​oid应用程序,但我无法从androidVNC(活动未发现异常)。

I am developing an android application that uses androidVNC Viewer as a library project, but I am unable to launch an activity from androidVNC (activity not found exception).

另外,我怎么绑定库项目,并用它为一个APK?

Also, how do I bundle a library project and use it as one apk?

更新

我使用下面的意图拨打:

I am using following intent to call:

Intent call= new Intent("android.androidVNC.androidVNC.LAUNCH");
startActivity(call);

更新2 使用下面的codeI后,觉得我可以开始活动,但得到的(java.lang.NoSuchFieldError:android.androidVNC.R $ id.textIP)错误......

UPDATE 2 after using following code i think i could start the activity but getting this ( java.lang.NoSuchFieldError: android.androidVNC.R$id.textIP) error...

Intent vnc_call = new Intent(getApplicationContext(), androidVNC.class);
            vnc_call.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            startActivity(login);

我检查两个R.java,如库使用(生成的Java文件以下)androidVNC原件及androidVNC ...我得到的是之后的 textip有没有在一部开拓创新R.java ,但它是不存在的(生成的Java文件)中调用的项目

after i checked both R.java,androidVNC original and androidVNC when used as library(under generated java files)...what i got is textip is there in orignal R.java but it is not there in the R.java of (generated java files) in the calling project.

O / P的logcat的(前几行)

04-05 01:34:18.135: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/AbstractConnectionBean; (256)
04-05 01:34:18.135: W/dalvikvm(479): Link of class 'Landroid/androidVNC/AbstractConnectionBean;' failed
04-05 01:34:18.135: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/ConnectionBean; (8)
04-05 01:34:18.135: W/dalvikvm(479): Link of class 'Landroid/androidVNC/ConnectionBean;' failed
04-05 01:34:18.145: W/dalvikvm(479): VFY: unable to find class referenced in signature (Landroid/androidVNC/ConnectionBean;)
04-05 01:34:18.155: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/AbstractConnectionBean; (256)
04-05 01:34:18.155: W/dalvikvm(479): Link of class 'Landroid/androidVNC/AbstractConnectionBean;' failed
04-05 01:34:18.155: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/ConnectionBean; (8)
04-05 01:34:18.155: W/dalvikvm(479): Link of class 'Landroid/androidVNC/ConnectionBean;' failed
04-05 01:34:18.187: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/AbstractConnectionBean; (256)
04-05 01:34:18.187: W/dalvikvm(479): Link of class 'Landroid/androidVNC/AbstractConnectionBean;' failed
04-05 01:34:18.187: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/ConnectionBean; (8)`

04-05 01:34:18.135: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/AbstractConnectionBean; (256)
04-05 01:34:18.135: W/dalvikvm(479): Link of class 'Landroid/androidVNC/AbstractConnectionBean;' failed
04-05 01:34:18.135: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/ConnectionBean; (8)
04-05 01:34:18.135: W/dalvikvm(479): Link of class 'Landroid/androidVNC/ConnectionBean;' failed
04-05 01:34:18.145: W/dalvikvm(479): VFY: unable to find class referenced in signature (Landroid/androidVNC/ConnectionBean;)
04-05 01:34:18.155: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/AbstractConnectionBean; (256)
04-05 01:34:18.155: W/dalvikvm(479): Link of class 'Landroid/androidVNC/AbstractConnectionBean;' failed
04-05 01:34:18.155: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/ConnectionBean; (8)
04-05 01:34:18.155: W/dalvikvm(479): Link of class 'Landroid/androidVNC/ConnectionBean;' failed
04-05 01:34:18.187: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/AbstractConnectionBean; (256)
04-05 01:34:18.187: W/dalvikvm(479): Link of class 'Landroid/androidVNC/AbstractConnectionBean;' failed
04-05 01:34:18.187: W/dalvikvm(479): Unable to resolve superclass of Landroid/androidVNC/ConnectionBean; (8)

任何线索?

推荐答案

尽管库项目有自己的Andr​​oidManifest.xml中,其内容不会添加到您的构建。任何库包含了通常在清单中声明必须被复制到实际的应用程序清单,如果你打算使用它们。这包括的活动,广播接收器,服务,权限等。

Even though library projects have their own AndroidManifest.xml, its contents are not added to your build. Anything the library contains which is normally declared in the manifest must be copied to your actual application manifest if you plan to make use of them. This includes activities, broadcast receivers, services, permissions, etc.

这篇关于机器人:如何启动活动在库项目中定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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