title: My nativescript app is not connecting to my json server database
body: <p>I am creating a nativescript app with angular, I am using a json server.
  I have my json server running and when I run 'tns run android' in my  I get that it is successfully synced but my app appears blank.</p>
  
  <p>I can access my json server database on my phone browser</p>
  
  <p>all my cabins.component.ts</p>
  
  <pre><code>    import { Component, OnInit, Inject } from '@angular/core';
  import { Cabin } from '../shared/cabin';
  import { CabinService } from '../services/cabin.service';
  
  @Component({
    selector: 'app-cabins',
    moduleId: module.id,
    templateUrl: './cabins.component.html'
  })
  
  export class CabinsComponent  implements OnInit {
    cabins: Cabin[];
  
    errMess: string;
  
    constructor(private cabinService: CabinService,
      @Inject('BaseURL') private BaseURL) {
    }
  
    ngOnInit() {
      this.cabinService.getCabins()
        .subscribe(cabins =&gt; this.cabins = cabins,
          errmess =&gt; this.errMess = &lt;any&gt;errmess);
    }
  
  }
  </code></pre>
  
  <p>all my cabin.service.ts</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Cabin } from '../shared/cabin';
  import { Observable } from 'rxjs';
  import { Http, Response } from '@angular/http';
  import { HttpClient, HttpHeaders } from "@angular/common/http";
  import { baseURL } from '../shared/baseurl';
  import { ProcessHTTPMsgService } from './process-httpmsg.service';
  import { map } from "rxjs/operators";
  import { catchError } from "rxjs/operators";
  
  @Injectable()
  export class CabinService {
  
    cabins: any[];
  
    constructor(private http: HttpClient,
                private processHTTPMsgService: ProcessHTTPMsgService) { }
  
    getCabins(): Observable&lt;Cabin[]&gt; {
      return this.http.get(baseURL + 'cabins')
                      .pipe(map(res =&gt; { return this.processHTTPMsgService.extractData(res); }),
                      catchError(error =&gt; { return this.processHTTPMsgService.handleError(error); }));
    }
  
    getCabin(id: number): Observable&lt;Cabin&gt; {
      return  this.http.get(baseURL + 'cabins/'+ id)
                      .pipe(map(res =&gt; { return this.processHTTPMsgService.extractData(res); }),
                      catchError(error =&gt; { return this.processHTTPMsgService.handleError(error); }));
    }
  
    getFeaturedCabin(): Observable&lt;Cabin&gt; {
      return this.http.get(baseURL + 'cabins?featured=true')
                      .pipe(map(res =&gt; { return this.processHTTPMsgService.extractData(res)[0]; }),
                      catchError(error =&gt; { return this.processHTTPMsgService.handleError(error); }));
    }
  
  }
  </code></pre>
  
  <p>My app.module.ts </p>
  
  <pre><code>    imports: [
          NativeScriptHttpClientModule,
          NativeScriptModule,
          AppRoutingModule
      ],
  providers: [
      {provide: 'BaseURL', useValue: baseURL},
      CabinService,
      ProcessHTTPMsgService
  ]
  </code></pre>
  
  <p>I am getting this message in the console</p>
  
  <p>× 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 <code>ANDROID_HOME</code> variable to point to the root of your Android SDK installation directory.</p>
  
  <p>× WARNING: adb from the Android SDK is not installed or is not configured properly.
   For Android-related operations, the NativeScript CLI will use a built-in version of adb.
  To avoid possible issues with the native Android emulator, Genymotion or connected
  Android devices, verify that you have installed the latest Android SDK and
  its dependencies as described in <a href="http://developer.android.com/sdk/index.html#Requirements" rel="nofollow noreferrer">http://developer.android.com/sdk/index.html#Requirements</a></p>
  
  <p>× WARNING: The Android SDK is not installed or is not configured properly.
   You will not be able to run your apps in the native emulator. To be able to run apps
  in the native Android emulator, verify that you have installed the latest Android SDK
  and its dependencies as described in <a href="http://developer.android.com/sdk/index.html#Requirements" rel="nofollow noreferrer">http://developer.android.com/sdk/index.html#Requirements</a></p>
  
  <p>× Cannot find a compatible Android SDK for compilation. To be able to build for Android, install Android SDK 28 or later.
   Run <code>$ sdkmanager</code> to manage your Android SDK versions.</p>
  
  <p>× You need to have the Android SDK Build-tools installed on your system. You can install any version in the following range: '>=23 &lt;=28'.
   Run <code>$ sdkmanager</code> from your command-line to install required <code>Android Build Tools</code>. In case you already have them installed, make sure <code>ANDROID_HOME</code> environment variable is set correctly.</p>
  
  <p>× Error executing command 'javac'. Make sure you have installed The Java Development Kit (JDK) and set JAVA_HOME environment variable.
   You will not be able to build your projects for Android.
  To be able to build for Android, verify that you have installed The Java Development Kit (JDK) and configured it according to system requirements as
   described in <a href="http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-win.html#system-requirements" rel="nofollow noreferrer">http://docs.nativescript.org/setup/ns-cli-setup/ns-setup-win.html#system-requirements</a></p>
  
  <p>× WARNING: The Java Development Kit (JDK) is not installed or is not configured properly.
   You will not be able to work with the Android SDK and you might not be able
  to perform some Android-related operations. To ensure that you can develop and
  test your apps for Android, verify that you have installed the JDK as
  described in <a href="http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html" rel="nofollow noreferrer">http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html</a> (for JDK 8).</p>