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 Emulator not working (with Genymotion) #151

Closed
Taremeh opened this issue Sep 19, 2016 · 5 comments
Closed

Android Emulator not working (with Genymotion) #151

Taremeh opened this issue Sep 19, 2016 · 5 comments
Labels

Comments

@Taremeh
Copy link

@Taremeh Taremeh commented Sep 19, 2016

First of all, I setup everything as it was written in the sample-Groceries tutorial.

  • tns doctor says, it's all fine.
  • IOS emulator works correctly.
  • Genymotion is setup and working (as far as emulating Android 6 on Nexus 6P)

But if I want to "tns run android" I get the following response:

Executing before-prepare hook from /Users/Myname/Documents/Development/19-09/sample-Groceries/hooks/before-prepare/nativescript-dev-typescript.js
Found peer TypeScript 1.8.10
Downloading https://services.gradle.org/distributions/gradle-2.10-bin.zip
....................................................................................................................
....................................................................................................................
....................................................................................................................
..............................................................................................

It starts to download this zip file. First, shouldn't this download be done in the setup process?
Second, it takes endless time to finish...
I aborted after 20 minutes... So I couldn't even start the Nativescript app...

Update: I tried it again with "tns run android" but after 50 minutes the download process got stuck and I ended up with a terminal screen full of dots and no success...

I tried to find the problem, but couldn't. Here's what I get, if I run "tns device" (it's my Genymotion Android emulator)

┌───┬─────────────┬──────────┬─────────────────────┬──────────┬───────────┐
│ # │ Device Name │ Platform │ Device Identifier   │ Type     │ Status    │
│ 1 │ vbox86p     │ Android  │ 111.111.11.111:5555 │ Emulator │ Connected │
└───┴─────────────┴──────────┴─────────────────────┴──────────┴───────────┘
@Taremeh

This comment has been minimized.

Copy link
Author

@Taremeh Taremeh commented Sep 20, 2016

Update on this issue:
Today I tried the alternative way to emulate Android (through Android AVD).
I run "tns run android" and got this error:

Processing node_modules failed. Exception: Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 22 or later.

But I could quickly fix it with setting ANDROID_HOME again:
export ANDROID_HOME=/usr/local/opt/android-sdk

Then the same process, as described in the actual post above, began again, but it downloaded (https://services.gradle.org/distributions/gradle-2.10-bin.zip) way way faster, configured the project in three steps automatically and finally run it successfully!

So to everybody how got this issue and wants to get started with the tutorial (on Android): Just have a look here:
http://developer.telerik.com/featured/using-android-emulator-hybrid-mobile-apps-telerik-appbuilder/#managing-avds

However, the issue with Genymotion still isn't fixed...

@NickIliev

This comment has been minimized.

Copy link
Member

@NickIliev NickIliev commented Nov 3, 2016

Hey @Taremeh

Try to remove the hooks folder before running the app.

rm -rf hooks
tns run android

Still, I recommend using an AVD emulator (with pre-installed HAXM) in favor of Geny.
The new AVDs are way faster and reliable compared to the Geny's

@NickIliev NickIliev added the question label Nov 3, 2016
@Taremeh

This comment has been minimized.

Copy link
Author

@Taremeh Taremeh commented Nov 5, 2016

Unfortunately this didn't help. I still have to set ANDROID_HOME every time I want to emulate the app.

In Visual Studio (=> Debug with offical Nativescript plugin) I can't even emulate the app:

The ANDROID_HOME environment variable is not set or it points to a non-existent directory. 
You will not be able to perform any build-related operations for Android.
To be able to perform Android build-related operations, set the ANDROID_HOME variable 
to point to the root of your Android SDK installation directory.

[31;1mCannot read property 'toString' of undefined

@tjvantoll

This comment has been minimized.

Copy link
Contributor

@tjvantoll tjvantoll commented Jan 30, 2017

Hope this issue was eventually resolved. If the problem still occurs we can move this discussion to the NativeScript CLI repo, as this isn’t a problem specific to this sample.

@tjvantoll tjvantoll closed this Jan 30, 2017
@malachany

This comment has been minimized.

Copy link

@malachany malachany commented Mar 9, 2017

I was able to resolve the issue on OSX by moving the following from ~/.profile to ~/.bash_profile:
export ANDROID_HOME=/usr/local/opt/android-sdk
export JAVA_HOME=/Library/Java/Home

Hope this helps someone out. Running macOS Sierra 10.12.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.