1

I had just finished building my app, and everything runs great. So I decided to create a lite version of it as well. I converted my android project to an android library and created a lite project and a full project that each reference the library.

I ran my full version this way and it worked great. I then tried to run my lite version and it complains with "SecurityException: Not allowed to bind to service Intent..."

It's referring to the local service that I bind to from each activity.

I'm guessing that because the service has the same package name in both apps, the lite app gets confused and tries to connect to the full app's service...

How can I fix this with as little disruption as possible?

4

1 に答える 1

0

えっと、返信がなかったので…結局何をしたかを共有したいと思いました。2 つのアプリケーションにデプロイされた場合に固有のパッケージ名を必要とするサービスについて、私の疑いは正しかった。

そのため、ライブラリと 2 つのプロジェクトの代わりに、Android プロジェクトを 1 つだけ持つようになりました。その中に、実行したいものに応じて変更する静的フラグ定数があります。あるケースでは、フラグをオフにして APK を生成します。次に、プロジェクト全体のパッケージの名前を変更し (Eclipse リファクタリング)、フラグをオンにして別の APK を生成します。

フラグがオンの場合、アプリケーションの一部がロックされます (非常に軽量なバージョン)。オフのときは完全版です。

完了したら、ベースに戻り、すべての変更を消去します。

これは私が望んでいた理想的なソリューションではありませんが、わずか 1 分で完了します。ですから大したことではありません。

于 2012-10-30T22:55:41.157 に答える