gpt4 book ai didi

android - 为什么在用Cordova构建APK时出现此错误?

转载 作者:行者123 更新时间:2023-12-03 05:25:43 24 4
gpt4 key购买 nike

我试图制作一个Web应用程序的APK,然后将其包装到Cordova中。
我遵循了各种教程,安装了Gradle并使之运行。
当我从CMD运行cordova build android ---verbose 时,出现此错误:

ANDROID_SDK_ROOT=undefined (recommended setting)
ANDROID_HOME=C:\Users\USER\AppData\Local\Android\sdk (DEPRECATED)
Subproject Path: CordovaLib
Subproject Path: app
Running command: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug -b C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Command finished with error code 1: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew cdvBuildDebug,-b,C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\build.gradle
C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
Error: C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradlew: Command failed with exit code 1 Error output:
Exception in thread "main" java.lang.RuntimeException: Could not load wrapper properties from 'C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\platforms\android\gradle\wrapper\gradle-wrapper.properties'.
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:61)
at org.gradle.wrapper.WrapperExecutor.forWrapperPropertiesFile(WrapperExecutor.java:45)
at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:62)
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 16: C:UsersUSERDownloadsgradle-6.3-bin.zip
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.checkChars(URI.java:3021)
at java.net.URI$Parser.parse(URI.java:3058)
at java.net.URI.<init>(URI.java:588)
at org.gradle.wrapper.WrapperExecutor.readDistroUrl(WrapperExecutor.java:80)
at org.gradle.wrapper.WrapperExecutor.prepareDistributionUri(WrapperExecutor.java:67)
at org.gradle.wrapper.WrapperExecutor.<init>(WrapperExecutor.java:54)
... 2 more
at ChildProcess.whenDone (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\src\superspawn.js:135:23)
at ChildProcess.emit (events.js:310:20)
at ChildProcess.cp.emit (C:\Users\USER\Desktop\Tlf Cordova\AngularToMobileProject-master\node_modules\cordova-common\node_modules\cross-spawn\lib\enoent.js:34:29)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
使用 Gradle 6.3
我尝试了很多教程和StackOverflow解决方案,但是没有一个适合我。
我的 gradle-wrapper.properties

Tue Oct 16 17:39:45 IST 2018

distributionBase=GRADLE_USER_HOME

distributionPath=wrapper/dists

zipStoreBase=GRADLE_USER_HOME

zipStorePath=wrapper/dists

distributionUrl=C:\Users\USER\Downloads\gradle-6.3-bin.zip

最佳答案

我正在将gradle 5.1.1用于cordova9.0。
没有问题。

关于android - 为什么在用Cordova构建APK时出现此错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61347350/

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