I'm trying to run apkanalyzer
from Android SDK tools from command line. However, it won't start and prints the following exception:
Exception in thread "main" java.lang.IllegalStateException: The tools directory property is not set, please make sure you are executing apkanalyzer. Got /home/user/Programs/android-sdk-linux/tools
at com.android.tools.apk.analyzer.ApkAnalyzerCli.getAaptInvokerFromSdk(ApkAnalyzerCli.java:266)
at com.android.tools.apk.analyzer.ApkAnalyzerCli.main(ApkAnalyzerCli.java:123)
My cmdline is:
~/Programs/android-sdk-linux$ tools/bin/apkanalyzer apk summary ~/projects/mservice.apk
ANDROID_SDK_ROOT
is set.
Here is my installation (sdkmanager --list):
Installed packages:=====================] 100% Computing updates...
Path | Version | Description | Location
------- | ------- | ------- | -------
build-tools;28.0.3 | 28.0.3 | Android SDK Build-Tools 28.0.3 | build-tools/28.0.3/
build-tools;29.0.2 | 29.0.2 | Android SDK Build-Tools 29.0.2 | build-tools/29.0.2/
platform-tools | 29.0.6 | Android SDK Platform-Tools | platform-tools/
platforms;android-28 | 6 | Android SDK Platform 28 | platforms/android-28/
platforms;android-29 | 4 | Android SDK Platform 29 | platforms/android-29/
tools | 1.0.0 | Android SDK Tools 1 | tools/
What is wrong?
apkanalyzer
expects to live in a different folder than it is actually in. This is the same error as with sdkmanager
, also part of cmdline-tools
. See this question: The solution is to move /path/to/cmdline-tools
to /path/to/cmdline-tools/latest
.
I found this by googling for The tools directory property is not set
> https://android.googlesource.com/platform/development/.../Main.java > com.android.sdkmanager.toolsdir
> run sdkmanager
> Error: Could not determine SDK root.
> Failed to run sdkmanager --list with Java 9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With