android-nixpkgs
android-nixpkgs copied to clipboard
android-studie + sdk fails, SDK missing or out of date
When using the default shell provided in the repo (without flakes), opening Android Studio gives the following error.
The path is correct to the SDK, and it seems to have all the things needed included. However, it ONLY works if the SDK is moved outside the nix store, and made RW. I can see that it changes one file, between the one in the store (android-sdk RO) and the one outside the store (android-sdk2 RW), and then it works.
$ diff --recursive android-sdk android-sdk2
diff '--color=auto' --recursive android-sdk/.knownPackages android-sdk2/.knownPackages
1c1
< ^���o6��[0m
\ No newline at end of file
---
> �(1h?E��
\ No newline at end of file
> xxd android-sdk/.knownPackages
00000000: 9a5e f119 dbe3 f179 ab6f 3698 17e0 d8dd .^.....y.o6.....
> xxd android-sdk2/.knownPackages
00000000: effb 2831 683f b98a 45d4 e0cc d0a4 9894 ..(1h?..E.......
I'm not sure what the issue is, but I'm somewhat amazed that no issues have been made for it yet.
I experience the same issues, I have also tried using the flake and get the same error.
Using the flake and devshell.nix from the template and starting android-studio from within the devshell I also get No installed SDK found!
2024-04-20 13:34:19,173 [ 81844] SEVERE - #com.android.tools.idea.avdmanager.AvdManagerConnection - No installed SDK found! java.lang.Throwable: No installed SDK found! at com.intellij.openapi.diagnostic.Logger.error(Logger.java:370) at com.android.tools.idea.avdmanager.DeviceManagerConnection.getDefaultDeviceManagerConnection(DeviceManagerConnection.java:80) at com.android.tools.idea.avdmanager.AvdDeviceData.getUniqueId(AvdDeviceData.java:192) at com.android.tools.idea.avdmanager.AvdDeviceData.initDefaultValues(AvdDeviceData.java:430) at com.android.tools.idea.avdmanager.AvdDeviceData.
(AvdDeviceData.java:174) at com.android.tools.idea.avdmanager.AvdOptionsModel. (AvdOptionsModel.java:167) at com.android.tools.idea.avdmanager.AvdOptionsModel. (AvdOptionsModel.java:161) at com.android.tools.idea.avdmanager.AvdManagerImpl.createAvd(LocalEmulatorProvisionerFactory.kt:79) at com.android.sdklib.deviceprovisioner.LocalEmulatorProvisionerPlugin$createDeviceAction$1.create(LocalEmulatorProvisionerPlugin.kt:297) at com.android.tools.idea.devicemanagerv2.DeviceManagerPanel$toAnAction$3.invoke(DeviceManagerPanel.kt:313) at com.android.tools.idea.devicemanagerv2.DeviceManagerPanel$toAnAction$3.invoke(DeviceManagerPanel.kt:313) at com.android.tools.idea.devicemanagerv2.DeviceManagerPanel$toAnAction$2$actionPerformed$1.invokeSuspend(DeviceManagerPanel.kt:308) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:702) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:699) at java.base/java.security.AccessController.doPrivileged(AccessController.java:399) at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:699) at java.base/java.lang.Thread.run(Thread.java:840)
I copied out the Nix-provided Android SDK from the Nix Store to my home directory, and after making it writable, selecting it in Android Studio resulted in a new screen saying "Nothing to do! Android SDK is up to date.".
It seems like there's no difference between the two:
diff --recursive /nix/store/dfvplmh6ykc6ys22xa08wpjv694cql4c-android-sdk-env/share/android-sdk android-sdk
produces no output.
However, after going back to the Nix-provided SDK in the Nix Store, it is now able to be selected and new projects can be created. So it seems this might be a workaround for now.