Android Studio: How to build command-line Android activity with no view (NOT how to build *with* command line)

依然范特西╮ 提交于 2019-12-12 00:16:51

问题


I need to build a command-line tool that I can run in an Android shell.

This question is not about how to build using command-line tools, which is pretty much all I find when I search SO/google for this question.

What I can do: Write a simple Java jar that runs from app_process

What I want: A tool that uses Android libraries (such as the packagemanager) that runs from the command line (such as an 'adb shell') and then exits - so not an App, doesn't have a view and isn't really following the Android life-cycle.

So presumably I either need to figure out how to build such a tool either from an IDE (such as Android Studio) or else from the command-line using the Android libraries.

Someone gave the (mostly) reasonably suggestion that I just look at how 'pm' is compiled, though I can't figure out how to do that without downloading the entire Android source and doing a full build (and I don't really have the time or HD space for that).

So I suppose another solution would be if someone could just telling me how to compile 'pm' since I could repurpose that for my needs.

来源:https://stackoverflow.com/questions/30946516/android-studio-how-to-build-command-line-android-activity-with-no-view-not-how

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!