Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "NoPlatformFound" has poor description #62

Open
hut opened this issue Jul 30, 2024 · 0 comments
Open

Error "NoPlatformFound" has poor description #62

hut opened this issue Jul 30, 2024 · 0 comments

Comments

@hut
Copy link

hut commented Jul 30, 2024

Hi, I just spent >1 hours debugging why cargo apk run tells me "Error: Android SDK has no platforms installed.", even though I had a platform installed.

Finally I found out that this is because of the final filter in the code of ndk.rs:

        let platforms: Vec<u32> = std::fs::read_dir(&platforms_dir)
            .or(Err(NdkError::PathNotFound(platforms_dir)))?
            .filter_map(|path| path.ok())
            .filter(|path| path.path().is_dir())
            .filter_map(|path| path.file_name().into_string().ok())
            .filter_map(|name| {
                name.strip_prefix("android-")
                    .and_then(|api| api.parse::<u32>().ok())
            })
            .filter(|level| (min_platform_level..=max_platform_level).contains(level))
            .collect();

My platform version was simply outside of the range min_platform_level..=max_platform_level. So the problem was not that it has "no platforms installed", but that the installed platform version is incompatible.

Would it be possible to adjust the error message? If you wish, I can make a PR.

P.S. i see that this tool is deprecated. feel free to close the PR without any action then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant