babariviere / flutter-nix-hello-world

Demonstration on how to use flutter with Nix
51 stars 10 forks source link

The SDK directory is not writable #9

Closed hoh closed 1 year ago

hoh commented 1 year ago

I am trying to use Flutter on NixOS. When trying this repository, after overriding the issue in #8 using --ignore-deprecation, I am facing the following error:

> Failed to install the following SDK components:
      build-tools;28.0.3 Android SDK Build-Tools 28.0.3
  The SDK directory is not writable (/nix/store/95n2vl2aipq7295wrc7ins6j953kzsww-androidsdk/libexec/android-sdk)

The complete log is:

user@host ~/flutter_nix_hello_world (master)> nix-shell

[nix-shell:~//flutter_nix_hello_world]$ flutter build apk --ignore-deprecation
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Warning
──────────────────────────────────────────────────────────────────────────────
Your Flutter application is created using an older version of the Android
embedding. It is being deprecated in favor of Android embedding v2. Follow the
steps at

https://flutter.dev/go/android-project-migration

to migrate your project. You may also pass the --ignore-deprecation flag to
ignore this check and continue with the deprecated v1 embedding. However,
the v1 Android embedding will be removed in future versions of Flutter.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
The detected reason was:

  /home/user/flutter_nix_hello_world/android/app/src/main/AndroidManifest.xml uses
  `android:name="io.flutter.app.FlutterApplication"`
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

This app is using a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to migrate this app to the V2 embedding.
Take a look at the docs for migrating an app: https://github.com/flutter/flutter/wiki/Upgrading-pre-1.12-Android-projects

Building without sound null safety
For more information see https://dart.dev/null-safety/unsound-null-safety

Checking the license for package Android SDK Build-Tools 28.0.3 in /nix/store/95n2vl2aipq7295wrc7ins6j953kzsww-androidsdk/libexec/android-sdk/licenses
License for package Android SDK Build-Tools 28.0.3 accepted.
Preparing "Install Android SDK Build-Tools 28.0.3 (revision: 28.0.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:compileReleaseKotlin'.
> Failed to install the following SDK components:
      build-tools;28.0.3 Android SDK Build-Tools 28.0.3
  The SDK directory is not writable (/nix/store/95n2vl2aipq7295wrc7ins6j953kzsww-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 1m 54s
Running Gradle task 'assembleRelease'...                          115.3s
Gradle task assembleRelease failed with exit code 1
babariviere commented 1 year ago

I have fixed it with the latest commit!

bachrc commented 1 year ago

Well, actually, refreshing the flake.lock file, the errors appears again with the latest android simulator (33.1.6)

hatch01 commented 11 months ago

I also get the same issue :

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 840ms
Running Gradle task 'assembleRelease'...                         1 301ms
Gradle task assembleRelease failed with exit code 1