我目前正在使用eclipse for JAVA,因为Intellij IDEA是在付费的Licence.However下,我正在使用Android Studio进行Android开发。我可以使用Android Studio编写纯JAVA,这样就不必学习两种不同的IDE(快捷键等)吗?
发布于 2019-11-22 05:02:25
对此的简短回答是:是的,你可以。看看这篇slackoverflow帖子:
Can Android Studio be used to run standard Java projects?
Android Studio IDE基于IntelliJ,但为Android Development添加了一些特定的插件。就此而言,您可以使用Android Studio For Java dev,就像您可以使用Android dev的IntelliJ一样。这两者非常相似,但也有一些明显的区别。如果你精通这两种语言中的一种,那么切换到其他语言就不会有任何问题。现在,我推荐使用IntelliJ for Java dev (免费版)和Android Studio for Android dev。
发布于 2019-11-22 04:58:31
Yes Just Follow These Steps
1. Open a new Project and choose your Destination path and initial
settings: Hit Next on Form Factors (doesn’t matter) > Choose No
Activity and Finish
2. In the dropdown view Select Project
3. Remove app Directory and in Settings.gradle delete include ‘:app’ > ignore the Sync Now prompt at the top of the screen in Android Studio
4. Replace build.gradle code with the following > Then click Sync Now prompt
apply plugin: 'java'
sourceCompatibility = 1.8
version = '1.0'
repositories {
mavenCentral()
}
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
}
5. Configure src and Child Directories main, java, foo and .java Class > Add in main class to construct code and print results
public static void main(String[] arg) {
String hi = "Hello World";
System.out.println(hi);
}
6. Configure Android Studio to run your Java Class properly: Edit Configurations > ‘+’ > Application
7. Get Runin’!https://stackoverflow.com/questions/58983534
复制相似问题