Closed janpio closed 4 years ago
(as I remember you pushed a PR in this area), check
PR #656, which was raised to resolve #617
Strange [...]?
Yes.
The explanation is that check_reqs.js
would internally set its own process ANDROID_HOME
environmental variable according to where it found the right place, in the following inner function: https://github.com/apache/cordova-android/blob/b4de6f55c4d7ad87a72f852d2b98dc9baf351731/bin/templates/cordova/lib/check_reqs.js#L225-L230
I resolved #617 without changing how this part works in order to support non-deprecated Android SDK behavior without blocking the major release.
The correct solution would be for check_reqs.js
to track the correct Android SDK root in an internal variable and then log the value of the internal variable in a user-friendly manner. I just added the bug label, cannot promise when I will get a chance to fix it.
Wouldn't this also mean that if something is actually broken with the env variables the error message to the user would be misleading when we mess with the variables? (Not sure if this can or does actually happen - just thinking out loud.)
Wouldn't this also mean that if something is actually broken with the env variables the error message to the user would be misleading when we mess with the variables?
I think so. I hope someone will get a chance to fix it.
This causes problems for me. The symptom is:
> cordova build android
... (omitted for clarity)
* Where:
Script 'C:\Users\...\platforms\android\CordovaLib\cordova.gradle' line: 68
* What went wrong:
A problem occurred evaluating project ':app'.
> No installed build tools found. Install the Android build tools version 19.1.0 or higher.
In the generated cordova.gradle, the getAndroidSdkDir()
function uses ANDROID_HOME
rather than ANDROID_SDK_ROOT
. The maybeSetAndroidHome
function only overrides the android home value if it isn't already set. That means that in the gradle routine, it will continue to use the deprecated value even if the ANDROID_SDK_ROOT
env variable is set.
It's very counter intuitive that a deprecated value would take precedence over the non-deprecated value.
At the very least, the error message should be improved, as it will lead people down the path of uninstalling and reinstalling the build tools, which isn't the issue at all. Maybe:
Could not find build tools in <DIRECTORY THAT WAS CHECKED>, ensure your ANDROID_SDK_ROOT env variable is set correctly and the ANDROID_HOME env variable is removed
https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html In case someone searching for jdk files
Please fix the issue
Hi my old project would build successfully. But the one that i created just a few minutes ago did not build with the message
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Tho my ANDROID_HOME is set and my old project is building successfully i dont know how to get around with it can you help me?
Definitely not in an unrelated, old issue.
I have the same proble building with cordova, came out of no where Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=C:\Android\android-sdk (DEPRECATED) Subproject Path: CordovaLib Subproject Path: app
I have the same problem building with cordova, came out of no where Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=C:\Android\android-sdk (DEPRECATED) Subproject Path: CordovaLib Subproject Path: app
I have the same problem..had anyone found a solution?
Can someone clarify the actual problem? Is it that ANDROID_SDK_ROOT
is not read?
In my environments I have both ANDROID_SDK_ROOT
and ANDROID_HOME
set and that works just fine.
I read this is just a display issue. They were working on it.
Same issue
I have the same problem..had anyone found a solution? PLEAAAAAAASE
I hope I found a solution. And Its working for me. The problem is with the Gradle. I have just uninstalled ionic cordova and android studio and reset the PC.
And declared environment variables.
Gradle now For Windows:
-Download last version of Gradle (https://gradle.org/releases)
-Create a folder and unzip files (I use C:\Program Files (x86)\gradle)
-Copy the path with the bin directory included (C:\Program Files (x86)\gradle\bin)
-Set the path C:\Program Files (x86)\gradle\bin (in my exemple) to "Path Environment Variables"
Variable name "Path" and variable value "C:\Program Files (x86)\gradle\bin" for both: User Variable table and System Variables table
You may need to reopen the "Prompt commad line"
To test, type gradle in prompt.
This procedure works fine.
You are all posting in an issue that states that there is no problem, and that this is just a cosmetic problem without actual negative effects. So if you say "same issue", you are saying that you also see a cosmetic problem that doesn't require to be fixed.
If you have an actual problem of something not working, do not post here but create a new issue where you include all the relevant information.
In Windows is not generating the build of the app
cordova platform list Installed platforms: android 8.0.0 Available platforms: browser ^6.0.0 electron ^1.0.0 ios ^5.0.0 osx ^5.0.0 windows ^7.0.0
The error message
Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=C:\Android\android-sdk (DEPRECATED) Subproject Path: CordovaLib Subproject Path: app
Man, stop marking my message as spam ... I can not build on Windows, is giving this error when I do "ionic cordova build android --release"
Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=C:\Android\android-sdk (DEPRECATED) Subproject Path: CordovaLib Subproject Path: app
@luccadumas -- have you tried setting the ANDROID_SDK_ROOT env variable and removing the ANDROID_HOME variable?
@janpio , I'm not sure it's really "just cosmetic" -- builds that used to work now fail. Also, I'm not sure if the root cause is the same in all of the cases listed above.
For me, iirc, the issue was that I had a working build one day, and the next day I didn't, even though I didn't change my code. I suspect I did a clean install and new minor versions of packages were updated.
Please see my earlier comment (https://github.com/apache/cordova-android/issues/670#issuecomment-481936559) with a more detailed description of what I found. As I see it, it looks like the deprecation of an old ENV variable was implemented in an odd way and it is causing unnecessary churn (this thread, for example). However, I only spent enough time in the gradle code to understand why it wasn't working, so I could be wrong.
Also, I'm not sure if the root cause is the same in all of the cases listed above.
No it is not - but I created this issue, and is it specifically about the cosmetic problem. As I posted above, if something is actually broken for you, open a new issue and include all the information it asks for.
I have the same problem, anybody found the solution already?
Same problem here (unbuntu 19.04). It is certainly not "cosmetic" as I cannot run or build when using "cordova run android". I do think it a little sad that no one seems interested in fixing a cosmetic error that is causing untold lost hours chasing ghosts. However, no ghost here. Real issue and dead in the water.
Environment Variable For Windows ANDROID_HOME C:\Users\${user}\AppData\Local\Android\sdk (deprecated)
ANDROID_SDK_ROOT C:\Users\${user}\AppData\Local\Android\sdk
JAVA_HOME C:\Program Files\java\${jdkVersion}
PATH C:\Users\${user}\AppData\Local\Android\sdk\platform-tools
PATH C:\Users\${user}\AppData\Local\Android\sdk\tools\bin
PATH C:\Users\${user}\AppData\Local\Android\sdk\emulator
PATH C:\Users\${user}\AppData\Local\Android\sdk\build-tools\${version}
PATH C:\Program Files\java\${jdkVersion}\bin
Environment Variable For LINUX/MAC
export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk
export ANDROID_HOME=$HOME/Library/Android/sdk (deprecated)
# avdmanager, sdkmanager
export PATH=$PATH:$ANDROID_SDK_ROOT/tools/bin
# adb, logcat
export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
# emulator
export PATH=$PATH:$ANDROID_SDK_ROOT/emulator
# apksigner, zipalign
export PATH=$PATH:$ANDROID_SDK_ROOT/build-tools/${version}
I just updated the title to make it 100% clear that this issue is about a display issue. In case of anything beyond a display issue we would like to kindly ask that someone raise a new issue so that we can keep our issues clearly focused, trackable, and actionable. Please do feel free to reference this issue from a new issue as I think this would be relevant, GitHub will show the references here.
We have already marked this issue as a bug, so it is on our todo list.
P.S. I further updated the title to indicate that we see this as a cosmetic display issue. We would like to kindly ask that people raise a new issue if they see this kind of behavior as anything other than a cosmetic display issue. And we would kindly ask people to simply use GitHub Reactions as described in [1] if they think we should fix this issue.
I did change some hidden comments from "spam" to "resolved" as I personally did not see any attempt to actually spam us.
[1] https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/
hello any idea about this problem?
I work under the macOS:
cordova build cordova Checking Java JDK and Android SDK versions ANDROID_SDK_ROOT=undefined (recommended setting) ANDROID_HOME=/Users/developer/Library/Android/sdk (DEPRECATED) Requirements check failed for JDK 8 ('1.8.*')! Detected version: 11.0.1 Check your ANDROID_SDK_ROOT / JAVA_HOME / PATH environment variables.
The .bash_profile is as follows, export ANDROID_SDK_ROOT=$HOME/Library/Android/sdk export ANDROID_HOME=$HOME/Library/Android/sdk export JAVA_8_HOME="$(/usr/libexec/java_home -v 1.8)" export JAVA_11_HOME="$(/usr/libexec/java_home -v 11)" alias jdk8='export JAVA_HOME=$JAVA_8_HOME' alias jdk11='export JAVA_HOME=$JAVA_11_HOME' export JAVA_HOME=$JAVA_8_HOME export GRADLE_HOME=/Users/developer/code/gradle-5.6.2 export PATH=${PATH}:${SWIG_HOME}/bin:${MY_BIN}:$ANDROID_SDK_ROOT/tools:$GRADLE_HOME/bin:$ANDROID_HOME/platform-tools
And no matter how the environment is , the problem is stil right here.
@75341704 This issue is a cosmetic issue, not a functional issue, as stated several times before. If something is functionally not working for you, please raise a new issue and fill out the form completely.
@janpio is it possible to lock this thread so only contributors can comment? If so, perhaps it is time to so...
@75341704 This issue is a cosmetic issue, not a functional issue, as stated several times before. If something is functionally not working for you, please raise a new issue and fill out the form completely.
@janpio is it possible to lock this thread so only contributors can comment? If so, perhaps it is time to so...
mv /Library/Java/JavaVirtualMachines/jdk-11.0 ~/otherfolder and it works.
The environment detection may have some problem.
I am facing a weird issue. I wrote the ANDROID_HOME variable in bash_profile. Then I hit cmd ‘source bash_profile’. Now echoing my env variables works fine. Until I close the terminal. It just got vanished if I close the terminal. To recover, I need to run cmd ‘source bash_profile’.
macOS Cataline
@Kunj-Choksi
Your comment is unrelated to the ticket at hand. To quickly answer your question though, I believe macs use ~/.profile
instead of ~/.bash_profile
.
I am locking this thread due to the number of unrelated comments. As stated before, this issue describes a cosmetic issue. If you do have a functional issue, then you should raise a new ticket and fill out the form appropriately.
Hey @brodybits (as I remember you pushed a PR in this area), check out the output of running
cordova build android
on a brand new machine where I just installed Android Studio:Strange that this set
ANDROID_HOME
, and notANDROID_SDK_ROOT
, isn't it?