Add File Transfer build failed


#1

when I add File Transfer plugin ,build failed;but when I remove ,build success

err log:

E:\ionic2\MyApp>ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[12:37:53]  build prod started ...
[12:37:53]  clean started ...
[12:37:53]  clean finished in 20 ms
[12:37:53]  copy started ...
[12:37:53]  deeplinks started ...
[12:37:54]  deeplinks finished in 733 ms
[12:37:54]  ngc started ...
[12:38:08]  ngc finished in 14.11 s
[12:38:08]  preprocess started ...
[12:38:08]  preprocess finished in 1 ms
[12:38:08]  webpack started ...
[12:38:09]  copy finished in 16.35 s
[12:39:11]  webpack finished in 63.08 s
[12:39:11]  uglify started ...
[12:39:11]  sass started ...
Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
[12:39:14]  sass finished in 2.67 s
[12:39:14]  cleancss started ...
[12:39:17]  cleancss finished in 2.49 s
[12:39:48]  uglify finished in 36.98 s
[12:39:48]  postprocess started ...
[12:39:48]  postprocess finished in 100 ms
[12:39:48]  lint started ...
[12:39:49]  build prod finished in 115.92 s
> cordova build android --release
ANDROID_HOME=E:\android\android-sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_73
Subproject Path: CordovaLib
[12:39:56]  tslint: E:/ionic2/MyApp/src/providers/update-service.ts, line: 228
            'url' is declared but never used.

     L227:  //ios
     L228:  let url=this.utilService.getIosDownloadUrl();
     L229:  //this.iab.create(url,'_system','location=no');

[12:39:56]  tslint: E:/ionic2/MyAp/src/pages/work/work.ts, line: 12
            Property 'util' is declared but never used.

      L12:    constructor(public navCtrl: NavController, private util: UtilService) {

[12:39:56]  lint finished in 7.92 s
Incremental java compilation is an incubating feature.
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl
 UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:compileLint UP-TO-DATE
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseShaders UP-TO-DATE
:CordovaLib:compileReleaseShaders UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:incrementalReleaseJavaCompilationSafeguard UP-TO-DATE
:CordovaLib:compileReleaseJavaWithJavac UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease UP-TO-DATE
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease UP-TO-DATE
:CordovaLib:mergeReleaseJniLibFolders UP-TO-DATE
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease UP-TO-DATE
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:prepareAndroidCordovaLibUnspecifiedReleaseLibrary UP-TO-DATE
:preDebugBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugNdk 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
:prepareComAndroidSupportSupportCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUi2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportCoreUtils2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportFragment2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportMediaCompat2600Alpha1Library UP-TO-DATE
:prepareComAndroidSupportSupportV42600Alpha1Library UP-TO-DATE
:prepareReleaseDependencies
:compileReleaseAidl UP-TO-DATE
:compileReleaseRenderscript UP-TO-DATE
:generateReleaseBuildConfig UP-TO-DATE
:generateReleaseResValues UP-TO-DATE
:generateReleaseResources UP-TO-DATE
:mergeReleaseResources
 UP-TO-DATE
:processReleaseManifest
 UP-TO-DATE
:processReleaseResources
 UP-TO-DATE
:generateReleaseSources
 UP-TO-DATE
:incrementalReleaseJavaCompilationSafeguard
 UP-TO-DATE
:compileReleaseJavaWithJavac

:compileReleaseJavaWithJavac - is not incremental (e.g. outputs have changed, no previous execution, etc.).
E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:49: ����: ������org.apache.cordova.file�
�����
import org.apache.cordova.file.FileUtils;
                              ^
E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:851: ����: �Ҳ�������
:compileReleaseJavaWithJavac FAILED

BUILD FAILED

Total time: 5.192 secs
                        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
                        ^
  ����: �� FileUtils
E:\ionic2\MyAppp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:851: ����: �Ҳ�������
                        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
                                                ^
  ����: �� FileUtils
ע: ijЩ�����ļ�ʹ�û�����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.javaʹ����δ���������ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣
3 ������

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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:
E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:49: ����: ������org.apache.cordova.file�
�����
import org.apache.cordova.file.FileUtils;
                              ^
E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:851: ����: �Ҳ�������
                        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
                        ^
  ����: �� FileUtils
E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java:851: ����: �Ҳ�������
                        FileUtils filePlugin = (FileUtils) pm.getPlugin("File");
                                                ^
  ����: �� FileUtils
ע: ijЩ�����ļ�ʹ�û�����ѹ�ʱ�� API��
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:deprecation ���±��롣
ע: E:\ionic2\MyApp\platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.javaʹ����δ���������ȫ�IJ�����
ע: �й���ϸ��Ϣ, ��ʹ�� -Xlint:unchecked ���±��롣
3 ������

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileReleaseJavaWithJavac'.
> 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] An error occurred while running cordova build android --release (exit code 1).

ionic info:

cli packages: (C:\Users\user\AppData\Roaming\npm\node_modules)

    @ionic/cli-utils  : 1.19.2
    ionic (Ionic CLI) : 3.20.0

global packages:

    cordova (Cordova CLI) : 6.5.0

local packages:

    @ionic/app-scripts : 3.1.8
    Cordova Platforms  : android 6.1.2
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 24.3.4
    Node              : v6.10.3
    npm               : 4.6.1
    OS                : Windows 7

Environment Variables:

    ANDROID_HOME : E:\android\android-sdk

Misc:

    backend : pro

#2

Hi!

remove “private util: UtilService” from constructor, and remove “UtilService” from import section


#3

Both super old and should be updated to a current version.