Can't build any app


#1

Hi for two days I’m trying to build my first app. So far no success. could any one help me?
I installed everything according to ionic tutorials
my steps:
ionic start MYAPPNAME tabs
Then I made my code with visual studio

then I did:
ionic cordova platform add android

finally I’ve done:
ionic cordova build android --release

it showed me some error:

[00:15:29]  lint finished in 3.92 s
ANDROID_HOME=C:\Users\arash\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_191\
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon (subsequent builds will be faster)


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   >
Could not resolve com.android.tools.build:gradle:3.0.0.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.0.0.
         >
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'. Received status code 407 from server: Proxy Authentication Required
      > Could not resolve com.android.tools.build:gradle:3.0.0.
         > Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
            > Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'. Received status code 407 from server: Proxy Authentication Required

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org


BUILD FAILED in 47s
(node:11236) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.
   > Could not resolve com.android.tools.build:gradle:3.0.0.
     Required by:
         project :
      > Could not resolve com.android.tools.build:gradle:3.0.0.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
            > Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'. Received status code 407 from server: Proxy Authentication Required
      > Could not resolve com.android.tools.build:gradle:3.0.0.
         > Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
            > Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'. Received status code 407 from server: Proxy Authentication Required

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

* Get more help at https://help.gradle.org

BUILD FAILED in 47s
    at ChildProcess.whenDone (E:\project\ionic\production\yellowparts\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
(node:11236) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:11236) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I search every line yet, I couldn’t find any solution to solve my problem with gradle and jcenter

then I installed Android Studio 3, It identify something is wrong with gradle, however, none of it’s recommedation worked for me.

so could anyone help me to build this first app.

PS: I also did tried following commands to build app. No luck there too!
ionic cordova build android --debug
ionic cordova build android --prod
ionic cordova build android

ionic cordova build android --stacktrace


FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all files for configuration ':classpath'.

   > Could not resolve com.android.tools.build:gradle:3.0.0.

     Required by:

         project :
      >
Could not resolve com.android.tools.build:gradle:3.0.0.
         > Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.

            >
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'. Received status code 407 from server: Proxy Authentication Required
      >
Could not resolve com.android.tools.build:gradle:3.0.0.
         >
Could not get resource 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.


> Could not GET 'https://maven.google.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'. Received status code 407 from server: Proxy Authentication Required

funny thing is that I can access all of these “Could not get resource” when I put their url on browser!


#2

Something seems to be unusual about your network environment.


#3

first I set it to no proxy, this error showed up,
then I set port to 8080 and url to localhost, however I don’t know what password or username should I enter.

(all of them at Android Studio, gradle setting)


#4

so I add some information about my system:

Ionic info

Ionic:

   ionic (Ionic CLI)  : 4.5.0 (C:\usr\local\node_modules\ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.2.1

Cordova:

   cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms     : android 7.1.4
   Cordova Plugins       : not available

System:

   Android SDK Tools : 26.1.1 (C:\Users\arash\AppData\Local\Android\Sdk)
   NodeJS            : v11.3.0 (C:\Program Files\nodejs\node.exe)
   npm               : 6.4.1
   OS                : Windows 10