如何在不使用 Eclipse 的情况下创建 .apk 文件

发布于 2025-01-05 02:53:48 字数 79 浏览 2 评论 0原文

我想为Android创建“Theme Creator”,所以我想在创建主题后创建.apk文件。谁能指导我如何进行?在这方面的任何帮助将不胜感激。

I want to create "Theme Creator" for Android, so I want to create .apk file after creating theme. Can anyone guide me how to proceed? Any help in this regard will be well appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

话少情深 2025-01-12 02:53:48

我发现在没有 eclipse 或没有任何其他 IDE 的情况下创建 .apk 的最佳方法是使用 maven 与此简洁的插件:Maven-Android-Plugin。它得到积极维护并且有很好的记录。您可以从示例开始。

这种方法的缺点是必须更改构建过程,并且 IDE 不会隐藏所有肮脏的小细节。

其优点是可以完全控制构建、签名、代码审核、CI 集成以及 IDE 的自由选择。

The best way I have found to create .apk without eclipse, or without any other IDE is to use maven with this neat plugin : Maven-Android-Plugin. It is actively maintained and quite well documented. You can start off with a sample.

The downside of this approach is that one has to change the build process and not every dirty little detail is hidden by the IDE.

The upsides are a full control of the build, signing, code audits, CI integration and the free choice of the IDE.

谜泪 2025-01-12 02:53:48

SDK的工具准备的项目中,您可以构建一个.apk 使用 ant debug 启动。

您还可以学习直接使用 SDK 工具,并通过 Makefile 或脚本自动化您所学到的知识。 Terminal IDE 是一个提供设备上开发环境的市场应用程序,不需要 ant、make 或更多涉及的构建系统,因此它的示例项目附带了直接调用 javac、dx、aapt 的脚本。例如,我在此系统下的构建脚本之一:

set -x
P=net/rapacity/wizardry

rm src/$P/R.java
mkdir -m 770 -p dist || exit
mkdir -m 770 -p build/classes || exit

aapt p -f -M AndroidManifest.xml -F build/resources.res \
     -I ~/system/classes/android.jar -S res/ -J src/$P || exit

cd src
for F in \
         sokoban2/{Maze,TileView,MazeActivity}.java \
         R.java Maze.java EmptyActivity.java {emptyquiet,gadgets,sokoban}/Maze{,Activity}.java \
; do
  echo $F > ~/tmp/.remake
  javac -d ../build/classes $P/$F 2> ~/tmp/javac.out
  ../redcat ~/tmp/javac.out
  grep error ~/tmp/javac.out && exit
done
cd ..

( cd build/classes; dx --dex --verbose --no-strict --output=../core.dex net ) || exit

apkbuilder dist/core.apk -u -z build/resources.res -f build/core.dex || exit
signer dist/core.apk core-debug.apk

所有对 redcat、javac.out 等的大惊小怪都是在出现错误时中断构建(无论成功与否,javac 无助地返回 0),并允许快速执行重新执行上次尝试的编译,以查看错误是否已修复。 ant、maven,甚至合理使用make,都会为你提供这些东西。

In a project prepared by the SDK's tools, you can build an .apk with ant debug, to start.

You can also learn to directly use the SDK tools, and automate what you've learned with Makefiles or scripts. Terminal IDE, a market app that provides an on-device development environment, does so without ant, or make, or more involved build systems, so its example projects come with scripts that directly call javac, dx, aapt. For example, one of my build scripts under this system:

set -x
P=net/rapacity/wizardry

rm src/$P/R.java
mkdir -m 770 -p dist || exit
mkdir -m 770 -p build/classes || exit

aapt p -f -M AndroidManifest.xml -F build/resources.res \
     -I ~/system/classes/android.jar -S res/ -J src/$P || exit

cd src
for F in \
         sokoban2/{Maze,TileView,MazeActivity}.java \
         R.java Maze.java EmptyActivity.java {emptyquiet,gadgets,sokoban}/Maze{,Activity}.java \
; do
  echo $F > ~/tmp/.remake
  javac -d ../build/classes $P/$F 2> ~/tmp/javac.out
  ../redcat ~/tmp/javac.out
  grep error ~/tmp/javac.out && exit
done
cd ..

( cd build/classes; dx --dex --verbose --no-strict --output=../core.dex net ) || exit

apkbuilder dist/core.apk -u -z build/resources.res -f build/core.dex || exit
signer dist/core.apk core-debug.apk

All that fussing with redcat, javac.out, et al., is to interrupt the build on an error (javac unhelpfully returns 0 no matter the success), and to allow a quick re-do of the last-attempted compile, to see if errors have been fixed. ant, maven, even a reasonable use of make, will provide this stuff for you.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文