While working with Android Studio, you may come across a situation where there is no java option is available to create a new empty activity in the New Project wizard. This can be frustrating, especially if you prefer working with Java rather than Kotlin. Fortunately, there are several steps you can take to resolve this issue and restore the ability to create empty functions using Java.
To resolve this and enable the Java option for creating an empty activity, follow these steps:
1. Start a New Android Project
Download and open Android Studio and select “Start a new Android Studio project” from the welcome screen.
2. Configure Project Details
Fill in the project details such as the name, package name, and location for your new Android project. Click “Next” to proceed.
3. Choose Activity Template
In the “Select the form factors your app will run on” screen, choose the phone and tablet option, and then click “Next”.
4. Select Activity Template
Here’s where the crucial step comes in. Do not select “Empty Activity” from the list of activity templates. Instead, choose “Empty View Activity”. This distinction is important because selecting “Empty Activity” defaults to Kotlin as the language, while “Empty View Activity” allows you to choose between Java and Kotlin.
5. Choose Java Language
After selecting “Empty View Activity”, click “Next”. In the subsequent screen where you name your activity, you’ll have the option to select the language. Choose “Java” from the dropdown menu next to “Source Language”.
6. Complete Project Setup
Continue filling out any remaining details for your activity and click “Finish” to create the project.
7. Verify Java Project Setup
Once your project is created, verify that the project setup includes Java as the language. You should now have a Java-based empty view activity ready for development.
By following these steps and specifically choosing “Empty View Activity” instead of “Empty Activity” during project setup, you ensure that the Java language option is available for creating your activity. This method should resolve the issue of not being able to create a Java project in Android Studio due to activity template selection.
Read more contents:- https://bytelure.in/category/code-hub