Connection to the server was unsuccessful: livereload android

I get the following error when trying to use

ionic cordova run android -lcs 

with both the computer and device on the same wifi. The device is plugged in.
After running the command I get the connection error.

1 Like

use from
Log.d("MYKEY","blah blah blah ");

and after in terminal log with
adb logcat -s MYKEY

Can you open the URL that it cannot open in the normal OS browser?
Is this actually the IP of your development PC?

How do I use Log.d which is a native piece of code in ionic?

I cannot open the url in a normal browser on the phone because it says the site cannot be reached. That ip of my dev pc is the same except for the last number of the ip.

It should be the same as the livereloading wants to load the files from your computer. Can you post the complete output you get when running that command? Add --verbose for additional output.


Drews-MacBook-Pro:buggie-ionic-frontend drewgallagher$ ionic cordova run android -lsc --verbose
[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: '/Users/drewgallagher/Documents/software/buggie-ionic-frontend', local: true, binPath: 
        '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: 
        '/Users/drewgallagher/Documents/software/buggie-ionic-frontend/node_modules/ionic/dist/index.js' }
[DEBUG] Daemon found (pid: 1095)
[WARN] Detected @ionic/cli-plugin-cordova in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:
       
       npm uninstall --save-dev --save-exact @ionic/cli-plugin-cordova
       
[WARN] Detected @ionic/cli-plugin-ionic-angular in your package.json.

       As of CLI 3.8, it is no longer needed. You can uninstall it:
       
       npm uninstall --save-dev --save-exact @ionic/cli-plugin-ionic-angular
       
[INFO] Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 --consolelogs --serverlogs 
       --nobrowser --iscordovaserve --platform android --target cordova - Ctrl+C to cancel
[16:02:13]  watch started ... 
[16:02:13]  build dev started ... 
[16:02:13]  clean started ... 
[16:02:13]  clean finished in 2 ms 
[16:02:13]  copy started ... 
[16:02:13]  transpile started ... 
[16:02:16]  transpile finished in 2.87 s 
[16:02:16]  preprocess started ... 
[16:02:16]  deeplinks started ... 
[16:02:16]  deeplinks finished in 50 ms 
[16:02:16]  preprocess finished in 50 ms 
[16:02:16]  webpack started ... 
[16:02:16]  copy finished in 3.12 s 
[16:02:26]  webpack finished in 10.39 s 
[16:02:26]  sass started ... 
[16:02:27]  sass finished in 882 ms 
[16:02:27]  postprocess started ... 
[16:02:27]  removed unused font files 
[16:02:27]  postprocess finished in 7 ms 
[16:02:27]  lint started ... 
[16:02:27]  build dev finished in 14.23 s 
[16:02:27]  watch ready in 14.29 s 
[16:02:27]  dev server running: http://localhost:8100/ 

[INFO] Development server running
       Local: http://localhost:8100
       External: http://172.16.12.240:8100
       
> cordova run android

You have been opted out of telemetry. To change this, run: cordova telemetry on.
ANDROID_HOME=/Users/drewgallagher/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.

	at build_7oenszr34n519r61we28lfcee.run(/Users/drewgallagher/Documents/software/buggie-ionic-frontend/platforms/android/build.gradle:139)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.

Incremental java compilation is an incubating feature.

The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.

:preBuild
 UP-TO-DATE
:preDebugBuild
 
UP-TO-DATE
:checkDebugManifest

:preReleaseBuild
 UP-TO-DATE
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
 
UP-TO-DATE
:CordovaLib:compileDebugNdk
 UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
 
UP-TO-DATE
:CordovaLib:compileDebugShaders
 
UP-TO-DATE
:CordovaLib:generateDebugAssets
 
UP-TO-DATE
:CordovaLib:mergeDebugAssets
 
UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
 
UP-TO-DATE
:CordovaLib:packageDebugRenderscript
 
UP-TO-DATE
:CordovaLib:compileDebugRenderscript
 
UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources
 UP-TO-DATE
:CordovaLib:packageDebugResources
 
UP-TO-DATE
:CordovaLib:processDebugManifest
 
UP-TO-DATE
:CordovaLib:generateDebugBuildConfig
 
UP-TO-DATE
:CordovaLib:processDebugResources
 
UP-TO-DATE
:CordovaLib:generateDebugSources
 
UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard
 
UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac
 
UP-TO-DATE
:CordovaLib:processDebugJavaRes
 
UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
 
UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug
 
UP-TO-DATE
:CordovaLib:mergeDebugJniLibFolders
 
UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug
 
UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug
 
UP-TO-DATE
:CordovaLib:bundleDebug
 
UP-TO-DATE
:CordovaLib:preReleaseBuild
 UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies

:CordovaLib:compileReleaseAidl
 
UP-TO-DATE
:CordovaLib:compileReleaseNdk
 
UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders
 
UP-TO-DATE
:CordovaLib:compileReleaseShaders
 
UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets
 
UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles
 
UP-TO-DATE
:CordovaLib:packageReleaseRenderscript
 
UP-TO-DATE
:CordovaLib:compileReleaseRenderscript
 UP-TO-DATE

:CordovaLib:generateReleaseResValues
 
UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources
 
UP-TO-DATE
:CordovaLib:processReleaseManifest
 
UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig
 
UP-TO-DATE
:CordovaLib:processReleaseResources
 
UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard
 UP-TO-DATE

:CordovaLib:compileReleaseJavaWithJavac
 UP-TO-DATE

:CordovaLib:processReleaseJavaRes
 UP-TO-DATE

:CordovaLib:transformResourcesWithMergeJavaResForRelease
 UP-TO-DATE

:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
 UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders
 UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
 UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
 UP-TO-DATE
:CordovaLib:bundleRelease
 
UP-TO-DATE
:prepareComAndroidSupportSupportV42411Library
 UP-TO-DATE
:prepareComPaypalSdkPaypalAndroidSdk2153Library
 UP-TO-DATE
:prepareIoCardAndroidSdk540Library
 UP-TO-DATE
:prepareOrgApacheCordovaCordovaLib623DebugLibrary
 UP-TO-DATE

:prepareDebugDependencies

:compileDebugAidl
 UP-TO-DATE
:compileDebugRenderscript
 UP-TO-DATE
:generateDebugBuildConfig
 UP-TO-DATE
:generateDebugResValues
 UP-TO-DATE
:generateDebugResources
 
UP-TO-DATE
:mergeDebugResources

:processDebugManifest
 UP-TO-DATE
:processDebugResources

:generateDebugSources
:incrementalDebugJavaCompilationSafeguard
 UP-TO-DATE

:compileDebugJavaWithJavac
 
UP-TO-DATE
:compileDebugNdk
 UP-TO-DATE
:compileDebugSources UP-TO-DATE
:mergeDebugShaders
 UP-TO-DATE

:compileDebugShaders
 UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
 UP-TO-DATE
:transformClassesWithDexForDebug
 UP-TO-DATE
:mergeDebugJniLibFolders
 UP-TO-DATE
:transformNative_libsWithMergeJniLibsForDebug
 UP-TO-DATE
:processDebugJavaRes
 UP-TO-DATE
:transformResourcesWithMergeJavaResForDebug
 
UP-TO-DATE
:validateSigningDebug
:packageDebug

:assembleDebug
:cdvBuildDebug


BUILD SUCCESSFUL

Total time: 2.657 secs

Built the following apk(s): 
	/Users/drewgallagher/Documents/software/buggie-ionic-frontend/platforms/android/build/outputs/apk/android-debug.apk

[16:02:31]  tslint: src/pages/product-carousel/product-carousel.ts, line: 26 
            'lastAction' is declared but never used. 

      L25:  private productTitleCategory;
      L26:  private lastAction = "";
      L27:  private itemSeenCreateUrl = "http://phplaravel-43928-316084.cloudwaysapps.com/api/post/item-seen/create";

[16:02:31]  tslint: src/pages/create-listing/create-listing.ts, line: 36 
            Property 'camera' is declared but never used. 

      L36:      constructor(public navCtrl: NavController, public navParams: NavParams, private camera: Camera,
      L37:                  private http: Http,public _DomSanitizationService: DomSanitizer,public loadingCtrl: LoadingController) {

[16:02:31]  tslint: src/pages/create-listing/create-listing.ts, line: 3 
            'CameraOptions' is declared but never used. 

       L2:  import {NavController, NavParams} from 'ionic-angular';
       L3:  import {Camera, CameraOptions} from '@ionic-native/camera';
       L4:  import {Headers, Http} from "@angular/http";

[16:02:31]  tslint: src/pages/home/home.ts, line: 35 
            Property 'navParams' is declared but never used. 

      L35:      constructor(public navCtrl: NavController, private http: Http, private navParams: NavParams,
      L36:                  public actionSheetCtrl: ActionSheetController, private camera: Camera,

[16:02:31]  tslint: src/pages/home/home.ts, line: 10 
            'CaptureImageOptions' is declared but never used. 

       L9:  import {
      L10:      MediaCapture, MediaFile, CaptureError, CaptureImageOptions,
      L11:      CaptureVideoOptions

[16:02:31]  tslint: src/pages/home/home.ts, line: 13 
            All imports are unused. 

      L12:  } from '@ionic-native/media-capture';
      L13:  import {DomSanitizer} from '@angular/platform-browser';
      L14:  import {File} from '@ionic-native/file';

[16:02:31]  tslint: src/pages/tabs/tabs.ts, line: 19 
            Property 'navParams' is declared but never used. 

      L19:    constructor(private navParams:NavParams) {
      L20:      this.user = navParams.data;

[16:02:31]  tslint: src/pages/login/login.ts, line: 20 
            'submitted' is declared but never used. 

      L19:  private password = "";
      L20:  private submitted = false;
      L21:  private loginUrl = "http://phplaravel-43928-316084.cloudwaysapps.com/api/post/login";

[16:02:31]  tslint: src/app/app.component.ts, line: 6 
            All imports are unused. 

       L5:  import { LoginPage } from '../pages/login/login';
       L6:  import {CreateListingPage} from "../pages/create-listing/create-listing";
       L7:  import {TabsPage} from "../pages/tabs/tabs";

[16:02:31]  tslint: src/app/app.component.ts, line: 7 
            All imports are unused. 

       L6:  import {CreateListingPage} from "../pages/create-listing/create-listing";
       L7:  import {TabsPage} from "../pages/tabs/tabs";

[16:02:31]  tslint: src/app/app.module.ts, line: 20 
            'MediaFile' is declared but never used. 

      L19:  import {CreateListingPage} from "../pages/create-listing/create-listing";
      L20:  import {MediaCapture, MediaFile, CaptureError, CaptureImageOptions} from '@ionic-native/media-capture';
      L21:  import {File} from '@ionic-native/file';

[16:02:31]  tslint: src/app/app.module.ts, line: 20 
            'CaptureError' is declared but never used. 

      L19:  import {CreateListingPage} from "../pages/create-listing/create-listing";
      L20:  import {MediaCapture, MediaFile, CaptureError, CaptureImageOptions} from '@ionic-native/media-capture';
      L21:  import {File} from '@ionic-native/file';

[16:02:31]  tslint: src/app/app.module.ts, line: 20 
            'CaptureImageOptions' is declared but never used. 

      L19:  import {CreateListingPage} from "../pages/create-listing/create-listing";
      L20:  import {MediaCapture, MediaFile, CaptureError, CaptureImageOptions} from '@ionic-native/media-capture';
      L21:  import {File} from '@ionic-native/file';

[16:02:31]  lint finished in 4.59 s 
ANDROID_HOME=/Users/drewgallagher/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home
No target specified, deploying to device 'efca1e22'.
Skipping build...

Built the following apk(s): 
	/Users/drewgallagher/Documents/software/buggie-ionic-frontend/platforms/android/build/outputs/apk/android-debug.apk

Using apk: /Users/drewgallagher/Documents/software/buggie-ionic-frontend/platforms/android/build/outputs/apk/android-debug.apk

Package name: io.ionic.starter
LAUNCH SUCCESS




Does it matter that I am on a secured network at an apartment complex, as opposed to a home wifi network?

Yes, your devices have to be able to “see” each other. Otherwise this won’t work.

just import below code
import android.util.Log;
and use this
Log.d("key","value")
in your native code

If both of my devices are on the same wifi network and they cannot “see” each other, than how do I change that?

You have to fix your network configuration. In Windows 10 for example, you have a specific “Make this PC discoverable” setting for the Wifi. Additionally you have to disable any firewalls that might block incoming connections, and also set your access point to allow connections between computer in your local network.

@drewg2009

What is the version of your android device?
This usually happens when you run the app on versions which are not compatible.