gpt4 book ai didi

android - 命令 "ionic cordova emulate android"不起作用

转载 作者:行者123 更新时间:2023-11-29 02:27:11 25 4
gpt4 key购买 nike

我在将项目运行到 android 模拟器时遇到问题:当我运行此命令“ionic cordova emulate android”时,它会出错。我正在使用动态 ssh 和 socks 隧道运行腻子。我的终端的完整日志如下所示。

PS D:\Hamid\wooionic2> ionic cordova run android
...
[12:06:30] sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined`
to prevent this warning.

...

cordova run android Android Studio project detected

ANDROID_HOME=C:\Users\Hamid\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_172
studio
Subproject Path: CordovaLib
Subproject Path: app
...

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://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> dl.google.com:443 failed to respond
> 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'.
> jcenter.bintray.com:443 failed to respond
>
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'.
> maven.google.com:443 failed to respond

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

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


BUILD FAILED in 1s
at ChildProcess.whenDone (D:\Hamid\wooionic2\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:7272) 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:7272) [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.

[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?

它说:

Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> dl.google.com:443 failed to respond

错误在哪里?

最佳答案

我禁用了 putty(充当代理)并再次运行我的命令:“cordova emulate android”

但是这次感觉又出现了新的错误:

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'. Connect to 127.0.0.1:8085 [/127.0.0.1] failed: Connection refused: connect

127.0.0.1:8085 是我为 puty ssh 隧道设置的地址和端口。但是我找不到从我的项目中删除此代理的设置在哪里。最后,幸运的是,我在这个文件 (gradle.properties) 中找到了它:

C:\Users\USERNAME.gradle\gradle.properties

在这个文件中我删除了这些行:

systemProp.https.proxyPort=8085
systemProp.http.proxyHost=127.0.0.1
systemProp.https.proxyHost=127.0.0.1
systemProp.http.proxyPort=8085

然后问题就消失了。但我还不知道 gradle 如何获取和设置此代理设置!有人知道吗?

关于android - 命令 "ionic cordova emulate android"不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51537704/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com