1 Introduction
Computer environment: Ubuntu 18.04
Development tool environment: Android Studio version 4.1.3
You often need to use the verification Java API and record the steps to configure the environment.
2. Create steps
2.1 Create a new Android Studio App project
New ---> New Project ---> Select an Activity theme ---> Finish and create OK
2.2 Create a new Module
New---> New Module ---> Select a Module Type
We choose Java or Kotlin Library
Libray Name: lib (can be customized) Class name: MyClass (can be customized)
2.3 Click finish to create ok
Add the test code and click Run ----> Run 'MyClass'
3. Environmental issues
The source code has been imported into the AS environment before. When I create a new java Module this time, the String System display is always red.
After referring to many solutions on the Internet, I found that this one worked:
Finally, I found out that it was a problem with the build cache. The Internet said that it can be solved after clearing the build cache:
step:
1. After opening AS, click File to find the Invalidate Caches/Restart below
2. Click Invalidate Caches/Restart and a choice will pop up.
3. Just click Invalidate and Restart in the pop-up dialog box. It will automatically clear the buffer and restart the AS.
There are also reports on the Internet that after String System was reported red, the configuration of the Application was modified:
In fact, it is not necessary. As long as your AS environment is normal, this is automatically set up by AS for you and does not require manual configuration.
I just recorded the solution, and it took me a long time to figure it out.
4. Solutions
Invalidate Caches/Restart ---> Invalidate and Restart