Having trouble running package build android


#1
ANDROID_HOME=/opt/android-sdk
JAVA_HOME=/usr/lib/jvm/java-8-oracle
:wrapper

BUILD SUCCESSFUL

Total time: 0.777 secs
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
	at build_8czfjxvfzcz6bzrcl3bl9oz9y.run(/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/build.gradle:137)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
: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
:prepareOrgApacheCordovaCordovaLib623DebugLibrary
:prepareDebugDependencies
:compileDebugAidl
:compileDebugRenderscript
:generateDebugBuildConfig
:generateDebugResValues
:generateDebugResources
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:incrementalDebugJavaCompilationSafeguard
:compileDebugJavaWithJavac
:compileDebugJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:33: error: package org.apache.cordova.file does not exist
import org.apache.cordova.file.FileUtils;
                              ^
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:34: error: package org.apache.cordova.file does not exist
import org.apache.cordova.file.LocalFilesystemURL;
                              ^
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:453: error: cannot find symbol
        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
        ^
  symbol:   class FileUtils
  location: class Capture
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:453: error: cannot find symbol
        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
                                ^
  symbol:   class FileUtils
  location: class Capture
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:454: error: cannot find symbol
        LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath());
        ^
  symbol:   class LocalFilesystemURL
  location: class Capture
Note: /home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors
:compileDebugJavaWithJavac FAILED

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.

BUILD FAILED

Total time: 2.037 secs
Error: /home/package/workspace/apps-54feeebf-11/cordova/platforms/android/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.
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:33: error: package org.apache.cordova.file does not exist
import org.apache.cordova.file.FileUtils;
                              ^
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:34: error: package org.apache.cordova.file does not exist
import org.apache.cordova.file.LocalFilesystemURL;
                              ^
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:453: error: cannot find symbol
        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
        ^
  symbol:   class FileUtils
  location: class Capture
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:453: error: cannot find symbol
        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
                                ^
  symbol:   class FileUtils
  location: class Capture
/home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java:454: error: cannot find symbol
        LocalFilesystemURL url = filePlugin.filesystemURLforLocalPath(fp.getAbsolutePath());
        ^
  symbol:   class LocalFilesystemURL
  location: class Capture
Note: /home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/splashscreen/SplashScreen.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /home/package/workspace/apps-54feeebf-11/cordova/platforms/android/src/org/apache/cordova/mediacapture/Capture.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 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.

#2

What is your ionic info output?


#3

I’m getting very similar issues (FileUtils errors). I don’t have the File plugin installed for anything. Not sure if it’s needed for other Ionic things?

My Ionic Info:

cli packages: ()

    @ionic/cli-utils  : 1.12.0
    ionic (Ionic CLI) : 3.12.0

global packages:

    cordova (Cordova CLI) : 6.5.0

local packages:

    @ionic/app-scripts : 3.0.1
    Cordova Platforms  : android 6.1.2
    Ionic Framework    : ionic-angular 3.8.0

System:

    Android SDK Tools : 25.2.5
    Node              : v6.11.1
    npm               : 3.10.10
    OS                : Windows 10

Misc:

    backend : legacy

#4

It seems that my issue is related to a recent addition I made for CodePush. That seems to depend on File and FileTransfer (but they are not getting incorporated properly). Not sure why.


#5

I am have started getting the same error. Getting really frustrated. Tried all possible ways to find solution. No luck.

This is my ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.18.0
ionic (Ionic CLI) : 3.18.0

global packages:

cordova (Cordova CLI) : 7.0.1

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 26.1.1
ios-deploy        : 1.9.2
ios-sim           : 6.1.2
Node              : v6.11.4
npm               : 5.4.2
OS                : macOS Sierra
Xcode             : Xcode 9.1 Build version 9B55

Environment Variables:

ANDROID_HOME : /Users/brijchavda/Library/Android/sdk

#6

@brijchavda or @darinwolyniec - do you happen to be using the code push plugin at all? In my case it seems like that’s when the issues started, but it could be because that depends on file transfer and file.


#7

Nope, Never used Code push plugin.

These are my plugins.

cordova plugin ls
cordova-admob-sdk 0.11.1 "AdMob SDK"
cordova-plugin-admob-free 0.11.0 "Cordova AdMob Plugin"
cordova-plugin-advanced-http 1.8.1 "Advanced HTTP plugin"
cordova-plugin-device 1.1.4 "Device"
cordova-plugin-file 5.0.0 "File"
cordova-plugin-file-transfer 1.7.0 "File Transfer"
cordova-plugin-ionic-webview 1.1.16 "cordova-plugin-ionic-webview"
cordova-plugin-splashscreen 4.0.3 "Splashscreen"
cordova-plugin-whitelist 1.3.1 "Whitelist"
cordova-plugin-x-toast 2.6.0 "Toast"
cordova-promise-polyfill 0.0.2 "cordova-promise-polyfill"
cordova-sqlite-storage 2.1.2 "Cordova sqlite storage plugin"
ionic-plugin-keyboard 2.2.1 “Keyboard”


#8

Tried upgrading to the current cordova-android version 6.4.0?


#9

Looks like the cordova-android version was the cause in my situation. The latest cordova file & file-transfer plugins are incompatible with cordova-android@6.1.2 which is default version cordova 6.5.0 (which I am using). More info (on a related code-push issue, which requires cordova file).


#10

I did . No luck.

I wonder, why not lot of people are having the same issue.


#11

same trouble has been solved by upgrading android cordova platfrom in my case

ionic cordova platforms remove android
ionic cordova platform add android@6.3.0

#12

@dalyonushkin

Thank you. Upgrading android cordova platform solved my problem.


#13

Thanks :slight_smile: Upgrading from cordova android 6.2.3 to 6.3.0 solved the problem.


#14

Hi, I have encountered the same issue, but upgrading android platform to version 6.3.0 has raised an error I didn’t have with the 6.1.2 version :

GradleError

Could anyone help me with this issue?


#15

Install Gradle via gradle.org/install

Note that cordova-android 6.4.0 is currently the correct version, you may want to upgrade to that.


#16

im getting the same error even after trying all the solutions mentioned here and other sites

Error: /home/bobnino/test5/platforms/android/gradlew: Command failed with exit code 1 Error output:
/home/bobnino/test5/platforms/android/src/org/apache/cordova/filetransfer/FileTransfer.java:49: error: package org.apache.cordova.file does not exist
import org.apache.cordova.file.FileUtils;

i even upgraded to gradle 4 then downgraded to 3.5

tried

ionic cordova platforms remove android
ionic cordova platform add android@6.3.0

and android 6.2.1 and many others to

nothing is working the file- transfer is the main problem and doesnt seem to be included somehow


#17

@bobnino What is your ionic info output? Did you remove and readd the Android platform?


#18

yes i removed and added the android platform few times and tested ,not working ,i even ipgraded gradle to 4.0 then downgraded it to 3.5, the file-transfer plugin is the problem because all others work well
here is the ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 6.5.0 

local packages:

@ionic/app-scripts : 3.1.2
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.9.2

System:

Android SDK Tools : 25.2.3
Node              : v7.7.3
npm               : 4.4.4 
OS                : Linux 4.4

Environment Variables:

ANDROID_HOME : /root/Android/Sdk

Misc:

backend : pro

#19

Current version: 7.0.1

Current version: 6.4.0

Do these upgrades, if you still get an error after doing that please post the complete command you are running and the error your are getting.


#20

i think your answer @Sujan12 might have worked because im getting a different error now see below :

BUILD FAILED in 4s
Error: /home/bobnino/test3/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project ‘android’.

You have not accepted the license agreements of the following SDK components:
[Android SDK Platform 26, Android SDK Build-Tools 26.0.2].
Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

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

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

BUILD FAILED in 4s

[ERROR] An error occurred while running cordova build android (exit code 1).