Kostas Konnidis
Kostas Konnidis

Reputation: 49

Can I use Android studio for pure JAVA development

I am currently using eclipse for JAVA since Intellij IDEA is under paid Licence.However, I am using Android Studio for Android development. Could I use Android Studio to write pure JAVA so as to not have to learn two different IDEs (shortcuts etc)?

Upvotes: 2

Views: 5998

Answers (2)

Fabrizio Botalla
Fabrizio Botalla

Reputation: 742

The short answer to this is : Yes you can. Look over this slackoverflow post:

Can Android Studio be used to run standard Java projects?

Android Studio IDE is based on IntelliJ, but with some specific plugins added for Android Development. For that matter you could use Android Studio for Java dev just as much as you can use IntelliJ for Android dev. The two are very similar with some obvious differences. If you are proficient with one of the two you won't have any problems switching to the others. Now, my recommendation is to use IntelliJ for Java dev (free version) and Android Studio for Android dev.

Upvotes: 2

Dpk
Dpk

Reputation: 645

    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’!

Upvotes: 1

Related Questions