Tag Archives: Virtual machine error

[Solved] Virtual Machine Error: FAILURE: Build failed with an exception.Flutter

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
> Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'.
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(http://storage.flutter-io.cn/download.flutter.io)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See https://docs.gradle.org/7.4/dsl/org.gradle.api.artifacts.repositories.UrlArtifactRepository.html#org.gradle.api.artifacts.repositories.UrlArtifactRepository:allowInsecureProtocol for more details. 

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 50s
Exception: Gradle task assembleDebug failed with exit code 1

 

Solution:

Although there are many tutorials online, but there is no solution to this solution, the early my attention are in the first sentence, only to know that the original focus is the latter sentence, the main error is in the http and https protocol, Just modify HTTP to HTTPS of the system variable FLUTTER_STORAGE_BASE_URL variable value.

Solutions to errors in virtual machine running in Android studio

When starting the virtual machine in Android studio, there may be an error message in the “event log” of the main interface. At this time, the virtual machine can still run.

1. Solution to failed to open/qemu.conf

“Emulator: error | failed to open/qemu.conf, err: 2” (Figure 1 ②) is displayed in “event log” (Figure 1 ①), and the error message is “failed to open qemu.conf file”.

1.1 qemu.conf file

QEMU is a set of simulation software that can simulate another set of operating system in Windows operating system. Because it can simulate a virtual CPU in the system, and then hand over the operating system to be simulated to the virtual CPU for processing, it can achieve the purpose of executing two operating systems on the same platform at the same time.

Qemu.conf is the configuration file of Android studio virtual machine. When the virtual machine starts, you need to read the information of the configuration file. By default, the configuration file is in the root directory of drive C.

1.2 solutions

Create qemu.conf file in the root directory of drive C. First, open “this computer” on the desktop, click “view” in the toolbar (Figure 2 ①), and then select “file extension” (Figure 2 ②). The purpose of this operation is to display the file extension so that the file extension is changed to “conf”.

 

Figure 2 shows the file extension

Then, create a new text file in the root directory of drive C and rename it “QEMU. Conf”, as shown in Figure 3.

Figure 3 qemu.conf file

Run the simulator again at this time, and the above error prompt will not appear again.

2. Solution to unexpected system image feature string

When the simulator is running, “emulator: warning | unexpected system image feature string. Emulator may not function correctly.please try updating the emulator” is displayed in “event log”. The prompt means “unexpected system image feature string. The virtual machine may not work properly. Please update the virtual machine.”

 

Figure 4 warning message

For such error messages, you can lower the API level of the virtual machine. For example, if the API level of the current virtual machine is 30 and the above warning information will be displayed, delete the virtual machine and create a virtual machine with API level 29, as shown in Figure 5.

 

Figure 5 virtual machine API level