从Android的外部JAR调用服务Android、JAR

2023-09-07 16:31:51 作者:转身、你已卟在

我试图调用存储在外部JAR文件到我的Andr​​oid应用程序在Android的服务。当我在导入JAR,一切工作正常,除了服务。如果我手动复制服务文件放入包中,并给它一个新的名字,它的工作原理,而是由对骂同样的服务而不是当它存储在JAR。我已经包括包路径,以及调用服务时。任何帮助是极大的AP preciated。

I am trying to call an Android service which is stored in an external JAR file into my android application. When I import the JAR in, everything works fine except the service. If I manually copy the service file into the package and give it a new name, it works, but not when calling the same service by the name it's stored as in the JAR. I have included the package path as well when calling the service. Any help is greatly appreciated.

推荐答案

您将需要添加的服务宣言到您的清单,即使它被包含在一个外部罐子。

You will need to add the service declaration into your manifest even if it is contained in an external jar.

例如:

<service android:name="com.whatever.something.SomeService"/>