question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove ndk.dir deprecation warning

See original GitHub issue
WARNING: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [20.0.5594570] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Raibazcommented, Jul 9, 2021

Got it, thanks a lot for investigating this, this can safely be closed then.

2reactions
agebhar1commented, Jul 8, 2021

Hello @Raibaz,

after had a deeper look into the issue the solution is quite simple. In https://github.com/mockk/mockk/blob/9473e79d1b4fa99c91d87144557cacf167f29e64/gradle/detect-android-sdk.gradle#L15-L20 which is applied from settings.gradle the code tries to detect the properties file local.properties from the root of the project. If it’s found the whole content is loaded as properties. The file itself is ignored by .gitignore.

If it does not exists either $ANDROID_HOME, $ANDROID_SDK_ROOT or ${HOME}/Android/Sdk must point to a valid Android environment. If so, the warning does not appear and local.properties is generated. On my local machine it’s:

#generated by 'detect-android-sdk.gradle'
#Thu Jul 08 13:03:23 CEST 2021
sdk.dir=/usr/local/lib/android/sdk

If local.properties contains the ndk.dir property

#generated by 'detect-android-sdk.gradle'
#Thu Jul 08 13:03:23 CEST 2021
ndk.dir=/usr/local/lib/android/sdk/ndk/21.1.6352462
sdk.dir=/usr/local/lib/android/sdk

, the warning is presented on the command line:

> Configure project :mockk-agent-android
WARNING: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [21.1.6352462] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir
NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete ndk.dir from local.properties and set android.ndkVersion to [21.1.6352462] in all native modules in the project. https://developer.android.com/r/studio-ui/ndk-dir

The GitHub Action runs didn’t show the warning because the properties file is not present and both contains the required environment variable which points to an Android installation.

https://github.com/actions/virtual-environments/blob/ubuntu20/20210628.1/images/linux/Ubuntu2004-README.md https://github.com/actions/virtual-environments/blob/macOS-10.15/20210626.1/images/macos/macos-10.15-Readme.md

One have to remove the property ndk.dir from local.properties and the build should be fine without the warning.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MacOS android studio NDK was located by using ndk.dir ...
WARNING :: NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release.
Read more >
Install and configure the NDK and CMake - Android Developers
If you uninstall the legacy NDK, remove the ndk.dir value, which is now deprecated, from your projects' local.properties files. Click OK.
Read more >
[#QTBUG-91391] androiddeployqt uses deprecated ndk.dir ...
WARNING : NDK was located by using ndk.dir property. This method is deprecated and will be removed in a future release. Please delete...
Read more >
How to use ndkVersion in gradle - Google Groups
Looks right to me. I would add that, in AS 3.5+, you will get a deprecation warning if ANDROID_NDK_HOME is set. Support for...
Read more >
Creating a native build using cocos creator version 2.4.8
dir in local.properties is not set C/C++ ndk.dir delete check : Not considering ANDROID_NDK_HOME because support was removed after deprecation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found