构建apk时,离子框架'compileDebugJavaWithJavac'错误

时间:2016-10-28 21:09:32

标签: android ionic-framework build ionic2

我正在使用Ionic框架并尝试构建APK,使用 ionic build android 命令并获取 Execution failed for task':compileDebugJavaWithJavac'

这是完整的日志:

D:\Ionic\IonicUserBase>ionic build android
WARN: ionic.project has been renamed to ionic.config.json, please rename it.
ANDROID_HOME=C:\Android\Sdk

JAVA_HOME=C:\Program Files\Java\jdk1.8.0_91

Subproject Path: CordovaLib

Incremental java compilation is an incubating feature.


:preBuild

UP-TO-DATE

:preDebugBuild
 UP-TO-DATE
:checkDebugManifest

:CordovaLib:preBuild UP-TO-DATE

:CordovaLib:preDebugBuild
 UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl
 UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugShaders
 UP-TO-DATE
:CordovaLib:compileDebugShaders UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:compileDebugRenderscript
 UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE

:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest
 UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:incrementalDebugJavaCompilationSafeguard
 UP-TO-DATE
:CordovaLib:compileDebugJavaWithJavac UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForDebug
 UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug UP-TO-DATE

:CordovaLib:mergeDebugJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForDebug UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForDebug UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl
 UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig
 UP-TO-DATE
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest
 UP-TO-DATE
:processDebugResources UP-TO-DATE
:generateDebugSources UP-TO-DATE
:incrementalDebugJavaCompilationSafeguard UP-TO-DATE
:compileDebugJavaWithJavac


:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).

D:\Ionic\IonicUserBase\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:692: error: cannot find symbol

        if (!isLocalTransfer && !Config.isUrlWhiteListed(source)) {
                                       ^
  symbol:   method isUrlWhiteListed(String)
  location: class Config
D:\Ionic\IonicUserBase\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:122: error: cannot find symbol
                                || Config.isUrlWhiteListed(url)) {
                                         ^
  symbol:   method isUrlWhiteListed(String)
  location: class Config

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

:compileDebugJavaWithJavac FAILED

BUILD FAILED

Total time: 5.734 secs

Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> 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.

Error: cmd: Command failed with exit code 1 Error output:
D:\Ionic\IonicUserBase\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:692: error: cannot find symbol
        if (!isLocalTransfer && !Config.isUrlWhiteListed(source)) {
                                       ^
  symbol:   method isUrlWhiteListed(String)
  location: class Config
D:\Ionic\IonicUserBase\platforms\android\src\org\apache\cordova\inappbrowser\InAppBrowser.java:122: 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.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
2 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> 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.

这是我第一个使用Ionic框架的项目,实际上我没有得到解决此问题的确切方法......

1 个答案:

答案 0 :(得分:0)

看起来这个错误是由cordova-file-transfer插件生成的。您可能有一个旧版本,因为您收到了弃用的API通知。

尝试删除插件并重新添加:

ionic plugin remove cordova-plugin-file-transfer

然后:

ionic plugin add cordova-plugin-file-transfer

然后尝试重建应用程序。