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

[1.4.3.1] Android SDK not found with Android SDK 25.3.0 or higher. #8464

Closed
YannLeBihan opened this issue Mar 7, 2017 · 67 comments
Closed

Comments

@YannLeBihan
Copy link

YannLeBihan commented Mar 7, 2017

Hi,

Tried this today on two different machines running macOS Sierra 10.12.3 :

  1. Fresh install of Meteor
  2. Fresh install of Android Studio 2.3 + all possible SDK platforms
  3. Create a Meteor project, cd to its directory
  4. Run meteor add-platform android

Always got the same errors :

✗ Android target: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.

✗ Gradle: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

Here's what I tried :

  1. Checked $ANDROID_HOME and $PATH after setting them like said in the Meteor Guide : both are OK;
  2. Downgraded Android Studio to its previous version (2.2.3) that had been working up to yesterday : same result, even after removing all Android Studio support and pref files;
  3. Ran several times meteor remove-platform android and meteor add-platform android : same errors;
  4. Removed all SDK platforms from Android Studio, reinstalled just Android 5.1, then tried the same with Android 7.1.1 : ditto.

I'd like to know if others are experiencing the same issue, and if they found a solution or workaround.

Thanks in advance !

@robertross
Copy link

+1

Yes same here!
Pretty much exact same scenario with me. Took the same steps as you outlined and have failed to get it working.

abernix added a commit to meteor/guide that referenced this issue Mar 7, 2017
Meteor 1.4.3.x now ships with Cordova version 6.4.0.  This requires
Android Studio SDK version 25.

This should be listed here, but it's not:
  https://cordova.apache.org/docs/en/latest/guide/platforms/android/

Addresses meteor/meteor#8464
@abernix
Copy link
Contributor

abernix commented Mar 7, 2017

Meteor 1.4.3.1 uses Cordova 6.4.0 which I'm fairly sure requires Android SDK version 25 to be installed with the Android Studio SDK Manager (whereas previous versions used 24 or 23). I just updated the Guide to reflect this (see above commit) as I'm almost positive this is required. We should probably update History.md too in order to make sure this is clear, but do you mind confirming first if this fixes your issue?

If you don't have the full Android Studio, you should be able to start the SDK Manager with something like:

$ANDROID_HOME/tools/android sdk

Can you report back if this works for you and we'll get the History.md updated with that note?

@YannLeBihan
Copy link
Author

Thank you for your answer. Meanwhile, I have installed Android SDK version 25 twice :

  1. first with Android Studio's integrated tool, which led to the same errors
  2. then with the standalone version I had kept from a previous SDK folder : after this second try, things started to get better, Meteor was able to build for Android again.

But as soon as I tried to bring Android Studio to the party (to build signed apks, manage virtual devices, etc.) it prompted me to upgrade some tools in that folder, including Gradle : I accepted the upgrade, which broke things again.

I then took a look into Gradle's former folder : it had been moved elsewhere - hence the Meteor/Cordova error about Gradle, I guess.

Will now try to get a stable setup by reusing a copy of this folder and not doing the faulty Gradle upgrade, to see if it is a viable workaround.

@YannLeBihan
Copy link
Author

YannLeBihan commented Mar 8, 2017

OK, I can now confirm that the most recent upgrades in Android Studio (SDK Tools + Gradle) break the link between Android and Meteor/Cordova, at least on the Mac : just upgrading the SDK Tools to latest version is enough to raise the errors I described in my first post, with no obvious way to fix them.

As for Gradle, Meteor tries to find it inside /tools/templates/gradle/, but the templates directory disappears after the SDK Tools upgrade.

The only workaround I found up to now is to reuse an old android-sdk-macosx folder from a previous install, to point Android Studio to that folder rather than its default SDK folder, and to refuse upgrading SDK Tools and Gradle when prompted to. This way, I can fire meteor run android, meteor run android-device and meteor build with success. Updates are done by double-clicking on android-sdk-macosx/tools/android rather than through Android Studio.

It seems to work for the moment, but I don't know if it will be useable for production very long.

An advice to those who would be willing to try this workaround : above all, keep a zipped backup of your previous SDK folder next to it before touching anything.

@abernix
Copy link
Contributor

abernix commented Mar 8, 2017

@YannLeBihan I'll have to revisit this because I tested Meteor 1.4.3 with Cordova 6.4.0 on macOS Sierra before we released Meteor 1.4.3.x and it worked fine.

Also, my above command for running the SDK Manager was incorrect, my apologies. It should have been:

$ANDROID_HOME/tools/android sdk

(Note tools instead of bin – I've corrected the above comment to avoid confusion by others).

In case it's any help, here's what my SDK Manager looks like:

image

This also seems to possibly be a trending issue right now as a search for the following returned a number of active issues, such as this one:

Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.

Hope this helps until someone can look at this more!

@robertross
Copy link

robertross commented Mar 9, 2017

@abernix

So I'm running Mac Os El Capitan 10.11.6.

$ANDROID_HOME/tools/android sdk

Still seems incorrect I'm afraid. It gives me...

The android command is no longer available.
For manual SDK and AVD management, please use Android Studio.
For command-line tools, use tools/bin/sdkmanager and tools/bin/avdmanager

I can run sdkmanager using that path. And made sure that I have installed all relevant packages for Android platform-25 etc. but still this happens...

Getting installed version for platform android in Cordova project
Checking Cordova requirements for platform Android
                                              
Your system does not yet seem to fulfill all requirements to build apps for Android.
                                              
Please follow the installation instructions in the mobile guide:
http://guide.meteor.com/mobile.html#installing-prerequisites
                                              
Status of the individual requirements:        
✓ Java JDK                                    
✓ Android SDK                                 
✗ Android target: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
✗ Gradle: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
  Looked here: /Users/robertross/Library/Android/sdk/tools/templates/gradle/wrapper

Has anyone any more insight into what's happening here?

Unfortunately @YannLeBihan 's Suggested workaround of pointing to an older android-sdk-macosx directory isn't practical for me.

@loredanacirstea
Copy link

loredanacirstea commented Mar 9, 2017

Solved (temporarily) by replacing the new updated 25.3.1 Android SDK Tools with version 25.2.5:

I had the same issues after this morning's update: Android Studio to ver. 2.3, Feb 24 build + sdk&co.
Meteor ver. 1.4.3.1
Mac OS Sierra 10.12.3

✓ Java JDK                                    
✓ Android SDK                                 
✗ Android target: Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME
  environment variable.
✗ Gradle: Could not find gradle wrapper within Android SDK. Might need to update your Android SDK.
  Looked here: /Users/loredana/Library/Android/sdk/tools/templates/gradle/wrapper

@robertross
Copy link

@loredanacirstea Yes that worked for me also.

Thanks for the workaround and the link.

I did not have to uninstall Android SDK Tools 25.3.1, I just switched out the tools folder. Feels wrong though.

abernix added a commit to meteor/guide that referenced this issue Mar 10, 2017
Android SDK 25.3.0 has breaking changes that prevent Meteor from finding it properly.  Anything in the 25.x series _before_ 25.3.0 should work find.

https://developer.android.com/studio/releases/sdk-tools.html
Relates to: meteor/meteor#8464
@abernix
Copy link
Contributor

abernix commented Mar 10, 2017

I certainly didn't test with Android SDK Tools 25.3.x, but rather 25.2.5 as you can see in my screenshot. Android SDK Tools 25.3 (which came out after Meteor 1.4.3) definitely has a lot of breaking changes according to their release notes.

This will need to be looked at and if anyone who uses Cordova on a more regular basis is able to look into it, it would be greatly appreciated.

Unfortunately, it's not a regular occurrence for deep-dives into Cordova so this may take a bit to get resolved. Furthermore, the changes appear substantial, though I'm hoping that's just at first glance. The good news is that if you stick with Android SDK 25.2.5 (or anything in the 25.x series before 25.3.0) for the time being, you should be okay; my builds still work properly with 25.2.5.

I've updated the Guide to clarify this limitation with meteor/guide@adc963a.

Help requested!

@abernix abernix changed the title Meteor 1.4.3.1 on Mac : "Android target: Android SDK not found" [1.4.3.1] Android SDK not found with Android SDK 25.3.0 or higher. Mar 10, 2017
@eric-burel
Copy link
Contributor

eric-burel commented Mar 10, 2017

This link does provide working SDK tools 25.2.3 : http://androidsdkoffline.blogspot.fr/p/android-sdk-tools.html (eventhough it looks weird)
It has been succesfully tested on Debian, simply following the process proposed by @loredanacirstea

@abernix
Copy link
Contributor

abernix commented Mar 11, 2017

The 25.2.3 tools are still linked from the official Android source (at the very bottom), so no need to use the blogpost link at the current moment (Though they appear to point to the same, official sources):

https://developer.android.com/studio/index.html#downloads

@dnish
Copy link

dnish commented Mar 16, 2017

I guess the Cordova team is working on it:

https://issues.apache.org/jira/browse/CB-12554

@fcacheda
Copy link

Thanks a lot for the help. I managed to change the tools directory and move on from the Android SDK error. However, now I get an error regarding gradle plugin.
In fact when I try to access with my browser to the URL for the pom, there is a 404 Not found error.

Any ideas about what's going on?

` FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'android'.

Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.2.1.
Required by:
:android:unspecified
Could not resolve com.android.tools.build:gradle:2.2.1.
Could not get resource
'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom'.
Could not GET
'https://repo1.maven.org/maven2/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom'.
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target
Could not resolve com.android.tools.build:gradle:2.2.1.
Could not get resource
'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom'.
Could not GET
'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.1/gradle-2.2.1.pom'.
sun.security.validator.ValidatorException: PKIX path building failed:
sun.security.provider.certpath.SunCertPathBuilderException: unable to find
valid certification path to requested target`

@MrGarrowson
Copy link

MrGarrowson commented Mar 20, 2017

I'm on Linux, I uninstalled android-studio and only installed tools and platform tools. I installed tools_r25.2.5-linux.zip and I still have a problem.

Status of the individual requirements:
✓ Java JDK

✓ Android SDK

✗ Android target: Android SDK not found. Make sure that it is installed. If it
is not at the default location, set the ANDROID_HOME environment variable.

✓ Gradle

this is in my .bashrc, although I doubt it is a problem with the PATH

export ANDROID_HOME=/opt/Android/Sdk

export PATH=$PATH:$ANDROID_HOME/tools

export PATH=$PATH:$ANDROID_HOME/platform-tools

export PATH=$PATH:$ANDROID_HOME/build-tools

EDIT: This is also a fresh install of meteor, I'm on Meteor 1.4.3.2

@abernix
Copy link
Contributor

abernix commented Mar 20, 2017

@MrGarrowson What happens if you type the following at your command prompt?

echo $ANDROID_HOME

and...

ls -la $ANDROID_HOME/

It's entirely possible that you should have $ANDROID_HOME/bin in your path too as that is where the android command itself lives. For example, you should be able to run android sdk on your console and the SDK manager should load.

@MrGarrowson
Copy link

MrGarrowson commented Mar 21, 2017

@abernix Thanks for the reply,
echo $ANDROID_HOME
prints
/opt/Android/Sdk
and
ls -la $ANDROID_HOME/
prints
total 28
drwxr-xr-x 6 root root 4096 mar 19 19:47 .
drwxr-xr-x 3 root root 4096 mar 19 19:13 ..
drwxr-xr-x 3 root root 4096 mar 19 19:47 build-tools
-rw-r--r-- 1 root root 16 mar 19 22:07 .knownPackages
drwxr-xr-x 5 root root 4096 mar 19 22:07 platform-tools
drwxr-xr-x 2 root root 4096 mar 19 19:47 temp
drwxr-xr-x 12 root root 4096 mar 19 19:36 tools

I don't have $ANDROID_HOME/bin and if I run android sdk it tells me command not found, I think that's it. To install it should I go to /opt/Android/Sdk and run ./android update sdk? What package is it?
EDIT: I noticed that my folders are from the user root. I had to unzip the android tools with the sudo command beacause /opt/ is write protected, is this wrong? should I install android on my home folder instead?

@skirunman
Copy link
Contributor

@ignacy130 Yep, thanks, fixed typo!

@scottburch
Copy link

Do we have any idea on when this will be resolved? We are using BuddyBuild for our Android/iOS build, which is failing because they are using the newer Android SDK. I can probably do the hack to the build.gradle file that allows it to work but I don't know how to hook into the build cycle to make the change. I'm still working on that.

Thanks

@skirunman
Copy link
Contributor

skirunman commented Aug 8, 2017

@scottburch If can install and use Meteor v1.5.2-beta.8 then you should be able to build with the latest versions of Android. Not sure when official 1.5.2 release will drop, but guessing soon.

@scottburch
Copy link

scottburch commented Aug 8, 2017 via email

@skirunman
Copy link
Contributor

We were experimenting with BuddyBuild and ran into some issues. However, we are able to build just fine on MacOS. Can you build you app on your local dev machine with 1.5.2-beta.8 and Android SDK tools v26.x.x?

@scottburch
Copy link

@skirunman We just got done working with BuddyBuild to get the build working with 1.5.2-beta.8. We still have a little bit of work to do, as soon as we have verified the builds on the mobile devices I will update this thread with the patch that we have and how we used it.

@scottburch
Copy link

scottburch commented Aug 9, 2017

@skirunman Here is our buddybuild_postclone.sh file. We had to include a patch for a known issue as well as the directions from the buddybuild instructions to build meteor.

The patch is if you get errors during the manifest file merge.

IMPORTANT: In addition, the BB guy had to set a flag to stop the BB build from doing the cordova step since meteor was doing that already which caused the build to fail with:

Buddybuild has detected that you've committed your 'platforms' directory for your cordova project. This can oftentimes lead to issues. It is generally recommended to let Buddybuild generate the platforms directory
    Using Command Line: cordova --no-interactive build ios
    Error: cordovaProject.projectConfig.getFileResources is not a function

buddybuild_postclone.sh

curl https://install.meteor.com/ | sh
yarn (or npm install, we are using yarn)
meteor build $PLATFORM --server $SERVER

cat bbgradle.patch >> .meteor/local/cordova-build/platforms/android/build.gradle

bbgradle.patch

configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '25.3.0'
}
}
}
}

@skirunman
Copy link
Contributor

@scottburch Thanks, we may give this a try again.

@derwaldgeist
Copy link

derwaldgeist commented Aug 13, 2017

Ran into the same issue after upgrading my Android Studio installation for other reasons. I cannot upgrade to Meteor 1.5.1+, since it breaks my app due to #8950. Will the Cordova fix be downported to 1.5?

Until the fix has been released, what's the best configuration of Android Studio for now? I am a bit puzzled since there are so many suggestions in this thread.

According to the current Meteor guide, Android SDK tools 26.x should be ok. I have 26.0.2 installed on my Mac, and it doesn't work. I'm using Android Studio 2.3.3. I also noticed that the folder ~/Library/Android/sdk/tools/templates is missing on my machine.

Update: It worked with 25.2.5

@narigondelsiglo
Copy link

narigondelsiglo commented Aug 14, 2017

@derwaldgeist I've got it working again with the updated Android Studio version by updating meteor to the next 1.5.2 version (in beta for now).
To update your local project you need to issue:
$ meteor update --release 1.5.2-beta.8
$ meteor remove-platform android
$ meteor add-platform android

@derwaldgeist
Copy link

Unfortunately, I cannot update to 1.5.2 until #8950 has been fixed.
I solved this problem here by manually installing SDK 25.2.5 again.

@fcacheda
Copy link

Thanks @narigondelsiglo, it worked for me, with android-25.

@AprilMorone
Copy link

I came across this same issue when running Cordova Android and SDK on Ubuntu via Terminal. But, if I tried downloading Android Studio, instead, of non-zip linux file extension through the terminal - not the liinux zip file of Android Studio website - same issue upon trying to do Cordova build android command. However, when I'd downloaded then used the Android Studio linux zip file, I couldn't find the apk file. I'd have have to change where certain files are located before I could do the build.

@lesliechw
Copy link

lesliechw commented Aug 23, 2017

meteor update --release 1.5.2-beta.13

Problem gone. So we can be assured that the next version of Meteor will fix this issue.

@skirunman
Copy link
Contributor

skirunman commented Sep 11, 2017

@abernix Can we close this out along with the other 6 issues tagged with Milestone Release 1.5.2?

We are releasing a new version of our product and just want to confirm all these issues are in fact fixed in 1.5.2. Thanks!

@abernix
Copy link
Contributor

abernix commented Sep 11, 2017

I'll close this based on the comment above from @lesliechw (Thanks, Leslie!), but the other issues on the milestone are certainly not confirmed fixed unless you or someone can help test them! If they are still on the milestone, they are things we didn't get to and will be moved to a new milestone once they've been evaluated. Your help would be appreciated!

@abernix abernix closed this as completed Sep 11, 2017
@climbonbelay
Copy link

@Atout-Agile thank you for the download link

@paulincai
Copy link
Contributor

paulincai commented Oct 1, 2017

@abernix just FYI as I see this is closed now. Meteor 1.5.2.1 works ok with all latest versions within Android Studio (including SDK Tools - 26.1.1 )

@AndreyVik
Copy link

Good afternoon, I'm new
I read the previous posts, but it did not help me. Please give clear step-by-step instructions on how to get rid of errors.

MacBook-Pro-Alexey:Enter av$ meteor add-platform android
Subproject Path: CordovaLib
Subproject Path: CordovaLib
android: added platform

Your system does not yet seem to fulfill all requirements to build
apps for Android.

Please follow the installation instructions in the mobile guide:
http://guide.meteor.com/mobile.html#installing-prerequisites

Status of the individual requirements:
✓ Java JDK
✓ Android SDK
✗ Android target: avdmanager: Command failed with exit code 1 Error
output:
Exception in thread "main" java.lang.NoClassDefFoundError:
javax/xml/bind/annotation/XmlSchema
at
com.android.repository.api.SchemaModule$SchemaModuleVersion.(SchemaModule.java:156)
at
com.android.repository.api.SchemaModule.(SchemaModule.java:75)
at
com.android.sdklib.repository.AndroidSdkHandler.(AndroidSdkHandler.java:81)
at
com.android.sdklib.tool.AvdManagerCli.run(AvdManagerCli.java:213)
at
com.android.sdklib.tool.AvdManagerCli.main(AvdManagerCli.java:200)
Caused by: java.lang.ClassNotFoundException:
javax.xml.bind.annotation.XmlSchema
at
java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at
java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 5 more
✓ Gradle

SDK
image

@alp1396
Copy link

alp1396 commented Dec 2, 2017

Hi all.
Same problem as @AndreyVik. And there is no ideas how to fix that.
Updated the project from 1.4 to 1.5 and then to 1.6 and Installed fresh Android Studio.
Guide from https://guide.meteor.com/mobile.html#installing-prerequisites-android seems to be outaded because Meteor 1.6 has a new (or another) Cordova module inside and it seems like Android SDK Tools v.25.2.x doesn't supported now.
Any Ideas?
Win10, JDK 9.0.1, Meteor 1.6, Android Studio 3.0.1, Android SDK Tools v.26.1.1

2017-12-02_18-57-22 2

@alp1396
Copy link

alp1396 commented Dec 5, 2017

Problem has gone after full reinstall meteor through Choco. And changing JDK from v9 to previous 1.8
Maybe someone will helps that)

@abtx
Copy link

abtx commented Dec 28, 2017

Same problem here, JDK 1.8, Android Studio 3.0.1, Meteor 1.6, Tools 26.1.1 on OSX Sierra

@albertkai
Copy link

albertkai commented Dec 29, 2017

same.. after upgrading to 1.6 the build command still worked, but after removing and adding android platform getting:
Status of the individual requirements:
✓ Java JDK
✓ Android SDK
✗ Android target: No android targets (SDKs) installed!
✓ Gradle

@Rinnion
Copy link

Rinnion commented Jan 20, 2018

Are you using java9?
Remove and install java8 its work for me.
Here identical trouble:
https://stackoverflow.com/questions/46402772/failed-to-install-android-sdk

@MaxShv
Copy link

MaxShv commented Jan 23, 2018

Same issue JDK 1.8, Android Studio 3.0.1, Meteor 1.6

@abernix
Copy link
Contributor

abernix commented Jan 23, 2018

@MaxShv Could you clarify what "Same issue" is by providing detailed error messages and steps? There are a number of errors reported in this rather large and old thread. Also, please make sure you have Android SDK 26 installed (older versions should be okay as well but 27 will be problematic for the time being).

In fact, for the sanity and reduced noise of the 37+ participants in this issue who may have having different issues, I'll lock this issue and ask that this be taken up in a new issue. We're currently analyzing and attempting to address Android/Cordova issues in preparation for 1.6.2, so please do take the time to open a new issue so we can look at it!

Thanks!

@meteor meteor locked and limited conversation to collaborators Jan 23, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests