gpt4 book ai didi

java - 为 Android 构建电话间隙应用程序失败

转载 作者:IT老高 更新时间:2023-10-28 23:30:53 25 4
gpt4 key购买 nike

当尝试使用 android 构建我的手机差距应用程序时

sudo phonegap build android

失败并出现以下错误:

:compileDebugJava
/Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java:120: error: cannot find symbol

|| Config.isUrlWhiteListed(url)) {
^

symbol: method isUrlWhiteListed(String)

location: class Config

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

1 error


FAILED



FAILURE:
Build failed with an exception.



* What went wrong:

Execution failed for task ':compileDebugJava'.

>
Compilation failed; see the compiler error output for details.



* Try:

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



BUILD FAILED


Total time: 5.607 secs


/Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^

Error code 1 for command: /Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/build.gradle,-Dorg.gradle.daemon=true

ERROR building one of the platforms: Error: /Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project

Error: /Users/youssefsami/Library/Mobile Documents/com~apple~CloudDocs/Developer/Mobile Apps/UzuConvert/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)

我尝试将 java_home 设置为 lib exec 中的 java 别名,但仍然没有。关于可能导致问题的任何想法?

最佳答案

这是因为您的 InAppBrowser 插件已过时,并且可能与首次安装插件时相比更新版本的 Cordova Android 平台不同步。我在使用 Cordova-android@4.0.0 和 InAppBrowser 的 0.5.3 时遇到了同样的问题。

修复是先删除插件

cordova plugin rm org.apache.cordova.inappbrowser

然后再次添加它(它应该使用cordova CLI 的最新版本重新安装,在我的例子中它是0.6)。您可以在 plugins/org.apache.cordova.inappbrowser/文件夹中的 RELEASENOTES.md 中查看版本。

cordova plugin add org.apache.cordova.inappbrowser

您需要在重新构建之前删除 android 平台并重新添加它,这样它就不会保留旧版本的插件。

cordova platform rm android

cordova platform add android

现在重新构建,错误应该已经消失了。

编辑:我刚刚在您的问题顶部注意到您正在使用 phonegap。既然你用 cordova 标记(这就是我使用的)我用 cordova 命令回答,但我猜几乎相同的过程适用于 Phonegap。

关于java - 为 Android 构建电话间隙应用程序失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29985661/

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