java 我可以在没有 IDE 的情况下开发 Android 应用程序吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29290588/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I develop Android apps without an IDE?
提问by Avra Neel
Is it possible to develop Android apps using only the Android SDK, without any IDE like Android Studio?
是否可以仅使用 Android SDK 开发 Android 应用程序,而无需像 Android Studio 这样的 IDE?
回答by Dave Barker
Yes, see the Google SDK documentation.
是的,请参阅Google SDK 文档。
However, with the current toolchain and documentation it'll be an uphill struggle. I'm trying to do this too (for a dev who lives in Vim and Unix tools, Android Studio is needlessly slow and bloated).
但是,使用当前的工具链和文档,这将是一场艰苦的斗争。我也在尝试这样做(对于使用 Vim 和 Unix 工具的开发人员来说,Android Studio 不必要地缓慢和臃肿)。
The main issues I've found so far:
到目前为止我发现的主要问题:
The SDK documentationgives instructions to create an Ant-driven project, but the SDK is now geared towards using Gradle. If you're working through the Google documentation in a linear fashion, you'll find subsequent lessons have you issue Gradle build instructions. For your Ant-built project.
There is very little documentation on how to actually create a Gradle-built project from the command line. The command line I use is:
android create project --target android-22 --name MyProjectName --path my_project/ --activity MyProject --package com.example.android.myproject --gradle --gradle-version 1.2.2
The
--gradle-version
actually refers to the Gradle Android plugin version, not the version of Gradle itself. Finding this out wasn't easy.Even if you get it to create a project properly, it probably won't build without further manipulation. One of the generated files (
project/build.gradle
) has an invalid directive name (runProguard
- I'm guessing it's now deprecated). That must be changed tominifyEnabled
before the project will build. And using the Gradle plugin 1.2.2, the fileproject/gradle/wrapper/gradle-wrapper.properties
has the Gradle distribution incorrectly listed asgradle-1.2.2-all.zip
. This should begradle-2.2.1-all.zip
.These are files generated by the SDK with errors.
The documentation is focussed on IDE-based development. Once you get past the initial few pages on creating and managing a project using the command line, it's very IDE-focussed.
Instructions on things like changing an app Theme are difficult or impossible to follow as they omit steps that the IDE performs for you.
该SDK文档发出指令,以创建一个Ant驱动的项目,但SDK现已面向对使用摇篮。如果您以线性方式阅读 Google 文档,您会发现后续课程会发布 Gradle 构建说明。用于您的 Ant 构建项目。
关于如何从命令行实际创建 Gradle 构建的项目的文档很少。我使用的命令行是:
android create project --target android-22 --name MyProjectName --path my_project/ --activity MyProject --package com.example.android.myproject --gradle --gradle-version 1.2.2
该
--gradle-version
实际上指的是摇篮Android插件版本,而不是摇篮本身的版本。发现这一点并不容易。即使你让它正确地创建了一个项目,它可能不会在没有进一步操作的情况下构建。生成的文件之一 (
project/build.gradle
) 具有无效的指令名称(runProguard
- 我猜它现在已被弃用)。minifyEnabled
在项目构建之前,必须将其更改为。并且使用 Gradle 插件 1.2.2,该文件project/gradle/wrapper/gradle-wrapper.properties
将 Gradle 发行版错误地列为gradle-1.2.2-all.zip
. 这应该是gradle-2.2.1-all.zip
。这些是由 SDK 生成的有错误的文件。
该文档侧重于基于 IDE 的开发。一旦您了解了使用命令行创建和管理项目的最初几页,它就会非常注重 IDE。
有关更改应用程序主题之类的说明很难或不可能遵循,因为它们省略了 IDE 为您执行的步骤。
In general, fully IDE-less development for Android (at least in Java, using the official SDK) is very painful. And my personal opinion is that IDE-based development is equally painful (slow, bloated, ugly on high-DPI screens under Linux and evidently full of magic that's a pain to replicate on the command line).
一般来说,Android 的完全 IDE-less 开发(至少在 Java 中,使用官方 SDK)是非常痛苦的。我个人的观点是,基于 IDE 的开发同样痛苦(在 Linux 下的高 DPI 屏幕上缓慢、臃肿、丑陋,并且显然充满了在命令行上复制的痛苦)。
Edit: I should add that the above refers to using SDK tools v24.2, SDK Platform-tools v22, SDK Build-tools v22.01 and Android API 22 (5.1.1).
编辑:我应该补充一点,以上是指使用 SDK 工具 v24.2、SDK Platform-tools v22、SDK Build-tools v22.01 和 Android API 22 (5.1.1)。
回答by MaxGreen
For android the basic debugging environments are: ADB DDMS Java Debugger
对于 android,基本的调试环境是: ADB DDMS Java Debugger
You can try with them. More details are here : http://developer.android.com/tools/debugging/debugging-projects-cmdline.html
你可以和他们一起试试。更多细节在这里:http: //developer.android.com/tools/debugging/debugging-projects-cmdline.html
回答by Kyaw
yes. You Can . Simply you can user Command Line . Command Android Development I will rather use IDE just to get things done faster.
是的。你可以 。您只需使用 Command Line 即可。命令 Android 开发我宁愿使用 IDE 来更快地完成工作。
回答by josedlujan
Sure, use command-line toolsBut... Why you dont want to use a IDE? You have a lot optiones.
当然,使用命令行工具但是... 为什么您不想使用 IDE?你有很多选择。
回答by Animesh Shrivastav
Writing an Android app on Notepad is what I do on my Windows Laptop.
在记事本上编写 Android 应用程序是我在 Windows 笔记本电脑上所做的事情。
First you configure your laptop as follows:
首先,您按如下方式配置您的笔记本电脑:
Download development Kits:Download a Java Development Kit 1.6 for Windows and an Android Development Kit . Similarly try downloading older version of Android kit GUI version of Kit Manager so that you can download essentials. Using kit Manager download Android-23 platform build tools. Android Studio may have slower performance, so try to avoid it.
Configure Kits:Set Windows
PATH
variable by right clickingMy Computer -> Properties -> Advanced System Settings
or change the appropriate settings in your Control Panel.PATH
should include the Java's compiler executable file in Java directory, and theandroid.bat
file of Android Kit.Download Build-Tool:(recommended, but Ant can be used too.) These programs configure the command-line tools for easy usage for our convenience. I downloaded version 2.2.1 as it can use old Java & old Android.
下载开发工具包:下载适用于 Windows 的 Java 开发工具包 1.6 和 Android 开发工具包。同样尝试下载旧版本的 Android 套件 GUI 版本的套件管理器,以便您可以下载要点。使用 kit Manager 下载 Android-23 平台构建工具。Android Studio 的性能可能较慢,因此请尽量避免。
配置套件:
PATH
通过右键单击My Computer -> Properties -> Advanced System Settings
或更改控制面板中的适当设置来设置 Windows变量。PATH
Java目录下应该包含Java的编译器可执行文件,以及android.bat
Android Kit的文件。下载 Build-Tool:(推荐,但 Ant 也可以使用。)这些程序配置命令行工具以方便我们使用。我下载了 2.2.1 版,因为它可以使用旧的 Java 和旧的 Android。
I've also written about these instructions on my GitHub Page: https://animeshshrivastav.github.io/
我还在我的 GitHub 页面上写了这些说明:https: //animeshshrivastav.github.io/