3 Replies Latest reply on Mar 15, 2017 7:38 PM by ryanskihead

    Error Build Android - java error: incompatible types: File[] cannot be converted to File   File files = directory.listFiles();

    carloss63981566

      Build Date: 2017-03-15 17:16:16 +0000

      --------------------------------------------------------------------------------

      PLUGIN OUTPUT

      --------------------------------------------------------------------------------

      Fetching plugin "com.peerio.cordova.plugin.sqlcipher@1.2.2" via npm

      Installing "com.peerio.cordova.plugin.sqlcipher" at "1.2.2" for android

      Fetching plugin "cordova-plugin-whitelist@1.3.2" via npm

      Installing "cordova-plugin-whitelist" at "1.3.2" for android

       

        This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in.

      Fetching plugin "cordova-plugin-splashscreen@4.0.2" via npm

      Installing "cordova-plugin-splashscreen" at "4.0.2" for android

      Installing "com.phonegap.plugins.hydration" at "6.2.0" for android

      Installing "cordova-plugin-network-information" at "1.0.1" for android

      Dependent plugin "cordova-plugin-whitelist" already installed on android.

      Fetching plugin "phonegap-plugin-contentsync" via npm

      Installing "phonegap-plugin-contentsync" at "1.3.4" for android

      --------------------------------------------------------------------------------

      COMPILE OUTPUT

      --------------------------------------------------------------------------------

      Subproject Path: CordovaLib

      Configuration on demand is an incubating feature.

      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

      :CordovaLib:compileDebugNdk UP-TO-DATE

      :CordovaLib:compileLint

      :CordovaLib:copyDebugLint UP-TO-DATE

      :CordovaLib:mergeDebugShaders

      :CordovaLib:compileDebugShaders

      :CordovaLib:generateDebugAssets

      :CordovaLib:mergeDebugAssets

      :CordovaLib:mergeDebugProguardFiles

      :CordovaLib:packageDebugRenderscript UP-TO-DATE

      :CordovaLib:compileDebugRenderscript

      :CordovaLib:generateDebugResValues

      :CordovaLib:generateDebugResources

      :CordovaLib:packageDebugResources

      :CordovaLib:processDebugManifest

      :CordovaLib:generateDebugBuildConfig

      :CordovaLib:processDebugResources

      :CordovaLib:generateDebugSources

      :CordovaLib:incrementalDebugJavaCompilationSafeguard

      :CordovaLib:compileDebugJavaWithJavac

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

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

      Note: Recompile with -Xlint:deprecation for details.

      :CordovaLib:processDebugJavaRes UP-TO-DATE

      :CordovaLib:transformResourcesWithMergeJavaResForDebug

      :CordovaLib:transformClassesAndResourcesWithSyncLibJarsForDebug

      :CordovaLib:mergeDebugJniLibFolders

      :CordovaLib:transformNative_libsWithMergeJniLibsForDebug

      :CordovaLib:transformNative_libsWithSyncJniLibsForDebug

      :CordovaLib:bundleDebug

      :prepareProjectCordovaLibUnspecifiedDebugLibrary

      :prepareDebugDependencies

      :compileDebugAidl

      :compileDebugRenderscript

      :generateDebugBuildConfig

      :generateDebugResValues

      :generateDebugResources

      :mergeDebugResources

      :processDebugManifest

      :processDebugResourcesWarning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.

       

       

      :generateDebugSources

      :incrementalDebugJavaCompilationSafeguard

      :compileDebugJavaWithJavac

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

      /project/src/com/adobe/phonegap/contentsync/Sync.java:1123: error: incompatible types: File[] cannot be converted to File

        File files = directory.listFiles();

        ^

      /project/src/com/adobe/phonegap/contentsync/Sync.java:1125: error: for-each not applicable to expression type

        for (File file : files) {

        ^

        required: array or java.lang.Iterable

        found: File

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

      Note: Recompile with -Xlint:deprecation for details.

      Note: /project/src/com/adobe/phonegap/contentsync/Sync.java uses unchecked or unsafe operations.

      Note: Recompile with -Xlint:unchecked for details.

      2 errors

       

      FAILURE: Build failed with an exception.

       

      :compileDebugJavaWithJavac FAILED

      * 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.

       

      BUILD FAILED

       

      Total time: 2.166 secs

      Error: /project/gradlew: Command failed with exit code 1 Error output:

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

      Note: Recompile with -Xlint:deprecation for details.

      Warning: AndroidManifest.xml already defines debuggable (in http://schemas.android.com/apk/res/android); using existing value in manifest.

       

      /project/src/com/adobe/phonegap/contentsync/Sync.java:1123: error: incompatible types: File[] cannot be converted to File

        File files = directory.listFiles();

        ^

      /project/src/com/adobe/phonegap/contentsync/Sync.java:1125: error: for-each not applicable to expression type

        for (File file : files) {

        ^

        required: array or java.lang.Iterable

        found: File

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

      Note: Recompile with -Xlint:deprecation for details.

      Note: /project/src/com/adobe/phonegap/contentsync/Sync.java uses 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.

        at ChildProcess.whenDone (/project/cordova/node_modules/cordova-common/src/superspawn.js:169:23)

        at emitTwo (events.js:106:13)

        at ChildProcess.emit (events.js:191:7)

        at maybeClose (internal/child_process.js:877:16)

        at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)