Android的:如何使用"使用库"? [英] Android: How to Use "uses-library"?

查看:127
本文介绍了Android的:如何使用"使用库"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Andr​​oid应用可分为一客户端UI层和API层。我想将它们部署为独立的应用程序,这样的API层,可重复使用。

My Android application can be divided into a client UI layer and a API layer. i would like to deploy them as separate "applications" so that the API layer can be reused.

在Eclipse中,我把它们写为2个独立的Andr​​oid项目。在客户端UI项目,我宣布API项目在其构建路径(项目 - >性的判定 - > Java构建路径 - >项目)

In Eclipse, i write them as 2 separate Android projects. In the client UI project, i declare the API project in its build path (Project -> Properies -> Java Build Path -> Projects).

在部署通过Eclipse的(在我的实际G1手机)客户端UI项目,它会自动部署API项目(打包成APK)为好。

When deploying the client UI project through Eclipse (on my actual G1 phone), it automatically deploys the API project (packaged into APK) as well.

然而,启动客户端用户界面应用程序时,我打这个错误:

However, when launching the client UI application, i hit this error:

Uncaught handler: thread main exiting due to uncaught exception
java.lang.VerifyError: myapp.android.testuiclient.Main
    at java.lang.Class.newInstanceImpl(Native Method)
    at java.lang.Class.newInstance(Class.java:1472)
    at android.app.Instrumentation.newActivity(Instrumentation.java:1097)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2316)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2417)
    at android.app.ActivityThread.access$2100(ActivityThread.java:116)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:4203)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:521)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    at dalvik.system.NativeStart.main(Native Method)

环顾四周,它的似乎的我应该在清单文件UI客户端应用程序下使用声明库。

Looking around, it seems like i should declare uses-library under application in the manifest file for the UI client.

问题是,我应该把下机器人:名称用途库?开发指南说,库之名,但什么是库的名字? (我的意思是,在我的API应用程序,我还没有宣布任何库名称的任意位置。)

Question is, what should i put under android:name for uses-library? Dev guide says "the name of the library" but what is the name of the library? (i mean, in my API "application", i haven't declared any library name anywhere.)

推荐答案

我不相信<使用库> 是与此有关

您的选择是:

  1. 实现你的图书馆作为一个JAR,被列入其他项目在编译时。只要你的库是不是试图定义资源,你在造型精美。见CWAC项目出对我的 github上页如何设置此样品。

实现你的图书馆为包含远程服务,使用AIDL定义了一个单独的APK。不要试图融入他们的构建路径,你是presently做在Eclipse中,而是按照AIDL规则,让每个项目中使用一个共同的AIDL定义。您还需要安排您的用户同时安装的APK。

Implement your "library" as a separate APK containing a remote service, defined using AIDL. Do not attempt to blend their build paths as you are presently doing in Eclipse, but rather follow the AIDL rules and have each project use a common AIDL definition. You will also need to arrange for your users to install both APKs.

这篇关于Android的:如何使用"使用库"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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