Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Flipper Doctor complains Android SDK is not installed #667

Closed
paour opened this issue Dec 2, 2019 · 33 comments
Closed

Flipper Doctor complains Android SDK is not installed #667

paour opened this issue Dec 2, 2019 · 33 comments

Comments

@paour
Copy link
Contributor

paour commented Dec 2, 2019

🐛 Bug Report

I've been using Flipper since before the name change and it's always worked fine (still does).

However, on each launch, I get an error banner claiming there are problems with my install.

Flipper

My Android SDK is configured correctly, and complete.

Flipper

android-sdk

To Reproduce

Launch Flipper, or start Doctor.

Expected Behavior

Doctor should not claim there is an error with my setup. Of if there really are, it should describe the issue in a way that makes it actionable.

Environment

  • MacOS High Sierra 10.13.6
  • Flipper 0.29.4
adb --version
Android Debug Bridge version 1.0.41
Version 29.0.5-5949299
Installed as /Applications/Dev/android-sdk/platform-tools/adb
@jknoxville
Copy link
Contributor

Interesting, thanks for reporting.

What do you get if you run this from the command line?
npx envinfo

and also this:
ANDROID_HOME=/Applications/Dev/android-sdk npx envinfo

@paour
Copy link
Contributor Author

paour commented Dec 2, 2019

Thank you for pointing me in the right direction! As you surmised, the tool didn't detect my Android SDK in with either command.

After looking at the source for envinfo, I realized the root cause was this issue.

The short-term fix for me is downgrading the version of Java I use by default, until Google finally updates their build tools for a current version of Java.

@ZacSweers
Copy link
Contributor

ZacSweers commented Jan 9, 2020

I have this issue as well despite correct env info and my JAVA_HOME set to jdk 8

Env info is

Android SDK:
      API Levels: 25, 28, 29
      Build Tools: 25.0.2, 28.0.3, 29.0.0, 29.0.2
      System Images: android-29 | Google APIs Intel x86 Atom
      Android NDK: 21.0.5935234

It would be tremendously helpful if the doctor displayed some explanation as to why it believes it's failed. The current screen gives no actionable information to the developer.

image

@nikoant
Copy link
Contributor

nikoant commented Jan 16, 2020

@ZacSweers are you using Flipper v0.30.1?

@zlil
Copy link

zlil commented Jan 16, 2020

@nikoant I am using Flipper v0.30.1? and also having the same issue

@nikoant
Copy link
Contributor

nikoant commented Jan 16, 2020

@zlil, right, I think the issue was fixed after v0.30.1 released. Could you try build Flipper from master and check?

@ericksli
Copy link

Same issue when using v0.30.1 on Windows 10. I have customized the Android SDK location in Flipper but it still shows the warning banner.

PS C:\Users\Eric> adb --version
Android Debug Bridge version 1.0.41
Version 29.0.5-5949299
Installed as E:\Android\Sdk\platform-tools\adb.exe
PS C:\Users\Eric> npx envinfo
npx: installed 1 in 1.131s

  System:
    OS: Windows 10 10.0.18363
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 24.26 GB / 31.92 GB
  Binaries:
    Node: 12.2.0 - C:\Program Files\nodejs\node.EXE
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Utilities:
    Git: 2.21.0.
  IDEs:
    VSCode: 1.41.1 - C:\Users\Eric\AppData\Local\Programs\Microsoft VS Code\bin\code.CMD
  Languages:
    Java: 12.0.1
  Databases:
    SQLite: 3.28.0 - E:\Android\Sdk\platform-tools\sqlite3.EXE
  Browsers:
    Edge: 44.18362.449.0
    Internet Explorer: 11.0.18362.1

@ZacSweers
Copy link
Contributor

This remains broken in 0.30.2

@nikoant
Copy link
Contributor

nikoant commented Jan 22, 2020

@ZacSweers still reproducible with Java 8? That’s strange because the problem was that SDK is detected using sdkmanager, but the latter is not compatible with Java 9+. For Java 9 and 10 we implemented is a workaround, but not for 11+. This issue is planned to be fixed in Android Studio 3.6 release: https://issuetracker.google.com/issues/67495440.

As the issues with SDK detection are very environment-specific, could you please provide more information?

  1. Post the full output of "npx envinfo"
  2. Check that Android SDK path is correct in Flipper settings
  3. Check whether you have environment variable ANDROID_HOME set on your machine? Does it points to the same dir as the SDK path in Flipper settings or different?

@ZacSweers
Copy link
Contributor

I posted my info in my comment higher up, yes confirmed #2 and #3. It would be helpful if the app showed me some sort of diagnostic of what it tried to find and thinks is missing.

@nikoant
Copy link
Contributor

nikoant commented Jan 24, 2020

@ZacSweers I've changed implementation of Android SDK detection to avoid using sdkmanager, and also added some (rather minimal) feedback for failed checks in this commit: b625efe. Would be great if you can build from master and test this.

@ZacSweers
Copy link
Contributor

ZacSweers commented Jan 24, 2020 via email

@ZacSweers
Copy link
Contributor

Unfortunately I'm unable to build from master locally. Running on mac and running yarn completes successfully, but neither yarn start nor yarn build run successfully

zsweers@NYC-M-ZSWEERS01  ~/dev/misc/clones/flipper   master ●  yarn start
yarn run v1.21.1
$ cross-env NODE_ENV=development node scripts/start-dev-server.js
internal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module 'electron'
Require stack:
- /Users/zsweers/dev/misc/clones/flipper/scripts/start-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/zsweers/dev/misc/clones/flipper/scripts/start-dev-server.js:10:24)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/zsweers/dev/misc/clones/flipper/scripts/start-dev-server.js'
  ]
}
yarn build --mac --version 0.1.0-local
yarn run v1.21.1
$ yarn rm-dist && cross-env NODE_ENV=production node scripts/build-release.js $@ --mac --version 0.1.0-local
$ rimraf dist
internal/modules/cjs/loader.js:983
  throw err;
  ^

Error: Cannot find module 'electron'
Require stack:
- /Users/zsweers/dev/misc/clones/flipper/src/utils/icons.js
- /Users/zsweers/dev/misc/clones/flipper/scripts/build-release.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:980:15)
    at Function.Module._load (internal/modules/cjs/loader.js:862:27)
    at Module.require (internal/modules/cjs/loader.js:1040:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/Users/zsweers/dev/misc/clones/flipper/src/utils/icons.js:17:18)
    at Module._compile (internal/modules/cjs/loader.js:1151:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1040:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/zsweers/dev/misc/clones/flipper/src/utils/icons.js',
    '/Users/zsweers/dev/misc/clones/flipper/scripts/build-release.js'
  ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@ZacSweers
Copy link
Contributor

Actually I see now that my yarn version is old, despite being the latest available on homebrew 🤔 . Will try installing manually

@ZacSweers
Copy link
Contributor

Ok I'm not sure I understand. The README says it requires yarn 1.5+, yet that doesn't exist according to yarn's website

image

@nikoant
Copy link
Contributor

nikoant commented Jan 26, 2020

@ZacSweers 1.21 is newer than 1.5 (1.05). I don't think the problem here is in yarn, it rather looks like "electron" module was not installed properly. Could you check that it exists in node_modules?

@ZacSweers
Copy link
Contributor

Just tried a fresh clone in better wifi and looks like everything works! No more reported errors and I was successfully able to use flipper with my android app 🎉

@nikoant
Copy link
Contributor

nikoant commented Jan 27, 2020

@ZacSweers good news! Thank you for checking this.

I'm closing this issue then, SDK detection should work now disregard version of Java version.

@nikoant nikoant closed this as completed Jan 27, 2020
@a-eid
Copy link

a-eid commented Apr 7, 2020

@nikoant I'm facing the same issue,
flipper is weirdly saying that android_home is /opt/android_sdk and doesn't exit ..
which it is not true at all
Screen Shot 2020-04-08 at 00 06 51

everything regarding android is working fine for me, I'm not sure what the issue is here, could u please let me know what u think of this ?

thanks.

@paour
Copy link
Contributor Author

paour commented Apr 8, 2020

@a-eid on Mac, console apps and gui apps do not necessarily share the same environment. Try exporting your console env:

launchctl setenv JAVA_HOME $JAVA_HOME

@joaovpmamede
Copy link

@paour same thing happening to me but that didn't fix it.
Anything else I should try?

@Victor502
Copy link

I fixed the error by going to my local.properties file in VS Code coping the sdk.dir which mine is /Users/[MYUSER]/Library/Android/sdk then I went in Filpper -> File -> Preferences and changed the Android SDK Location See image..
Flipper

Then I clicked the Apply and Restart Button

@joaovpmamede
Copy link

Thanks @Victor502.
Ended up doing the same yesterday and it fixed the issue.

@SuarezLuis
Copy link

SuarezLuis commented May 22, 2020

in your terminal type echo $ANDROID_HOME that will give you the path to the Android SDK.

Copy that path and paste it in Flipper -> File -> Preferences -> Android SDK Location.

image

Apply and restart and you should be done.

@alecpo
Copy link

alecpo commented May 30, 2020

You can also check on SDK manager at Android Studio the place of SDK :)

@kiranjd
Copy link

kiranjd commented Jul 3, 2020

In your terminal, run echo $ANDROID_HOME, copy the path over to Flipper settings

@Cordobo
Copy link

Cordobo commented Sep 23, 2020

On Mac OS I put ~/Library/Android/sdk into flippers settings first, turns out, flipper wants an absolute path like /Users/<username>/Library/Android/sdk

@ghost
Copy link

ghost commented Dec 18, 2020

I fixed the error by going to my local.properties file in VS Code coping the sdk.dir which mine is /Users/[MYUSER]/Library/Android/sdk then I went in Filpper -> File -> Preferences and changed the Android SDK Location See image..
Flipper

Then I clicked the Apply and Restart Button

This solution works for me. Thanks!

@chr4ss12
Copy link

Flipper wants absolute path, maybe option to the GUI so the urls won't contain tilde?

@imsudesh
Copy link

Screenshot 2022-03-30 at 3 26 40 PM

@SuarezLuis @Victor502 @quyentran-agilityio In my case this error shows and I am unable to update the sdk location. I am using mac.
Failed to persist Flipper settings Error: EACCES: permission denied, mkdir '/Users/<username>/.config/flipper'

@Victor502
Copy link

@imsudesh seems like a folder permission, this could get you going in the right direction

@sanjeevkse
Copy link

in your terminal type echo $ANDROID_HOME that will give you the path to the Android SDK.

Copy that path and paste it in Flipper -> File -> Preferences -> Android SDK Location.

image

Apply and restart and you should be done.

For new Flipper (Mac version). Its under cog icon > settings

@Nurtaz440
Copy link

..\Android\Sdk\platform-tools> android_sdk/platform-tools
android_sdk/platform-tools : The term 'android_sdk/platform-tools' is not recognized as the name of a cmdlet, function, script file, or operable program. Check
the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • android_sdk/platform-tools
  •   + CategoryInfo          : ObjectNotFound: (android_sdk/platform-tools:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    
    

I have this error how i cansolve it

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests