breautek commented on issue #1488:
URL: 
https://github.com/apache/cordova-android/issues/1488#issuecomment-1243756526

   The old `apkanalyzer` specifically lives in `$ANDROID_HOME/tools/bin`. 
Android has some binaries inside `/tools/` and inside `/tools/bin` (They are 
very organised... /s)
   
   Cordova does first do a `which` check (actually powered by NPM module for 
cross-platform support) so environmental paths takes precedence over 
everything. I'm not sure if Cordova has any fallback code to look for these 
binaries, but I wouldn't be surprised if it does and if they are out-dated. I 
vaguely recall it does some things and it tends to cause problems anyway 
because a build doesn't necessarily live in a single process, so something that 
Cordova might smartly find correctly, may start to fail once it starts running 
Gradle, for example. If Cordova is doing any fallback code, I'm sure it could 
be improved, and PRs would be welcomed.
   
   In the [current 
documentation](https://cordova.apache.org/docs/en/11.x/guide/platforms/android/index.html#setting-environment-variables)
 we recommend having the following environment variables set:
   
   - PATH
   - - /cmdline-tools/<version>/bin (version doesn't seem to matter, docs 
assumes you're installing the "latest" package)
   - - /build-tools/<version> (the version depends on the chosen build tools, 
generally you'll need the cordova default version, as they often contain 
breaking changes)
   - - /emulator
   - - platform-tools
   
   `JAVA_HOME` and `ANDROID_HOME` should be present as well. Docs mentions that 
`ANDROID_SDK_ROOT` should be set, and it has no harm to have this set to the 
same value as `ANDROID_HOME`, but `ANDROID_SDK_ROOT` is now deprecated by the 
android tooling. (Google flip flopped on this environment variable)
   
   I'm going to close this issue as it seems using the environment variables as 
documented solves the issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to