Ionic cordova run android FAILURE

No you need to change proxy.example.com to the proxy address from your company. And you may also have to change export to set. I think export works in linux environment and set works with windows.

Its like the PATH variable, we changed before. But this time its not PATH but HTTP_PROXY and the other two variables.

Ok, now it’s clear :wink:
Tomorrow in the morning, as soon as I’ll back at work, I’ll try with this settings and the I’ll let you know something about.
Thank you very much, you were really kind and extremely helpful!

I wish you good luck. I hope it will work and I am looking forward to hearing from you.

Here we are!

I’ve just started the process following the guide and immediately I encountered a problem:

npm install -g @ionic/cli-plugin-proxy

Return these errors:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@ionic/cli-plugin-proxy"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0

npm ERR! Cannot read property 'path' of null
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "@ionic/cli-plugin-proxy"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code ECONNRESET

npm ERR! network socket hang up
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs\2018-01-23T08_3
7_29_721Z-debug.log

Start with

$ npm config set proxy http://proxy.company.com:8888
$ npm config set https-proxy https://proxy.company.com:8888

Maybe your reinstallation of nodejs has reset the proxies for npm

1 Like

I’ve also set the npm proxys, but the result is the same.
As proxys, talking with my team, I was advised to set the local address on which the app will run (http://localhost:8100).
It’s the right choice?

For building the app ionic needs du download dependencies from outside your business network. Thats why you have to route the requests through the business proxy. Its for gradle, git and tools like that.

Localhost ist wrong

1 Like

Thank you very much man!
After several attempts and above all thanks to your help I managed to start the app!
THANK YOU :slight_smile:

Now I started to write a bit of code and do some test, but I get errors that I can’t understand and solve :frowning:
Can you give me another help?
This is what comes out, both in the console and on my Browser (if I use ionic serve):

Runtime Error
Uncaught (in promise): [object Object]
Stack
Error: Uncaught (in promise): [object Object]
    at c (http://localhost:8100/build/polyfills.js:3:19752)
    at c (http://localhost:8100/build/polyfills.js:3:19461)
    at http://localhost:8100/build/polyfills.js:3:20233
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
    at Object.onInvokeTask (http://localhost:8100/build/vendor.js:5815:33)
    at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15581)
    at r.runTask (http://localhost:8100/build/polyfills.js:3:10834)
    at o (http://localhost:8100/build/polyfills.js:3:7894)
    at <anonymous>

Sounds like an error was thrown inside a promise. If you open the dev tools of your browser, you may see more information about the code line of your file where that error occurs. I recommend chrome + chrome dev tools for debugging in browser.

Nice to hear, that you got your proxy settings working.

1 Like

This is the Console Output from Chrome Developer Tools:

localhost/:15 The key "viewport-fit" is not recognized and ignored.

core.js:3565 Angular is running in the development mode. Call enableProdMode() to enable the production mode.

util.js:60 Native: tried calling StatusBar.styleDefault, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
cordovaWarn @ util.js:60

util.js:60 Native: tried calling SplashScreen.hide, but Cordova is not available. Make sure to include cordova.js or run in a device/simulator
cordovaWarn @ util.js:60

plugin.js:23 Native: tried accessing the GoogleMap plugin but it's not installed.
pluginWarn @ plugin.js:23

plugin.js:25 Install the GoogleMap plugin: 'ionic plugin add plugin.google.maps.Map'
pluginWarn @ plugin.js:25

core.js:1350 ERROR Error: Uncaught (in promise): [object Object]
    at c (polyfills.js:3)
    at c (polyfills.js:3)
    at polyfills.js:3
    at t.invokeTask (polyfills.js:3)
    at Object.onInvokeTask (core.js:4620)
    at t.invokeTask (polyfills.js:3)
    at r.runTask (polyfills.js:3)
    at o (polyfills.js:3)
    at <anonymous>

But I’ve installed cordova plugin, as you know, and I also add the Google Map plugin with API Key provided by Google, so I can’t understand what these warnings depend on :frowning:

Check in your app.component.ts if you wait for the platform to get ready before accessing native features.
You are running that app on a smartphone or emulator and not with ionic serve, right? Ionic serve runs the app in a browser environment where no cordova exists.

constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      if (platform.is('cordova')) {
        statusBar.styleDefault();
        splashScreen.hide();
      }
    });
  }
1 Like

If I run the app into an emulator with ionic cordova run android or ionic cordova emulate android I’ve only a white screen in the emulator (but it’s correctly started) and this output in console:

BUILD SUCCESSFUL in 1m 35s
47 actionable tasks: 3 executed, 44 up-to-date
Built the following apk(s):
        C:\ionic\helloworld_fortest\platforms\android\app\build\outputs\apk\debug\app-debug.apk

ANDROID_HOME=C:\Users\f.menghini\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151
No target specified and no devices found, deploying to emulator

No emulator specified, defaulting to Nexus_5X_API_27

Waiting for emulator to start...

emulator: WARNING: Crash service did not start

emulator: Requested console port 5584: Inferring adb port 5585.
emulator: WARNING: Not all modern X86 virtualization features supported, which introduces problems with slowdown when running Android on multicore vCPUs. 
Setting AVD to run with 1 vCPU core only.
Hax is enabled
Hax ram_size 0x60000000
HAX is working and emulator runs in fast virt mode.
Your emulator is out of date, please update by launching Android Studio:
 - Start Android Studio
 - Select menu "Tools > Android > SDK Manager"

 - Click "SDK Tools" tab
 - Check "Android Emulator" checkbox
 - Click "OK"

compileAndVali
dateCoreShader: fail to compile. infolog Fragment shader failed to compile withthe following errors:
ERROR: 0:85: error(#143) Undeclared identifier undefined
ERROR: 0:85: error(#132) Syntax error: '<' parse error
ERROR: error(#273) 2 compilation errors.  No code generated

linkAndValidateProgram: fail to link program. infolog: Fragment shader(s) were not successfully compiled before glLinkProgram() was called.  
Link failed.

compileAndValidateCoreShader: fail to compile. infolog Fragment shader
failed to compile with the following errors:
ERROR: 0:85: error(#143) Undeclared identifier undefined
ERROR: 0:85: error(#132) Syntax error: '<' parse error
ERROR: error(#273) 2 compilation errors.  No code generated

linkAndValidateProgram: fail to link program. infolog: Fragment shader(s) were not successfully compiled before glLinkProgram() was called.  
Link failed.

glClear:466 GL err 0x
502
Error: Failed to execute shell command "getprop,dev.bootcomplete"" on device:
Error: C:\Users\f.menghini\AppData\Local\Android\Sdk\platform-tools\adb.exe: Command failed with exit code 1 Error output:error: device unauthorized.
This adb server's $ADB_VENDOR_KEYS is not set
Try 'adb kill-server' if that seems wrong.
Otherwise check for a confirmation dialog on your device.

It says your emulator is out of date. Is your Android Studio and the tools out of date, too? Maybe that causes the problems.

Open Android Studio and open a Test Project. Wait until gradle completes its processes and let your android studio automatically check for updates. After that click on the SDK Manager and update all needed packages. Here you can see the packages i have installed.

I have Android Studio 3.0.1
and the following ionic info output:

cli packages: (/Users/schmid/.nvm/versions/node/v8.9.1/lib/node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 8.0.0

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : android 7.0.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    ios-deploy        : 1.9.2
    ios-sim           : 6.1.2
    Node              : v8.9.1
    npm               : 5.6.0
    OS                : macOS High Sierra
    Xcode             : Xcode 9.2 Build version 9C40b

Environment Variables:

    ANDROID_HOME : /Users/schmid/Library/Android/sdk

Misc:

    backend : legacy
´´´
2 Likes

In Android Studio I’ve the same packages at the same Version.
And my ionic info output is:

cli packages: (C:\Users\f.menghini\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.1
    ionic (Ionic CLI) : 3.19.1

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 7.0.0 ios 4.5.4
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v9.4.0
    npm               : 5.6.0
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : C:\Users\f.menghini\AppData\Local\Android\Sdk

Misc:

    backend : pro

Maybe its a problem with the emulator. You could try the testversion of genymotion or try to use an emulator with other graphic settings or try some stuff mentioned on this site (the error seems similar):

Hi, have you solve this?

Unfortunately I did not solve the problem :frowning:
I used a workaround, launching the app in a genymotion emulator, so it works without problems!

Hi, I think the following procedures might help.

  1. Open config.xml and change widget id “io.ionic.starter” like “io.ionic.myfirstapp”

  2. type ionic cordova run android

if this doesn’t work, try the following;

  1. Check your device for old ionic app for same id (io.ionic.starter) if you find it, delete this app

  2. type ionic cordova run android

if this doesn’t work, try the following;

  1. Open command prompt or Power shell
  2. Go to Android\android-sdk\platform-tools folder
  3. type without quotes “adb uninstall io.ionic.starter”
  4. type ionic cordova run android