背景:在 Debian 和 Ubuntu 上,可以安装免费许可的 Android SDK这些是通过运行 编译的apt install android-sdk
,显然没有附带限制性 EULA。Snap flutter
Store 中有一个软件包,但我决定使用来自flutter.dev网站。
我想使用 Ubuntu 的免费许可的 Android SDK 来为 Android 编译一个 Flutter 应用程序,但是 Flutter 演示应用程序的构建过程失败了。
$ sudo apt install android-sdk \
android-sdk-build-tools \
android-sdk-platform-tools \
android-sdk-helper \
android-sdk-platform-23
$ flutter config --android-sdk /usr/lib/android-sdk/
以下命令打印警告:
andrew@mercury:~$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.0, on Ubuntu 23.04 6.2.0-27-generic, locale
en_US.UTF-8)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
✗ cmdline-tools component is missing
Run `path/to/sdkmanager --install "cmdline-tools;latest"`
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run `flutter doctor --android-licenses` to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/linux#android-setup for
more details.
[✓] Chrome - develop for the web
[✓] Linux toolchain - develop for Linux desktop
[!] Android Studio (not installed)
[✓] Connected device (2 available)
[✓] Network resources
! Doctor found issues in 2 categories.
我将 Android 版本的 SDK 版本设置为静态版本号与 Ubuntu 中的 SDK 版本匹配:(28
或者是23
?)。
flutter build apk
将 > 1 GB 的数据添加到后,命令失败~/.gradle
:
andrew@mercury:~/src$ flutter create demo && cd demo
...
andrew@mercury:~/src/demo$ flutter build apk
Checking the license for package Android SDK Build-Tools 30.0.3 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Build-Tools 30.0.3 not accepted.
Checking the license for package Android SDK Platform 33 in /usr/lib/android-sdk/licenses
Warning: License for package Android SDK Platform 33 not accepted.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalReportRelease'.
> Failed to install the following Android SDK packages as some licences have not been accepted.
platforms;android-33 Android SDK Platform 33
build-tools;30.0.3 Android SDK Build-Tools 30.0.3
To build this project, accept the SDK license agreements and install the missing components using the Android Studio SDK Manager.
All licenses can be accepted using the sdkmanager command line tool:
sdkmanager.bat --licenses
Or, to transfer the license agreements from one workstation to another, see https://developer.android.com/studio/intro/update.html#download-with-gradle
Using Android SDK: /usr/lib/android-sdk
* 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 1m 16s
Running Gradle task 'assembleRelease'... 76.6s
Gradle task assembleRelease failed with exit code 1
我知道 F-Droid 包含基于 Flutter 的应用程序,因此一定有一种方法可以使用免费软件 Android SDK 为 Android 进行编译。我该怎么做?
更新:F-Droid 论坛上有人说他们使用的 Android SDK 不是 FOSS。