Run Java code in Android Studio

As an Android developer, we usually need to test the correctness of a piece of Java code. If you run it directly in the App, the efficiency is extremely low. Creating a new Java file in Android Studio and running it will report an error, and opening a new Idea will consume a lot of memory. So how exactly do we run pure Java code in Android Studio?

Running the Java method directly in Android Studio will report the following error

solution

You need to modify the gradle.xml file under the .idea folder, and add the following code under the GradleProjectSettings tag

<option name="delegatedBuild" value="false" />

Just run the code again~

Guess you like

Origin blog.csdn.net/jiaweilovemingming/article/details/127627475