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

ANDROID_HOME is deprecated #949

Closed
zdm opened this issue Apr 11, 2020 · 6 comments · Fixed by #951
Closed

ANDROID_HOME is deprecated #949

zdm opened this issue Apr 11, 2020 · 6 comments · Fixed by #951
Assignees
Labels
Milestone

Comments

@zdm
Copy link

zdm commented Apr 11, 2020

Feature Request

Motivation Behind Feature

Keep environment clean

Feature Description

ANDROID_HOME is deprecated and replaced with ANDROID_SDK_ROOT by android SDK.
It would be nice, if cordova also support ANDROID_SDK_ROOT variable to make it consistent with the SDK.

@zdm
Copy link
Author

zdm commented Apr 11, 2020

@breautek
Copy link
Contributor

breautek commented Apr 12, 2020

cordova-android does support ANDROID_SDK_ROOT, however if you have ANDROID_HOME also defined, I think the deprecated variable currently takes precedence... not 100% sure. If that is the case though, I think ANDROID_SDK_ROOT should be the dominant environment variable, falling back to the deprecated variable.

@breautek breautek added this to the 9.0.0 milestone Apr 12, 2020
@zdm
Copy link
Author

zdm commented Apr 12, 2020

I am unable to build on android platform if ANDROID_SDK_ROOT is set but ANDROID_HOME is NOT set.

d:\gdrive\projects\workspace\smartcnc-app>cordova build android
Failed to find 'ANDROID_HOME' environment variable. Try setting it manually.
Detected 'avdmanager' command at d:\devel\android\cmdline-tools\latest\bin but no 'tools\bin' directory found near.
Try reinstall Android SDK or update your PATH to include valid path to SDK\tools\bin directory.

@breautek
Copy link
Contributor

I've actually reproduced this as well... the tooling prints out that ANDROID_SDK_ROOT is recommended but it definitely does not use it properly.. even on 9.0.0-dev.

@breautek breautek added the bug label Apr 12, 2020
@breautek breautek self-assigned this Apr 12, 2020
breautek added a commit to breautek/cordova-android that referenced this issue Apr 12, 2020
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes apache#949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix apache#670
breautek added a commit to breautek/cordova-android that referenced this issue Apr 13, 2020
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes apache#949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix apache#670
breautek added a commit to breautek/cordova-android that referenced this issue Apr 15, 2020
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes apache#949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix apache#670
breautek added a commit to breautek/cordova-android that referenced this issue Apr 15, 2020
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes apache#949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix apache#670
breautek added a commit to breautek/cordova-android that referenced this issue Apr 16, 2020
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes apache#949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix apache#670
breautek added a commit that referenced this issue Apr 16, 2020
This commit does the following:
- Makes ANDROID_SDK_ROOT the primary variable to look for the Android SDK location.
- Makes ANDROID_HOME the fallback variable, if ANDROID_SDK_ROOT is not present/valid.

Gradle updates:
Note that the following gradle updates were required, otherwise the android gradle plugin did not honour the ANDROID_SDK_ROOT variable.

- Updates the framework's android studio's gradle plugin from version 3.3.0 to 3.5.3.
	Not only this is required for android's gradle to obey ANDROID_SDK_ROOT, it is now in sync with the Android test project/
- Updates the Androidx test project to use gralde plugin from version 3.3.0 to 3.5.3, to match Android Test & framework.
	- Consequentially, this required to also upgrade AndroidX test project to use Gradle 6.1, which also matches both the Android test project & framework

These changes above fixes #949

Additionally, since we update the environment variables dynamically, the environment variable printout produced misleading information.
The environment variable printout will now print out the variable as defined by the user (before the tooling messes with them). An additional log
is printed that tells the user exactly what Cordova is going to use for the Android SDK path. This should fix #670
@fortuna
Copy link

fortuna commented Apr 27, 2022

As of April 27, 2022, the page at https://developer.android.com/studio/command-line/variables says:

ANDROID_HOME: Sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_SDK_ROOT, which also points to the SDK installation directory, is deprecated. If you continue to use it, Android Studio and the Android Gradle plugin will check that the old and new variables are consistent.

So Cordova is saying the opposite of what the Android team is saying.

@breautek
Copy link
Contributor

breautek commented Apr 27, 2022

As of April 27, 2022, the page at https://developer.android.com/studio/command-line/variables says:

ANDROID_HOME: Sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_SDK_ROOT, which also points to the SDK installation directory, is deprecated. If you continue to use it, Android Studio and the Android Gradle plugin will check that the old and new variables are consistent.

So Cordova is saying the opposite of what the Android team is saying.

You can open a new issue for this. I've done this already.

For context, Google can't seem to make up their mind. e.g: back in 2018 https://web.archive.org/web/20181121202227/https://developer.android.com/studio/command-line/variables

Sets the path to the SDK installation directory. Once set, the value does not typically change, and can be shared by multiple users on the same machine. ANDROID_HOME, which also points to the SDK installation directory, is deprecated.

Screenshot from 2022-04-27 17-04-21

adelmojunnior pushed a commit to adelmojunnior/docker-ionic-android that referenced this issue Oct 9, 2022
adelmojunnior pushed a commit to adelmojunnior/docker-ionic-android that referenced this issue Oct 9, 2022
osipxd referenced this issue in mingchen/docker-android-build-box Apr 22, 2023
Retained old SDKs and Build Tools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants