flutter build apk 反复安装平台工具
flutter build apk installing platform-tools repeatedly
我已经在 windows-10 上安装了 flutter 和 android-SDK(没有 android studio)。安装成功完成,一切正常,网络上没有错误,但是当我 运行
flutter build apk
它会抛出一些警告
Building with sound null safety
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Checking the license for package Android SDK Platform-Tools in C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools\licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 31.0.3)".
Warning: Package "com.android.repository.impl.generated.v1.RemotePackage@5f56b0a9" (platform-tools) should be installed in
"C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools\platform-tools" but
it already exists.
Installing in "C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools\platform-tools-2" instead.
Running Gradle task 'assembleRelease'...
它开始下载 platform-tools 、 build-tools 和 emulator (如果已经存在,它仍然会像 platform-tools-2 、 build-tools-2 和 emulator-2 一样一次又一次地下载)
我的flutter doctor -v
是
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.17763.195], locale en-IN)
• Flutter version 2.5.0 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (10 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools
• Platform android-30, build-tools 29.0.2
• ANDROID_HOME = C:\Users\ItzJVS\AppData\Local\android
• Java binary at: C:\Program Files\Java\jdk1.8.0_301\bin\java.exe
• Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.60.1)
• VS Code at C:\Users\ItzJVS\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.26.0
[√] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
! Doctor found issues in 1 category.
I'm not getting what I'm doing wrong can some one help me to resolve this .. ThankYou..
显然您只需要正确设置 android sdk 文件结构。
我制作了这个后续视频,展示了要遵循的步骤。
The Video
或按照以下步骤操作:
安装flutter sdk 和 java jdk 并将主题添加到系统的环境变量中。
前往 https://developer.android.com/studio#command-tools 并仅下载命令行工具并将 zip 文件解压缩到 c:\ANDROID-SDK 将其添加到环境变量 'ANDROID_SDK_ROOT' : "c:\ANDROID-SDK"
现在在CMD中打开如下路径"C:\ANDROID-SDK\cmdline-tools\bin"
运行命令sdkmanager.bat "cmdline-tools;latest" --sdk_root=../../
现在将其添加到您的环境变量路径“C:\ANDROID-SDK\cmdline-tools\latest\bin”
接下来打开CMD安装build-tools "sdkmanager.bat "build-tools;30.0.3"
"
然后平台sdkmanager.bat "platforms;android-31"
现在运行flutter config --android-sdk %ANDROID_SDK_ROOT%
运行 flutter doctor --android-licenses
并接受许可。
现在去你的项目运行flutter build apk
希望这对遇到同样问题的人有所帮助
我已经在 windows-10 上安装了 flutter 和 android-SDK(没有 android studio)。安装成功完成,一切正常,网络上没有错误,但是当我 运行
flutter build apk
它会抛出一些警告
Building with sound null safety
Warning: Mapping new ns http://schemas.android.com/repository/android/common/02 to old ns http://schemas.android.com/repository/android/common/01
Warning: Mapping new ns http://schemas.android.com/repository/android/generic/02 to old ns http://schemas.android.com/repository/android/generic/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/addon2/02 to old ns http://schemas.android.com/sdk/android/repo/addon2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/repository2/02 to old ns http://schemas.android.com/sdk/android/repo/repository2/01
Warning: Mapping new ns http://schemas.android.com/sdk/android/repo/sys-img2/02 to old ns http://schemas.android.com/sdk/android/repo/sys-img2/01
Checking the license for package Android SDK Platform-Tools in C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools\licenses
License for package Android SDK Platform-Tools accepted.
Preparing "Install Android SDK Platform-Tools (revision: 31.0.3)".
Warning: Package "com.android.repository.impl.generated.v1.RemotePackage@5f56b0a9" (platform-tools) should be installed in
"C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools\platform-tools" but
it already exists.
Installing in "C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools\platform-tools-2" instead.
Running Gradle task 'assembleRelease'...
它开始下载 platform-tools 、 build-tools 和 emulator (如果已经存在,它仍然会像 platform-tools-2 、 build-tools-2 和 emulator-2 一样一次又一次地下载)
我的flutter doctor -v
是
[√] Flutter (Channel stable, 2.5.0, on Microsoft Windows [Version 10.0.17763.195], locale en-IN)
• Flutter version 2.5.0 at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 4cc385b4b8 (10 days ago), 2021-09-07 23:01:49 -0700
• Engine revision f0826da7ef
• Dart version 2.14.0
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at C:\Users\ItzJVS\AppData\Local\android\cmdline-tools\tools
• Platform android-30, build-tools 29.0.2
• ANDROID_HOME = C:\Users\ItzJVS\AppData\Local\android
• Java binary at: C:\Program Files\Java\jdk1.8.0_301\bin\java.exe
• Java version Java(TM) SE Runtime Environment (build 1.8.0_301-b09)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.60.1)
• VS Code at C:\Users\ItzJVS\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.26.0
[√] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 93.0.4577.82
! Doctor found issues in 1 category.
I'm not getting what I'm doing wrong can some one help me to resolve this .. ThankYou..
显然您只需要正确设置 android sdk 文件结构。 我制作了这个后续视频,展示了要遵循的步骤。 The Video
或按照以下步骤操作:
安装flutter sdk 和 java jdk 并将主题添加到系统的环境变量中。
前往 https://developer.android.com/studio#command-tools 并仅下载命令行工具并将 zip 文件解压缩到 c:\ANDROID-SDK 将其添加到环境变量 'ANDROID_SDK_ROOT' : "c:\ANDROID-SDK"
现在在CMD中打开如下路径"C:\ANDROID-SDK\cmdline-tools\bin"
运行命令
sdkmanager.bat "cmdline-tools;latest" --sdk_root=../../
现在将其添加到您的环境变量路径“C:\ANDROID-SDK\cmdline-tools\latest\bin”
接下来打开CMD安装build-tools "sdkmanager.bat "build-tools;30.0.3" "
然后平台
sdkmanager.bat "platforms;android-31"
现在运行
flutter config --android-sdk %ANDROID_SDK_ROOT%
运行
flutter doctor --android-licenses
并接受许可。现在去你的项目运行
flutter build apk
希望这对遇到同样问题的人有所帮助