The solution of Unity2019 version packaging has been stuck at detecting current sdk tools version

1. Our company generally accesses the external network through a proxy. As for how to set up a proxy in Unity, you can refer to my blog .

2. Therefore, it is very troublesome to package according to the android version of Unity. So I won't go into details about the android SDK JDK that Unity relies on. Many blogs are writing about how to install this.

3. After all installations are complete. We need to install Gradle-5.6.4 and Gradle's plugin 3.6.0. This step is very important. Unity uses Gradle-5.6.4 when packaging, and Gradle and its plugin cache are very important.

Open android studio, click File->Project Structure

Pop-up configuration Gradle Version and Gradle Plugin Version

 Click OK and wait for the sync download to complete. Then it's time to configure Unity.

4、配置Unity,Edit->Preferences->External Tools

 5. Importantly, if the configured Gradle path is not Gradle-5.6.4 downloaded and cached by Android Studio, it will be stuck in the step of detecting current sdk tools version for a long time during packaging. When I installed the Unity environment, I used the Gradle downloaded by myself, and the packaging took a long time. I used the Gradle path cached by Android Studio, and the packaging was very fast. Although many people suggest disconnecting the network to solve the card problem, it is inconvenient. Everyone try my method. This method solved my problem. Important, important, important, be sure to use the Android Strudio cached version of Gradle.

6. If the above can't solve your problem, I've been fine recently, but then it didn't work again, and I started to get stuck in detecting current sdk tools version for a long time. I debugged and found that because unity will call the sdkmanager.bat --list command under the tools file in the adndroid sdk when packaging, this command will check the version of the sdk, as well as the downloaded tools, will download the comparison file, This download file takes a lot of time. Because our company generally does not have a network, it is basically impossible to download and shows that it has been stuck here.

My ultimate trick is that there is no problem with my android sdk installation, no need to check, so I modified the sdkmanager.bat script, and there is no need to execute the check command. Open the tools/bin/sdkmanager.bat script in the android sdk directory, and then comment out the following line.

@rem "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS%  -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli %CMD_LINE_ARGS%

If the reported version number is less than 23.0.0, you are deleting the comment and restoring it. It should be checked every time it is packaged.

7. Or if you have a proxy, you can modify this command line to add proxy "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %SDKMANAGER_OPTS% -classpath "%CLASSPATH%" com.android.sdklib.tool.sdkmanager.SdkManagerCli - -no_https --proxy=http --proxy_host=xxx.xxx.xxx.xxx --proxy_port=808 %CMD_LINE_ARGS% 

Guess you like

Origin blog.csdn.net/grace_yi/article/details/119651501