Brian Fraser | Plain Old Java in Android Studio: Android Programming @DrBFraser | Uploaded 4 years ago | Updated March 01 2023
Write and run plain old Java code (console output via main(), not for Android) in Android Studio.
[SOLUTION] Getting java.util.NoSuchElementException from a Scanner on System.in?
1. Expand the "Gradle Scripts" in your project view
2. Edit settings.gradle
3. Comment out (two //) the include ':app' line
Click Sync Now to resync your Gradle files
(This will change your project view; that's expected)
4. Re-run your program.
Note: If you use System.out.print() to print to the screen (note no linefeed) then it won't show up until after any pending System.in.nextXYZ() is finished.
Write and run plain old Java code (console output via main(), not for Android) in Android Studio.
[SOLUTION] Getting java.util.NoSuchElementException from a Scanner on System.in?
1. Expand the "Gradle Scripts" in your project view
2. Edit settings.gradle
3. Comment out (two //) the include ':app' line
Click Sync Now to resync your Gradle files
(This will change your project view; that's expected)
4. Re-run your program.
Note: If you use System.out.print() to print to the screen (note no linefeed) then it won't show up until after any pending System.in.nextXYZ() is finished.