Ionic framework 'compileDebugJavaWithJavac' error while building apk - android

I am working with Ionic framework and trying to build APK, using ionic build android command and getting Execution failed for task ':compileDebugJavaWithJavac'
Here is the complete Log:
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.
This is my very first project with Ionic framework, and I am actually not getting the exact way to resolve this issue...

It looks like that error is being generated by the cordova-file-transfer plugin. It's possible you have an old version as you are getting a deprecated API notice.
Try removing the plugin and re-adding it with:
ionic plugin remove cordova-plugin-file-transfer
Then:
ionic plugin add cordova-plugin-file-transfer
And then try rebuilding the app.

Related

cannot find symbol DaggerAppComponent, Cause: java.lang.ExceptionInInitializerError

I was trying to build my Dagger2 based Android project in Android studio Arctic fox 2020.3.1 with Mac M1 and I got the error,
error: cannot find symbol
import xxxx.com.xxxx.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
which also was showing
Cause: java.lang.ExceptionInInitializerError
The same project was working in another machine(not mac).
Also I am unable to see the compiler error toggle button in android studio build output.
Please help me to resolve this.
complete build output,
Executing tasks: [:app:assembleDebug] in project /projects/Android/prototype
Task :app:preBuild UP-TO-DATE
Task :app:preDebugBuild UP-TO-DATE
Task :app:compileDebugAidl NO-SOURCE
Task :app:compileDebugRenderscript NO-SOURCE
Task :app:dataBindingMergeDependencyArtifactsDebug UP-TO-DATE
Task :app:dataBindingMergeGenClassesDebug UP-TO-DATE
Task :app:generateDebugResValues UP-TO-DATE
Task :app:generateDebugResources UP-TO-DATE
Task :app:injectCrashlyticsMappingFileIdDebug UP-TO-DATE
Task :app:processDebugGoogleServices UP-TO-DATE
Task :app:mergeDebugResources UP-TO-DATE
Task :app:dataBindingGenBaseClassesDebug UP-TO-DATE
Task :app:dataBindingTriggerDebug UP-TO-DATE
Task :app:generateDebugBuildConfig UP-TO-DATE
Task :app:javaPreCompileDebug UP-TO-DATE
Task :app:checkDebugAarMetadata UP-TO-DATE
Task :app:createDebugCompatibleScreenManifests UP-TO-DATE
Task :app:extractDeepLinksDebug UP-TO-DATE
Task :app:processDebugMainManifest UP-TO-DATE
Task :app:processDebugManifest UP-TO-DATE
Task :app:processDebugManifestForPackage UP-TO-DATE
Task :app:processDebugResources UP-TO-DATE
Task :app:compileDebugJavaWithJavac FAILED
The following annotation processors are not incremental: dagger-android-processor-2.16.jar (com.google.dagger:dagger-android-processor:2.16), dagger-compiler-2.16.jar (com.google.dagger:dagger-compiler:2.16).
Make sure all annotation processors are incremental to improve your build speed.
/Users/sysadmin/Documents/projects/esp32/energy-monitor/Android/prototype/app/src/main/java/prototype/com/myapp/ui/provision/PairingActivity.java:22: error: cannot find symbol
import prototype.com.myapp.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package prototype.com.myapp.di
/Users/sysadmin/Documents/projects/esp32/energy-monitor/Android/prototype/app/src/main/java/prototype/com/myapp/ui/provision/ProvisionActivity.java:41: error: cannot find symbol
import prototype.com.myapp.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package prototype.com.myapp.di
/Users/sysadmin/Documents/projects/esp32/energy-monitor/Android/prototype/app/src/main/java/prototype/com/myapp/ui/splash/SplashActivity.java:20: error: cannot find symbol
import prototype.com.myapp.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package prototype.com.myapp.di
/Users/sysadmin/Documents/projects/esp32/energy-monitor/Android/prototype/app/src/main/java/prototype/com/myapp/ui/appliance/AddApplianceActivity.java:15: error: cannot find symbol
import prototype.com.myapp.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package prototype.com.myapp.di
/Users/sysadmin/Documents/projects/esp32/energy-monitor/Android/prototype/app/src/main/java/prototype/com/myapp/ui/appliance/event/AddEventActivity.java:8: error: cannot find symbol
import prototype.com.myapp.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package prototype.com.myapp.di
/Users/sysadmin/Documents/projects/esp32/energy-monitor/Android/prototype/app/src/main/java/prototype/com/myapp/ui/welcome/WelcomeActivity.java:10: error: cannot find symbol
import prototype.com.myapp.di.DaggerAppComponent;
^
symbol: class DaggerAppComponent
location: package prototype.com.myapp.di
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
6 errors
Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
Task :app:mergeDebugShaders UP-TO-DATE
Task :app:compileDebugShaders NO-SOURCE
Task :app:generateDebugAssets UP-TO-DATE
Task :app:mergeDebugAssets UP-TO-DATE
Task :app:compressDebugAssets UP-TO-DATE
Task :app:processDebugJavaRes NO-SOURCE
Task :app:checkDebugDuplicateClasses UP-TO-DATE
Task :app:desugarDebugFileDependencies UP-TO-DATE
Task :app:mergeExtDexDebug UP-TO-DATE
Task :app:mergeLibDexDebug UP-TO-DATE
Task :app:mergeDebugJniLibFolders UP-TO-DATE
Task :app:mergeDebugNativeLibs NO-SOURCE
Task :app:stripDebugDebugSymbols NO-SOURCE
Task :app:validateSigningDebug UP-TO-DATE
Task :app:writeDebugAppMetadata UP-TO-DATE
Task :app:writeDebugSigningConfigVersions UP-TO-DATE
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
java.lang.ExceptionInInitializerError
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/7.0.2/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 1s
29 actionable tasks: 1 executed, 28 up-to-date
I'd love to comment but I have not enough reputation, anyway, are you using room in your project? I had the same issue also only on my Mac M1, it was caused by the room version, I updated it to 2.4.0-alpha03 and it builds fine since then. if not, you may want to check the version of the libraries you are using, but yeah only on Mac M1, hope it helps.

Execution failed for task ':mergeReleaseResources'

i have some issues with ionic package build.
When i build my app i have this error :
You have been opted out of telemetry. To change this, run: cordova telemetry on.
ANDROID_HOME=/usr/local/src/android-sdk-linux
JAVA_HOME=/usr/lib/jvm/java-8-oracle
:preBuild UP-TO-DATE
:preReleaseBuild UP-TO-DATE
:checkReleaseManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preReleaseBuild UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseRenderscript
:CordovaLib:generateReleaseResValues
:CordovaLib:generateReleaseResources
:CordovaLib:packageReleaseResources
:CordovaLib:compileReleaseAidl
:CordovaLib:generateReleaseBuildConfig
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets
:CordovaLib:processReleaseManifest
:CordovaLib:processReleaseResources
:CordovaLib:generateReleaseSources
:CordovaLib:compileReleaseJavaWithJavacNote: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:transformResourcesWithMergeJavaResForRelease
:CordovaLib:transformClassesAndResourcesWithSyncLibJarsForRelease
:CordovaLib:mergeReleaseJniLibFolders
:CordovaLib:transformNative_libsWithMergeJniLibsForRelease
:CordovaLib:transformNative_libsWithSyncJniLibsForRelease
:CordovaLib:bundleRelease
:prepareAndroidCordovaLibUnspecifiedReleaseLibrary
:preDebugBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript
:CordovaLib:generateDebugResValues
:CordovaLib:generateDebugResources
:CordovaLib:packageDebugResources
:CordovaLib:compileDebugAidl
:CordovaLib:generateDebugBuildConfig
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets
:CordovaLib:processDebugManifest
:CordovaLib:processDebugResources
:CordovaLib:generateDebugSources
:CordovaLib:compileDebugJavaWithJavacNote: 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
:prepareComAndroidSupportSupportCompat2420Library
:prepareComAndroidSupportSupportCoreUi2420Library
:prepareComAndroidSupportSupportCoreUtils2420Library
:prepareComAndroidSupportSupportFragment2420Library
:prepareComAndroidSupportSupportMediaCompat2420Library
:prepareComAndroidSupportSupportV42420Library
:prepareReleaseDependencies
:compileReleaseAidl
:compileReleaseRenderscript
:generateReleaseBuildConfig
:generateReleaseAssets UP-TO-DATE
:mergeReleaseAssets
:generateReleaseResValues
:generateReleaseResources
:mergeReleaseResources
AAPT: libpng error: Read Error
:mergeReleaseResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':mergeReleaseResources'.
> Some file crunching failed, see logs 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: 4.182 secs
Error: Error code 1 for command: /home/package/workspace/apps-ab71f554-17/cordova/platforms/android/gradlew with args: cdvBuildRelease,-b,/home/package/workspace/apps-ab71f545-17/cordova/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true
It happens after i added a plugin (toast) and make cordova prepare
I don't understand the logs and how to manage to fix the issue..
Someone have an ideas ?
Thanks in advance.
I had the same issue, solved this by renaming mine folder, some paths are too big for windows, though, if you still have problems, I recommend you to read this.
It was just a problem of icon image...all of this for..that.

Cordova build error code 1

I am trying to build android project by cordova but I still always having error . here is the terminal output:
tobe#tobe-laptop:~/DemoProject$ cordova build android
ANDROID_HOME=/home/tobe/android-sdk-linux
JAVA_HOME=/home/tobe/java/jdk1.8.0_91
:preBuild UP-TO-DATE
:preDebugBuild UP-TO-DATE
:checkDebugManifest
:CordovaLib:preBuild UP-TO-DATE
:CordovaLib:preDebugBuild UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':CordovaLib:processDebugResources'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/home/tobe/android-sdk-linux/build-tools/23.0.3/aapt'' finished with non-zero exit value 127
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: 3.544 secs
Error: Error code 1 for command: /home/tobe/DemoProject/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/tobe/DemoProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

My first phonegap app flashlight is failing on cordova build

I tried my best to follow all the instructions. I'm using this plugin - https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin
And here is the full app I wrote - https://github.com/c0debreaker/flashlight-phonegap
Here is the error when I execute cordova build:
$ cordova build
Running command: /Users/user01/repos/Flash/platforms/android/cordova/build
ANDROID_HOME=/usr/local/bin/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/user01/repos/Flash/platforms/android/gradlew cdvBuildDebug -b /Users/user01/repos/Flash/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript 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
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources UP-TO-DATE
:processDebugManifest UP-TO-DATE
:processDebugResources
/Users/user01/repos/Flash/platforms/android/build/intermediates/res/debug/xml/config.xml:20: error: Error parsing XML: unbound prefix
:processDebugResources FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/usr/local/bin/android-sdk-macosx/build-tools/23.0.2/aapt package -f --no-crunch -I /usr/local/bin/android-sdk-macosx/platforms/android-22/android.jar -M /Users/user01/repos/Flash/platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /Users/user01/repos/Flash/platforms/android/build/intermediates/res/debug -A /Users/user01/repos/Flash/platforms/android/build/intermediates/assets/debug -m -J /Users/user01/repos/Flash/platforms/android/build/generated/source/r/debug -F /Users/user01/repos/Flash/platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package io.cordova.hellocordova -0 apk --output-text-symbols /Users/user01/repos/Flash/platforms/android/build/intermediates/symbols/debug
Error Code:
1
Output:
/Users/user01/repos/Flash/platforms/android/build/intermediates/res/debug/xml/config.xml:20: error: Error parsing XML: unbound prefix
* 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: 1.917 secs
/Users/user01/repos/Flash/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/user01/repos/Flash/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/user01/repos/Flash/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/user01/repos/Flash/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/user01/repos/Flash/platforms/android/cordova/build: Command failed with exit code 1
The error is in config.xml, where you have no namespace import for gap:
You can do two things:
Add this namespace to the widget tag:
Or remove the gap prefix in gap:plugin as these days you can use plugin directly on phonegap build.

Conflict with android support version on cordova build android

this is a common error, but in this case don't know how to solve this. What I do:
cordova build android
And it return this:
$ cordova build android
Running command: "/app/platforms/android/cordova/build"
ANDROID_HOME=/Android SDK/adt-bundle-mac-x86_64-20140702/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home
Running: /app/platforms/android/gradlew cdvBuildDebug -b /app/platforms/android/build.gradle -Dorg.gradle.daemon=true
:preBuild
:compileDebugNdk UP-TO-DATE
:preDebugBuild
:checkDebugManifest
:CordovaLib:compileLint
:CordovaLib:copyDebugLint UP-TO-DATE
:CordovaLib:mergeDebugProguardFiles UP-TO-DATE
:CordovaLib:preBuild
:CordovaLib:preDebugBuild
:CordovaLib:checkDebugManifest
:CordovaLib:prepareDebugDependencies
:CordovaLib:compileDebugAidl UP-TO-DATE
:CordovaLib:compileDebugRenderscript UP-TO-DATE
:CordovaLib:generateDebugBuildConfig UP-TO-DATE
:CordovaLib:generateDebugAssets UP-TO-DATE
:CordovaLib:mergeDebugAssets UP-TO-DATE
:CordovaLib:generateDebugResValues UP-TO-DATE
:CordovaLib:generateDebugResources UP-TO-DATE
:CordovaLib:packageDebugResources UP-TO-DATE
:CordovaLib:processDebugManifest UP-TO-DATE
:CordovaLib:processDebugResources UP-TO-DATE
:CordovaLib:generateDebugSources UP-TO-DATE
:CordovaLib:compileDebugJava UP-TO-DATE
:CordovaLib:processDebugJavaRes UP-TO-DATE
:CordovaLib:packageDebugJar UP-TO-DATE
:CordovaLib:compileDebugNdk UP-TO-DATE
:CordovaLib:packageDebugJniLibs UP-TO-DATE
:CordovaLib:packageDebugLocalJar UP-TO-DATE
:CordovaLib:packageDebugRenderscript UP-TO-DATE
:CordovaLib:bundleDebug UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:compileLint
:com.phonegap.plugins.facebookconnect:FacebookLib:copyDebugLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugProguardFiles UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:preBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:preDebugBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:checkDebugManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:preDebugTestBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareAndroidCordovaLibUnspecifiedDebugLibrary
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareDebugDependencies
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugAidl
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugRenderscript
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugBuildConfig
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugAssets UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugAssets
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugResValues UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:generateDebugSources
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:com.phonegap.plugins.facebookconnect:FacebookLib:processDebugJavaRes UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugJar
:com.phonegap.plugins.facebookconnect:FacebookLib:compileDebugNdk
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugJniLibs UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugLocalJar
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugRenderscript UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageDebugResources
:com.phonegap.plugins.facebookconnect:FacebookLib:bundleDebug
:prepareAndroidComPhonegapPluginsFacebookconnectFacebookLibUnspecifiedDebugLibrary
:prepareAndroidCordovaLibUnspecifiedDebugLibrary UP-TO-DATE
:preReleaseBuild
:CordovaLib:copyReleaseLint UP-TO-DATE
:CordovaLib:mergeReleaseProguardFiles UP-TO-DATE
:CordovaLib:preReleaseBuild
:CordovaLib:checkReleaseManifest
:CordovaLib:prepareReleaseDependencies
:CordovaLib:compileReleaseAidl UP-TO-DATE
:CordovaLib:compileReleaseRenderscript UP-TO-DATE
:CordovaLib:generateReleaseBuildConfig UP-TO-DATE
:CordovaLib:generateReleaseAssets UP-TO-DATE
:CordovaLib:mergeReleaseAssets UP-TO-DATE
:CordovaLib:generateReleaseResValues UP-TO-DATE
:CordovaLib:generateReleaseResources UP-TO-DATE
:CordovaLib:packageReleaseResources UP-TO-DATE
:CordovaLib:processReleaseManifest UP-TO-DATE
:CordovaLib:processReleaseResources UP-TO-DATE
:CordovaLib:generateReleaseSources UP-TO-DATE
:CordovaLib:compileReleaseJava UP-TO-DATE
:CordovaLib:processReleaseJavaRes UP-TO-DATE
:CordovaLib:packageReleaseJar UP-TO-DATE
:CordovaLib:compileReleaseNdk UP-TO-DATE
:CordovaLib:packageReleaseJniLibs UP-TO-DATE
:CordovaLib:packageReleaseLocalJar UP-TO-DATE
:CordovaLib:packageReleaseRenderscript UP-TO-DATE
:CordovaLib:bundleRelease UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:copyReleaseLint UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseProguardFiles UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:preReleaseBuild
:com.phonegap.plugins.facebookconnect:FacebookLib:checkReleaseManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareAndroidCordovaLibUnspecifiedReleaseLibrary
:com.phonegap.plugins.facebookconnect:FacebookLib:prepareReleaseDependencies
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseAidl
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseRenderscript
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseBuildConfig
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseAssets UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseAssets
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseResValues UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:mergeReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseManifest
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:generateReleaseSources
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseJava
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
:com.phonegap.plugins.facebookconnect:FacebookLib:processReleaseJavaRes UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseJar
:com.phonegap.plugins.facebookconnect:FacebookLib:compileReleaseNdk
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseJniLibs UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseLocalJar
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseRenderscript UP-TO-DATE
:com.phonegap.plugins.facebookconnect:FacebookLib:packageReleaseResources
:com.phonegap.plugins.facebookconnect:FacebookLib:bundleRelease
:prepareComAndroidSupportSupportV42220Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAds810Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesAppindexing810Library UP-TO-DATE
:prepareComGoogleAndroidGmsPlayServicesBasement810Library UP-TO-DATE
:prepareDebugDependencies
:compileDebugAidl UP-TO-DATE
:compileDebugRenderscript UP-TO-DATE
:generateDebugBuildConfig UP-TO-DATE
:generateDebugAssets UP-TO-DATE
:mergeDebugAssets
:generateDebugResValues UP-TO-DATE
:generateDebugResources UP-TO-DATE
:mergeDebugResources
:processDebugManifest
:processDebugResources
:generateDebugSources
:compileDebugJava
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.
:preDexDebug
:dexDebug
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
:dexDebug FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dexDebug'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
/Android SDK/adt-bundle-mac-x86_64-20140702/sdk/build-tools/23.0.1/dx --dex --no-optimize --output /app/platforms/android/build/intermediates/dex/debug --input-list=/app/platforms/android/build/intermediates/tmp/dex/debug/inputList.txt
Error Code:
2
Output:
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/v4/accessibilityservice/AccessibilityServiceInfoCompatIcs;
at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:502)
at com.android.dx.command.dexer.Main.runMonoDex(Main.java:334)
at com.android.dx.command.dexer.Main.run(Main.java:277)
at com.android.dx.command.dexer.Main.main(Main.java:245)
at com.android.dx.command.Main.main(Main.java:106)
* 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: 30.368 secs
/app/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /app/platforms/android/gradlew with args: cdvBuildDebug,-b,/app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /app/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /app/platforms/android/cordova/build: Command failed with exit code 1
So I understand that is a conflict of versions between android-support-v4 and android-support-v13 but don't know how to solve this.
$ cordova -v
5.4.0
$ cordova platform
Installed platforms: android 4.1.1, ios 3.8.0
Thanks in advance!
I will bet that it's the Facebook plugin that's causing the collision. Try adding this to your platforms/android/build.gradle file:
configurations {
all*.exclude group: 'com.android.support', module: 'support-v4'
}

Categories

Resources