1. Error reason:
Note: An error was reported when running the android project: Let’s just say that the code has been checked many times (^_^)!!! Anyway, the code can be sure that it is correct, so I searched online
Add the following code to build.gradle (Module.app) as prompted
android{
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
Then I recompiled and found that I can't do it , (^_^)!! It's like this when I run it. This small project needs this configuration but I can't do it, ( but some people can run it successfully )
2. Solution:
I searched online, stumbled, stumbled, and finally solved it! (The reason why I can't run successfully is that my Compile Sdk Version is 32, so I can't compile successfully)
(1) Method 1: Just lower your version, you can directly modify it from build.gradle (Module: app), click Sync Now in the upper right corner to synchronize, 30 or 29 are fine, close and reopen after modification
(2) Method 2: In the build.gradle(Module:app) file, click Open Project Structure in the upper right corner
Close and reopen after making changes
3. Results
It worked!!!