Skip to content

java.nio.file.NoSuchFileException: ~/.config/.android/... #10

@ondras12345

Description

@ondras12345

After installing this snap on Ubuntu, I have encountered an error:

$ lsb_release -a                  
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.1 LTS
Release:	24.04
Codename:	noble

$ sudo snap install androidsdk
snap "androidsdk" is already installed, see 'snap help refresh'
ondra@ondra-TP ~$ androidsdk --verbose --list  
SDK_ROOT=/home/ondra/AndroidSDK
Picked up _JAVA_OPTIONS: -Duser.home=/home/ondra/snap/androidsdk/62
Info: Parsing /home/ondra/AndroidSDK/platforms/android-29/package.xml           
Info: IOException: https://dl.google.com/android/repository/addons_list-5.xml   
Info: java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_d2b9d222-addons_list-5_xml
Info: IOException: https://dl.google.com/android/repository/addons_list-4.xml   
Info: java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_d2abbaa1-addons_list-4_xml
Info: IOException: https://dl.google.com/android/repository/addons_list-3.xml   
Info: java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_d29da320-addons_list-3_xml
Info: IOException: https://dl.google.com/android/repository/addons_list-2.xml   
Info: java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_d28f8b9f-addons_list-2_xml
Info: IOException: https://dl.google.com/android/repository/addons_list-1.xml   
Info: java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_d281741e-addons_list-1_xml
Warning: Failed to download any source lists!                                   
Warning: IO exception while downloading manifest                                
java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_b7518f9e-repository2-3_xml
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
	at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
	at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
	at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:150)
	at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:132)
	at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.downloadAndCache(DownloadCache.java:651)
	at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.openCachedUrl(DownloadCache.java:545)
	at com.android.sdklib.repository.legacy.LegacyDownloader.downloadAndStream(LegacyDownloader.java:82)
	at com.android.repository.impl.manager.RemoteRepoLoaderImpl.lambda$fetchPackages$0(RemoteRepoLoaderImpl.java:138)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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.lang.Thread.run(Thread.java:840)
Warning: IO exception while downloading manifest                                
java.nio.file.NoSuchFileException: /home/ondra/.config/.android/cache/sdkbin-1_b743781d-repository2-2_xml
	at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:92)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
	at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
	at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
	at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvider.java:484)
	at java.base/java.nio.file.Files.newOutputStream(Files.java:228)
	at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:150)
	at com.android.sdklib.repository.legacy.FileOp.newFileOutputStream(FileOp.java:132)
	at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.downloadAndCache(DownloadCache.java:651)
	at com.android.sdklib.repository.legacy.remote.internal.DownloadCache.openCachedUrl(DownloadCache.java:545)
	at com.android.sdklib.repository.legacy.LegacyDownloader.downloadAndStream(LegacyDownloader.java:82)
	at com.android.repository.impl.manager.RemoteRepoLoaderImpl.lambda$fetchPackages$0(RemoteRepoLoaderImpl.java:138)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	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.lang.Thread.run(Thread.java:840)
Warning: Still waiting for package manifests to be fetched remotely.            
[=======================================] 100% Computing updates...             
Installed packages:
--------------------------------------
platforms;android-29
    Description:        Android SDK Platform 29
    Version:            5
    Installed Location: /home/ondra/AndroidSDK/platforms/android-29

I believe this is due to snap sandboxing.

I have found this workaround:

$ XDG_CONFIG_HOME=~/snap/androidsdk/curent/.config androidsdk --list

Otherwise, it would try to use my default XDG environment variables:

$ env | grep XDG
XDG_SESSION_TYPE=wayland
XDG_RUNTIME_DIR=/run/user/1000
XDG_DATA_DIRS=/usr/share/ubuntu:/usr/share/gnome:/home/ondra/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/:/var/lib/snapd/desktop
XDG_SESSION_DESKTOP=ubuntu
XDG_CURRENT_DESKTOP=ubuntu:GNOME
XDG_DATA_HOME=/home/ondra/.local/share
XDG_CONFIG_DIRS=/etc/xdg/xdg-ubuntu:/etc/xdg
XDG_SESSION_CLASS=user
XDG_CONFIG_HOME=/home/ondra/.config
XDG_MENU_PREFIX=gnome-

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions