The solution

In order to avoid the detour of friends, first directly post the solution, the rest of the content is just to record and restore the problem.

Change Android Platform Tools 29 to Android Platform Tools 28.

Problem reproduction

Strangely enough, I went out for a lab class and came back to Android Studio and couldn’t compile the Flutter app. Part of the console output is as follows:

Exit code -1073740940 from C:\SDK\platform-tools\adb -s emulator-5554 shell -x logcat -v time -t l
Copy the code

Adb –version = adb –version = adb –version

Android Debug Bridge version 1.0.40
Version 29.0.1-5303910
Installed as C:\SDK\platform-tools\adb.exe
Copy the code

Because Tai CAI could not see the problem, I thought to flutter doctor to check the problem. The partial output is as follows:

[√] Flutter (Channel Master, V1.7.2-pre-30, on Microsoft Windows [Version 10.0.17763.529], locale zh-CN) [!]  Android toolchain - developfor Android devices (Android SDK version 29.0.1)
     × Android license status unknown.
     Try re-installing or updating your Android SDK Manager.
     See https://developer.android.com/studio/#downloads or visit https://flutterchina.club/using-ide/ to get more instructions.[√] Android Studio (Version 3.4) [√] VS Code, 64-bit Edition (Version 1.34.0) [!]  Connected device ! No devices available ! Doctor found issusesin 2 categories.
Copy the code

So the problem is probably Android license? Here’s the solution: Reinstall or upgrade the SDK Manager

  • reinstall

    The reinstallation obviously failed, and the output is basically the same and is no longer posted

  • To upgrade the SDK Manager

    CD C:\SDK\tools\bin, run sdkManager –update directly.

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
Copy the code

Apparently the solution given by Flutter Doctor did not work, so one had to search the Internet for a wave. Solutions such as ADB kill do not work

A furious reload of Android Studio, flutter Docor, added the following line of output:

Error retrieving device properties for ro.product.cpu.abi
Copy the code

However, there was still no solution when I used this to search, so I had to climb the wall to look for it (after all, Google stuff). Soon I found the first issue of May 26, 2017, which was basically unsolved after I pulled down the issue. So I continued to find the second issue of 23 Apr 2018. Near the end of the page, I found a comment as follows, which was published two days ago, 6 June 2019, around the time when I had the problem

This is a problem with platform tools 29. Temporary fix in my issue
Copy the code

In the comments, it should be platform Tools 29. Later, he mentioned an issue. After clicking on it, he got a solution.

Install the latest version of android studio beta on windows (platform tools 29 will be installed)
Copy the code

OK, this is where the problem becomes simple: degrade Platform Tools

  1. Open the SDK folder
  2. Remove the platform-tools folder (verify that adb related processes are terminated)
  3. Unpack platform-Tools 28 and replace it

(The SDK Manager for Android Studio also seems to be able to downgrade directly, but I don’t know why it doesn’t work, so I recommend downloading it and replacing it manually.)

The download address is as follows:

Windows: http://dl-ssl.google.com/android/repository/platform-tools_r28.0.2-windows.zip
macOS: http://dl-ssl.google.com/android/repository/platform-tools_r28.0.2-darwin.zip
Linux: http://dl-ssl.google.com/android/repository/platform-tools_r28.0.2-linux.zip
Copy the code

OK, bash flutter doctor, all green pass ~

Open the AVD and take a group photo

I found a temporary fix while we wait for a solution provided by the Flutter team

Hopefully Flutter will be nicer to me and less buggy