Open dudozermaks opened 10 months ago
Hi everyone!
I think I found a quickfix, I shared it here: https://discourse.nixos.org/t/problem-building-flutter-app-for-android/35593.
Have a nice day!
@johynpapin Can you please share your flake.lock
file? I do exactly what you say, but flutter wants SDK version older, than in flake.nix
. When I change it, it doesn't work too...
Is the nixpkgs
section enough?
"nixpkgs": {
"locked": {
"lastModified": 1700538105,
"narHash": "sha256-uZhOCmwv8VupEmPZm3erbr9XXmyg7K67Ul3+Rx2XMe0=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "51a01a7e5515b469886c120e38db325c96694c2f",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
After some modifying of flake.nix
it does work, yay! I will post my solution later, after some refactoring.
Alright, solution to this problem is:
If you have existing project, go there. If not, skip this step
Create flake.nix
file, with content below
Run nix develop
to enter the development shell
If you have no project created (you skipped step 1), then run flutter create projectname
and cd
into that project
Modify your android/app/build.gradle
(I provided an example how it should look after modifications below)
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
android {
namespace "com.example.experemental"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
...
}
Right before android { ...
insert:
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Run flutter build apk
or flutter build apk --debug
If none of that works, try to remove flake.lock
file in this directory, and replace it with attached one.
@dudozermaks I created an empty dir, copied you flake.nix and flake.lock.
run
flutter create .
modified the android/app/build.gradle according to what you've written.
but when I build I get this issue :
flutter build apk
Checking the license for package Android SDK Platform 33 in /nix/store/ygxvbchm0q2dilfakgvy6srjvkxma26p-androidsdk/libexec/android-sdk/licenses
License for package Android SDK Platform 33 accepted.
Preparing "Install Android SDK Platform 33 (revision: 3)".
Warning: Failed to read or create install properties file.
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:lintVitalReportRelease'.
> Failed to install the following SDK components:
platforms;android-33 Android SDK Platform 33
The SDK directory is not writable (/nix/store/ygxvbchm0q2dilfakgvy6srjvkxma26p-androidsdk/libexec/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 1s
Running Gradle task 'assembleRelease'... 1 791ms
Gradle task assembleRelease failed with exit code 1
I saw in the flutter doctor that the licenses were not accepted, so I ran flutter doctor --android-licenses
and accepted all the licenses successfully.
This does not change anything in the build result.
@hatch01 I run flutter doctor
myself. It tells me that I have not accepted some licenses too. But for me everything works fine.
Might be a stupid question, but have you run nix develop
before running flutter build apk
? Forgot to mention that in guide (I'll edit it)
Of course, I have run nix develop
and flutter is not installed system-wide on my NixOS, so I'm sure that I am in the environment.
@dudozermaks Here is the repo where I try to make it work if you could try with your system. https://github.com/hatch01/nix-flutter-tests I'm new to nix, but I think that it should not differ between two systems.
To be fair, I don't know where this issue is coming from. Maybe you have another Android SDK installed system-wide? See, in flake.nix
we have installed the Android Platform version 33. Could you please send the output of ls /nix/store/ygxvbchm0q2dilfakgvy6srjvkxma26p-androidsdk/libexec/android-sdk/platforms
? normally it should look like this:
android-28 android-33
(both directories)
ll /nix/store/ygxvbchm0q2dilfakgvy6srjvkxma26p-androidsdk/libexec/android-sdk/platforms
lrwxrwxrwx root root 109 B Thu Jan 1 01:00:01 1970 android-28 ⇒ /nix/store/rh4jnhyyhjfx0crkmziy1fl97d7jfbcs-android-sdk-platforms-28/libexec/android-sdk/platforms/android-28
lrwxrwxrwx root root 109 B Thu Jan 1 01:00:01 1970 android-29 ⇒ /nix/store/9kz3pnpf8dzk60v70w8gg68j26q6jv72-android-sdk-platforms-29/libexec/android-sdk/platforms/android-29
lrwxrwxrwx root root 109 B Thu Jan 1 01:00:01 1970 android-30 ⇒ /nix/store/55hzcl7qqyw0qfsgpzbkqa2760s19qks-android-sdk-platforms-30/libexec/android-sdk/platforms/android-30
lrwxrwxrwx root root 109 B Thu Jan 1 01:00:01 1970 android-31 ⇒ /nix/store/jrx532hp58paijacx1pb0cnii5m87spq-android-sdk-platforms-31/libexec/android-sdk/platforms/android-31
Strangely, I have much more
If it could help someone, here is a config which accepts all the android sdk licenses for flutter :
pkgs.androidenv.composeAndroidPackages {
toolsVersion = "26.1.1";
platformToolsVersion = "33.0.3";
buildToolsVersions = [ buildToolsVersionForAapt2 ];
includeEmulator = false;
emulatorVersion = "34.1.9";
platformVersions = [ "28" "29" "30" "31" ];
includeSources = false;
includeSystemImages = false;
systemImageTypes = [ "google_apis_playstore" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.10.2" ];
includeNDK = true;
ndkVersions = [ "22.0.7026061" ];
useGoogleAPIs = false;
useGoogleTVAddOns = false;
extraLicenses = [
"android-googletv-license"
"android-sdk-arm-dbt-license"
"android-sdk-license"
"android-sdk-preview-license"
"google-gdk-license"
"intel-android-extra-license"
"intel-android-sysimage-license"
"mips-android-sysimage-license"
];
};
@hatch01 I could not reproduce your error.
Steps:
gh repo clone https://github.com/hatch01/nix-flutter-tests
nix develop
flutter build apk
try to do them yourself, maybe this will help. but I have no clue why this is happening.
The trouble here is, that for some reason you have no android-33 in your android-sdk folder. Flutter needs it in order to build apk. But in flake.nix
specified exactly that version of android platforms...
It works, don't know why but thank you x)
The solution was to ensure that nothing was in the environment (vscode in my case), and then run nix-collect-garbage -d
to cleanup everything.
Unfortunately I can't run the emulator with @hatch01 's devshell on sway. I use this commit https://github.com/hatch01/nix-flutter-tests/commit/266a87c3820fcf357031765c08f3c7af2f6a693c to enable emulator support on x86_64. Here is my script to test emulator running.
export ANDROID_AVD_NAME=device
export ANDROID_USER_HOME=$(mktemp -d $TMPDIR/nix-android-user-home-XXXX)
export ANDROID_AVD_HOME=$ANDROID_USER_HOME/avd
yes "" | avdmanager create avd --force -n $ANDROID_AVD_NAME -k "system-images;android-33;google_apis_playstore;x86_64" -p $ANDROID_AVD_HOME
echo
echo "========================"
echo
env | grep QT_
echo
echo "========================"
echo
emulator -avd device -verbose
echo
echo "========================"
echo
unset $(env | grep '^QT_' | awk -F= '{print $1}')
emulator -avd device -verbose
The emulator first complains that Warning: Could not find the Qt platform plugin "wayland" in "/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/qt/plugins" ((null):0, (null)) Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
It didn't find the QT plugin.
When I unset QT
related environment variables (especially QT_QPA_PLATFORM
I think), the emulator directly crashed by SIGABRT.
Here is the full output.
[=======================================] 100% Fetch remote repository...
Auto-selecting single ABI x86_64
Do you wish to create a custom hardware profile? [no]
========================
QT_AUTO_SCREEN_SCALE_FACTOR=1
QT_IM_MODULE=fcitx
QT_PLUGIN_PATH=/nix/store/dagifdkbh755wk353xs9fg3sflp2zy0w-fcitx5-with-addons-5.1.5/lib/qt-6/plugins:/home/e/.nix-profile/lib/qt-5.15.11/plugins:/home/e/.nix-profile/lib/qt-6/plugins:/nix/profile/lib/qt-5.15.11/plugins:/nix/profile/lib/qt-6/plugins:/home/e/.local/state/nix/profile/lib/qt-5.15.11/plugins:/home/e/.local/state/nix/profile/lib/qt-6/plugins:/etc/profiles/per-user/e/lib/qt-5.15.11/plugins:/etc/profiles/per-user/e/lib/qt-6/plugins:/nix/var/nix/profiles/default/lib/qt-5.15.11/plugins:/nix/var/nix/profiles/default/lib/qt-6/plugins:/run/current-system/sw/lib/qt-5.15.11/plugins:/run/current-system/sw/lib/qt-6/plugins
QT_QPA_PLATFORM=wayland
QT_QPA_PLATFORMTHEME=gnome
QT_STYLE_OVERRIDE=adwaita
QT_WAYLAND_DISABLE_WINDOWDECORATION=1
========================
INFO | Android emulator version 34.1.9.0 (build_id 11009885) (CL:N/A)
DEBUG | Current emulator version 34.1.9 is the same as the required version 34.1.9.
INFO | Found AVD name 'device'
INFO | Found AVD target architecture: x86_64
INFO | argv[0]: '/nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/bin/emulator'; program directory: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator'
INFO | Found systemPath /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64/
INFO | emuDirName: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator'
INFO | try dir /nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator
INFO | Trying emulator path '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64'
INFO | Found target-specific 64-bit emulator binary: /nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
INFO | Adding library search path: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64'
INFO | Adding library search path: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/gles_swiftshader'
INFO | Adding library search path: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/libstdc++'
DEBUG | emulator: Running :/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
DEBUG | qemu backend: argv[00] = "/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64"
DEBUG | qemu backend: argv[01] = "-avd"
DEBUG | qemu backend: argv[02] = "device"
DEBUG | qemu backend: argv[03] = "-verbose"
DEBUG | Concatenated backend parameters: /nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64 -avd device -verbose
INFO | Storing crashdata in: , detection is enabled for process: 264632
WARNING | Crash annotation is very large (22899), only 16384 bytes will be recorded, 6515 bytes are lost.
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
DEBUG | autoconfig: -skin 320x640
DEBUG | autoconfig: -skindir (null)
DEBUG | autoconfig: -kernel /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//kernel-ranchu
DEBUG | Target arch = 'x86_64'
DEBUG | Auto-detect: Kernel image requires new device naming scheme.
DEBUG | Auto-detect: Kernel does not support YAFFS2 partitions.
DEBUG | autoconfig: -ramdisk /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//ramdisk.img
DEBUG | Using initial system image: /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//system.img
DEBUG | Using initial vendor image: /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//vendor.img
DEBUG | autoconfig: -initdata /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/userdata.img
DEBUG | autoconfig: -cache /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/cache.img
INFO | Increasing RAM size to 2048MB
DEBUG | VM heap size 0MB is below hardware specified minimum of 512MB,setting it to that value
DEBUG | System image is read only
DEBUG | Found 1 DNS servers:
DEBUG | 127.0.0.53
DEBUG | found magic skin width=320 height=640 bpp=16
DEBUG | Starting hostapd main loop.
WARNING | File System is not ext4, disable QuickbootFileBacked feature
DEBUG | Creating ext4 userdata partition: /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/data
Creating filesystem with parameters:
Size: 6442450944
Block size: 4096
Blocks per group: 32768
Inodes per group: 8192
Inode size: 256
Journal blocks: 24576
Label:
Blocks: 1572864
Block groups: 48
Reserved block group size: 383
Created filesystem with 31/393216 inodes and 52359/1572864 blocks
DEBUG | convert img from ext4 /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/userdata-qemu.img to qcow2 image /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/userdata-qemu.img.tmp.qcow2 succeeded, using 288 mini seconds
DEBUG | Creating empty ext4 cache partition: /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/cache.img
Creating filesystem with parameters:
Size: 69206016
Block size: 4096
Blocks per group: 32768
Inodes per group: 4224
Inode size: 256
Journal blocks: 1024
Label:
Blocks: 16896
Block groups: 1
Reserved block group size: 7
Created filesystem with 11/4224 inodes and 1302/16896 blocks
DEBUG | CPU Acceleration: working
DEBUG | CPU Acceleration status: KVM (version 12) is installed and usable.
DEBUG | handleCpuAcceleration: feature check for hvf
DEBUG | Bluetooth requested by guest
DEBUG | started modem simulator host server at port: 24697
INFO | Warning: Could not find the Qt platform plugin "wayland" in "/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/qt/plugins" ((null):0, (null))
Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
INFO | Fatal: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
((null):0, (null))
[264636:264636:20231205,003453.659821:ERROR elf_dynamic_array_reader.h:64] tag not found
[264636:264636:20231205,003453.660531:ERROR elf_dynamic_array_reader.h:64] tag not found
[264636:264636:20231205,003453.660548:ERROR process_memory_range.cc:75] read out of range
[1] 264632 IOT instruction (core dumped) emulator -avd device -verbose
========================
INFO | Android emulator version 34.1.9.0 (build_id 11009885) (CL:N/A)
DEBUG | Current emulator version 34.1.9 is the same as the required version 34.1.9.
INFO | Found AVD name 'device'
INFO | Found AVD target architecture: x86_64
INFO | argv[0]: '/nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/bin/emulator'; program directory: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator'
INFO | Found systemPath /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64/
INFO | emuDirName: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator'
INFO | try dir /nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator
INFO | Trying emulator path '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64'
INFO | Found target-specific 64-bit emulator binary: /nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
INFO | Adding library search path: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64'
INFO | Adding library search path: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/gles_swiftshader'
INFO | Adding library search path: '/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/libstdc++'
DEBUG | emulator: Running :/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64
DEBUG | qemu backend: argv[00] = "/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64"
DEBUG | qemu backend: argv[01] = "-avd"
DEBUG | qemu backend: argv[02] = "device"
DEBUG | qemu backend: argv[03] = "-verbose"
DEBUG | Concatenated backend parameters: /nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/qemu/linux-x86_64/qemu-system-x86_64 -avd device -verbose
INFO | Storing crashdata in: , detection is enabled for process: 264673
WARNING | Crash annotation is very large (22134), only 16384 bytes will be recorded, 5750 bytes are lost.
INFO | Duplicate loglines will be removed, if you wish to see each individual line launch with the -log-nofilter flag.
DEBUG | autoconfig: -skin 320x640
DEBUG | autoconfig: -skindir (null)
DEBUG | autoconfig: -kernel /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//kernel-ranchu
DEBUG | Target arch = 'x86_64'
DEBUG | Auto-detect: Kernel image requires new device naming scheme.
DEBUG | Auto-detect: Kernel does not support YAFFS2 partitions.
DEBUG | autoconfig: -ramdisk /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//ramdisk.img
DEBUG | Using initial system image: /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//system.img
DEBUG | Using initial vendor image: /nix/store/a6zm4lvs7a9nbripi3gf7d7xc9pc4a91-androidsdk/libexec/android-sdk/system-images/android-33/google_apis_playstore/x86_64//vendor.img
DEBUG | autoconfig: -data /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/userdata-qemu.img
DEBUG | autoconfig: -initdata /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/userdata.img
DEBUG | autoconfig: -cache /tmp/nix-shell.8bsZtY/nix-android-user-home-EVoe/avd/../avd/cache.img
INFO | Increasing RAM size to 2048MB
DEBUG | VM heap size 0MB is below hardware specified minimum of 512MB,setting it to that value
DEBUG | System image is read only
DEBUG | Found 1 DNS servers:
DEBUG | 127.0.0.53
DEBUG | Starting hostapd main loop.
DEBUG | found magic skin width=320 height=640 bpp=16
WARNING | File System is not ext4, disable QuickbootFileBacked feature
DEBUG | CPU Acceleration: working
DEBUG | CPU Acceleration status: KVM (version 12) is installed and usable.
DEBUG | handleCpuAcceleration: feature check for hvf
DEBUG | Bluetooth requested by guest
DEBUG | started modem simulator host server at port: 34901
INFO | Warning: Could not find the Qt platform plugin "wayland" in "/nix/store/fb1l88r4gyd2b81m8iaxz4yz8ywnb6al-android-sdk-emulator-34.1.9/libexec/android-sdk/emulator/lib64/qt/plugins" ((null):0, (null))
@contrun could I test using your project on my Nixon system?
@hatch01 Do you mean using your flake file without modification? My modification to add x86_64 and includeSystemImages arguments are required because I need these files to run the emulator.
@contrun I miss written. My question was, could I get your project to test it myself on my system.
https://github.com/maximoffua/flutter.nix/issues/1 see this maybe helpful
@hatch01 Thanks for the pointer. With the help of the code in that link, I am able to start an android emulator, compile the code and run the resulting apk in the emulator. See https://github.com/contrun/nix-flutter-project-template for a sample project.
For anyone struggling to make https://github.com/contrun/nix-flutter-project-template work, make sure you don't have any config set in flutter. Clear it with flutter config --android-sdk=
and flutter config --android-studio-dir=
If it could help someone, here is a config which accepts all the android sdk licenses for flutter :
pkgs.androidenv.composeAndroidPackages { toolsVersion = "26.1.1"; platformToolsVersion = "33.0.3"; buildToolsVersions = [ buildToolsVersionForAapt2 ]; includeEmulator = false; emulatorVersion = "34.1.9"; platformVersions = [ "28" "29" "30" "31" ]; includeSources = false; includeSystemImages = false; systemImageTypes = [ "google_apis_playstore" ]; abiVersions = [ "armeabi-v7a" "arm64-v8a" ]; cmakeVersions = [ "3.10.2" ]; includeNDK = true; ndkVersions = [ "22.0.7026061" ]; useGoogleAPIs = false; useGoogleTVAddOns = false; extraLicenses = [ "android-googletv-license" "android-sdk-arm-dbt-license" "android-sdk-license" "android-sdk-preview-license" "google-gdk-license" "intel-android-extra-license" "intel-android-sysimage-license" "mips-android-sysimage-license" ]; };
Thanks, this worked! ♥️ Where did you get the license strings from?
Trial and error x)
Problem
Can't run flake from documentation
How to reproduce:
flake.nix
with content as follows.nix develop
.error: The version 34.0.0 is missing in package build-tools. The only available versions are 17.0.0, 18.0.1, 18.1.0, 18.1.1, 19.0.0, ........ 33.0.2, 34.0.0-rc1, 34.0.0-rc2, 34.0.0-rc3, 34.0.0-rc4.
I Tried...
... To change
to:
this flake builds, then running
flutter create somename
cd somename
flutter build apk
Error is the same as when installing flutter and providing it with dependencies for Android build.
Proposal
Write valid
flake.nix
. I'm brand new to flutter and flakes, but I have some things to say.Maybe we should provide user not only with the
flake.nix
, but withflake.lock
too? Like this: "If flake does not run, try removingflake.lock
and replacing with this (link to valid flake.lock file)"Also, there is a working flake by user called racoon, both with
.nix
and.lock
files, which I'm now using. This flake is quite outdated, but maybe we should include this one in docs?Checklist