Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Steve_N_1
Beginner
226 Views

Latest XDK - can no longer build project.

Jump to solution

I am unable to build my project anymore.. i keep getting this error in my build log:

 

:preDexArmv7Release
:dexArmv7Release
UNEXPECTED TOP-LEVEL EXCEPTION:
com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
	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:454)
	at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
	at com.android.dx.command.dexer.Main.run(Main.java:246)
	at com.android.dx.command.dexer.Main.main(Main.java:215)
	at com.android.dx.command.Main.main(Main.java:106)

 FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':dexArmv7Release'.
> com.android.ide.common.internal.LoggedErrorException: Failed to run command:
  	.../android-sdk/build-tools/21.1.2/dx --dex --output .../Syncus/platforms/android/build/intermediates/dex/armv7/release --input-list=.../Syncus/platforms/android/build/intermediates/tmp/dex/armv7/release/inputList.txt
  Error Code:
  	2
  Output:
  	
  	UNEXPECTED TOP-LEVEL EXCEPTION:
  	com.android.dex.DexException: Multiple dex files define Landroid/support/annotation/AnimRes;
  		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:454)
  		at com.android.dx.command.dexer.Main.runMonoDex(Main.java:303)
  		at com.android.dx.command.dexer.Main.run(Main.java:246)
  		at com.android.dx.command.dexer.Main.main(Main.java:215)
  		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: 1 mins 4.606 secs

.../Syncus/platforms/android/cordova/node_modules/q/q.js:126
                    throw e;
                    ^
Error code 1 for command: .../Syncus/platforms/android/gradlew with args: cdvBuildRelease,-b,.../Syncus/platforms/android/build.gradle,--no-daemon
Command finished with error code 1: .../Syncus/platforms/android/cordova/build --release
ERROR building one of the platforms: Error: .../Syncus/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: .../Syncus/platforms/android/cordova/build: Command failed with exit code 1
    at ChildProcess.whenDone (.../cordova/cordova-cli/5.1.1/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)

Any ideas?

Tags (2)
0 Kudos
1 Solution
PaulF_IntelCorp
Employee
226 Views

Steve, your first build log error is different than the one you attached. The first one is probably due to some conflicts with the facebook plugin, which has gotten quite old now, and uses some old methods for including the supporting Android libraries. I recommend you remove it and use cordova-plugin-facebook4, which is up-to-date.

If you run into problems removing the facebook plugin, do the following:

  • exit the XDK
  • open the <project-name>/plugins directory with a TEXT editor (Sublime, Brackets, Notepad++, vi, etc.)
  • remove all object elements for the facebook plugin from each of the four *.json files (android.json, ios.json, windows.json and fetch.json) in the plugins directory (be careful to insure that you still have a valid JSON file, watch the commas!)
  • open the <project-name>.xdk file in the root of your project (this is also a JSON file) and remove the object element that refers to the facebook plugin
  • remove the facebook plugin directory that is inside the <project-name>/plugins directory

You can add cordova-plugin-facebook4 using the third-party plugin option, adding it as a cordova registry plugin, and referencing it name: cordova-plugin-facebook4. Note that the latest version of the facebook4 plugin requires a minimum Android API level of 15, your app is probably set to 14, you'll need to increase that to 15. I suspect the previous version (1.6.5) may work with min API of 14, you'll have to specify that version if you want to try that.

The other thing we're seeing, in the detailed build log, is some problem with the intel.xdk.cache plugin. Unfortunately, that plugin has been deprecated (as have all the intel.xdk plugins). There is a version 1.2.4 which might be later than what you are using, but if that does not work, you may have to find an alternative. See the deprecation messages on the plugin manager for some possible alternatives.

View solution in original post

12 Replies
Mitchell_Franklin
New Contributor I
226 Views

Hi Steve,

This looks like the plug-in connection to NPM issue that I have seen before, basically there have been some intermittent connection issues over the last 6 months from what I can see and this causes the build to fail as it cant retrieve the plug-in.

Do you have any other projects that you can test with plug-ins?

Steve_N_1
Beginner
226 Views

No not at the moment,

I may try building again later but it was doing the same thing for about 4 hours last night. Any ideas on what may be worth trying to solve the issue?

Much appreciated.

Eric_H_Intel
Employee
226 Views

What plugins are included in your project?

Eric

 

Swati_S_Intel1
Employee
226 Views

@Steve, can you attach the full build log also?

PaulF_IntelCorp
Employee
226 Views

BTW -- the issue that Mitchell is referring to has been addressed in the 3088 release. Which version of the XDK are you using, Steve? (version number is in the upper-right corner of the XDK).

Steve_N_1
Beginner
226 Views

Heres full build log attached.

Tried Cordova v5.4.1 & v5.1.1.

I'm using build number 3088.

Full plugin list:

cordova-plugin-statusbar
Device cordova-plugin-device
Geolocation cordova-plugin-geolocation
Network Information cordova-plugin-network-information
Notification cordova-plugin-dialogs
Diagnostic cordova.plugins.diagnostic
Custom URL scheme cordova-plugin-customurlscheme
Facebook Connect phonegap-facebook-plugin
Splashscreen cordova-plugin-splashscreen
Swati_S_Intel1
Employee
226 Views

The diagnostic plugin is failing the build. See the notes for this plugin. Try their previous version cordova.plugins.diagnostic.api-22,  which targets API level 22, it worked for me. Ideally the latest one should work, I'll check with the build engineer on that.

PaulF_IntelCorp
Employee
227 Views

Steve, your first build log error is different than the one you attached. The first one is probably due to some conflicts with the facebook plugin, which has gotten quite old now, and uses some old methods for including the supporting Android libraries. I recommend you remove it and use cordova-plugin-facebook4, which is up-to-date.

If you run into problems removing the facebook plugin, do the following:

  • exit the XDK
  • open the <project-name>/plugins directory with a TEXT editor (Sublime, Brackets, Notepad++, vi, etc.)
  • remove all object elements for the facebook plugin from each of the four *.json files (android.json, ios.json, windows.json and fetch.json) in the plugins directory (be careful to insure that you still have a valid JSON file, watch the commas!)
  • open the <project-name>.xdk file in the root of your project (this is also a JSON file) and remove the object element that refers to the facebook plugin
  • remove the facebook plugin directory that is inside the <project-name>/plugins directory

You can add cordova-plugin-facebook4 using the third-party plugin option, adding it as a cordova registry plugin, and referencing it name: cordova-plugin-facebook4. Note that the latest version of the facebook4 plugin requires a minimum Android API level of 15, your app is probably set to 14, you'll need to increase that to 15. I suspect the previous version (1.6.5) may work with min API of 14, you'll have to specify that version if you want to try that.

The other thing we're seeing, in the detailed build log, is some problem with the intel.xdk.cache plugin. Unfortunately, that plugin has been deprecated (as have all the intel.xdk plugins). There is a version 1.2.4 which might be later than what you are using, but if that does not work, you may have to find an alternative. See the deprecation messages on the plugin manager for some possible alternatives.

View solution in original post

Steve_N_1
Beginner
226 Views

I followed SWATI S instructions.. although, it still failed. So i looked into Paul F suggestion. Low and behold, that seems to have done the trick!

 

Thanks ever so much guys!

Steve_N_1
Beginner
226 Views

Argh, scrap that.. just tried to re-build as a second try.

See new build log.

 

PaulF_IntelCorp
Employee
226 Views

Steve -- please review my complete instructions, the issue is addressed there. Here's the relevant error message from your build log:

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':processArmv7ReleaseManifest'.
> Manifest merger failed : uses-sdk:minSdkVersion 14 cannot be smaller than version 15 declared in library .../Syncus/platforms/android/build/intermediates/exploded-aar/com.facebook.android/facebook-android-sdk/4.10.1/AndroidManifest.xml
  	Suggestion: use tools:overrideLibrary="com.facebook" to force usage

 

Steve_N_1
Beginner
226 Views

I have removed the intel.xdk.cache plugin from my project due to it being deprecated and am instead using localstorage.

I missed out the part where the minimum SDK version should be 15. It was set to 14. After running a build, it now works again so thank you. I shall read the build log should i get any other errors.

 

Your help is very much appreciated. Thanks Paul.

Reply