bug提示
Build-tool 31.0.0 is missing DX at /Users/lijunde/Library/Android/sdk/build-tools/31.0.0/dx
Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
解决办法 31.0.0版本的构建工具缺少了"dx.bat"和"dx.jar"这两文件, 把"d8.bat"和"d8.jar"这两文件,改名为"dx.bat"和"dx.jar",
文件的大致路径为:Sdk\build-tools\31.0.0 C:\Users\user\AppData\Local\Android\Sdk\build-tools\31.0.0\d8.bat C:\Users\user\AppData\Local\Android\Sdk\build-tools\31.0.0\lib\d8.jar
?AppData 是一个隐藏文件夹。打开隐藏文件显示
其他方案让你降级到Android11,不能根本解决问题。
https://stackoverflow.com/questions/68387270/android-studio-error-installed-build-tools-revision-31-0-0-is-corrupted
可能还会出一个bug Manifest merger failed : Apps targeting Android 12 and higher are required to specify an explicit value for `android:exported` when the corresponding component has an intent filter defined.
解决办法
?在AndroidManifest.xml文件中给入口activity,添加android:exported,例如:
<activity android:name=".MainActivity" android:exported="true">
|