Hello Stackoverflow Team,
when i run the following command:
ionic build android
I get the following:
Execution failed for task ':mergeDebugAssets'.
[www/node_modules/semver/semver.browser.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/semver/semver.browser.js [www/node_modules/semver/semver.browser.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/semver/semver.browser.js.gz: Error: Duplicate resources
[www/node_modules/bower/lib/node_modules/semver/semver.browser.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/bower/lib/node_modules/semver/semver.browser.js [www/node_modules/bower/lib/node_modules/semver/semver.browser.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/bower/lib/node_modules/semver/semver.browser.js.gz: Error: Duplicate resources
[www/node_modules/semver/semver.min.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/semver/semver.min.js.gz [www/node_modules/semver/semver.min.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/semver/semver.min.js: Error: Duplicate resources
[www/node_modules/bower/lib/node_modules/semver/semver.min.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/bower/lib/node_modules/semver/semver.min.js.gz [www/node_modules/bower/lib/node_modules/semver/semver.min.js] /home/felix/Entwicklungen/TryMe/platforms/android/assets/www/node_modules/bower/lib/node_modules/semver/semver.min.js: Error: Duplicate resources
When I just compile a blank app, everything works fine. Can someone tell me whats happened here?
I also tried to remove platform android and add it again but nothing happened.
Thank you!
The solution was to delete the semver directory.
I've just spent a long time trying to fix the same problem on my computer, after creating a new windows user.
I tried deleting the .gz-files, but for one of my plugins, the .gz-files was recreated every time I ran
$ ionic cordova run android
I tried different versions of android platform-tools, build-tools etc..
Different cordova versions.. Different node and npm versions.
I also messed around with the environment variables.
But what I finally discovered (and what I suspect caused the problem for me), was that I hadn't correctly cloned the repository from bitbucket.
I had used:
git clone
https://creators_username#bitbucket.org/creators_username/repository_name.git
instead of:
git clone
https://my_username#bitbucket.org/creators_username/repository_name.git
After cloning again, using my own username, everything seems well. And I haven't got any node_modules folders inside
platforms/android/assets/www
or it's subfolders. And my theory is, you're not supposed to.
Remove the build folder inside www and try again.. good luck.
Related
sincerely, I tried almost EVERYTHING that is on the internet.Even not directly related to this specific problem.This problem is happening in Android Studio even before I Installed the latest version.I was about a month without working in Android Studio.The only thing related to Gradle that I messed with, was adding the LibGDX to Eclipse for a University work.I may be talking nonsense, but a think the problem appeared after that, because I had to install the SDK for Eclipse and this may be caused the issue.
When I open Android, I can't build my apk.So I made several changes to the app and noticed that nothing changed.So I Looked to the Gradle build and saw:
Error:Failed to complete Gradle execution. Cause: unknown.
in Gradle Sync I got:
Gradle 'BluetoothConnector' project refresh failed
So I tried:PrintScreen of the Android Studio error
◘Updating Android Studio
◘Turning off Oflline mode.
◘Reinstalling(I did it several times with false hopes) every thing
related to Java(JDK,Java,JRE,Eclipse,Android Studio).
◘Checked the project Structure, add Dependecies entries.
◘Invalidade Cache/Restart
◘Export/Reimport.
So as you fellow programmers can see, I'm kind of struggling hard with this problem.Before I ask a question, a very long battle has already been going on for quite a while.And I simply don't know what else to do.
I tried starting a new application, and the same refresh error appears. All my other apps as well.
Unfortunely the only solution was a clean formating of the PC.I have no Idea what caused this, but it was the only thing left to do.And it worked.If Anyone come across this issue, that's really what do to.
Try this, it worked for me.
1. Change compile to implementation or api (As compile is now deprecated)
2. Clean the project
Check following links for more details:
Gradle Project refresh failed error
Use the new dependency configurations
I am getting an error intermittently when I build my Java project in Intellij.
Internal caches are corrupted or have outdated format, forcing project rebuild: java.io.FileNotFoundException: C:\target\classes\ehcache.xml (Access is denied)
I have run File->Invalidate caches. I have restarted Intellij and killed all Java processes. I eventually get it to build again but not sure what thing I try does the trick.
When I try to access the 'Target' folder, it says Access Denied.
Anyone seen this before?
As mentioned in my comment, I received the same message, but without any access right issues involved whatsoever.
It seemed to be some kind of confusion on IDEA's end. I was able to fix this by deleting the system directory in C:\Users\%USERNAME%\.IdeaIC13 (the path obviously depends on the IntelliJ IDEA version).
This stores all caches and indices among other things. I have to confess that I can't tell why exactly this helps, but it seems to be a rougher way to "invalidate caches" and it works. Your project history is not deleted this way, so you can practically continue working - just that all files have to be scanned again and all indices have to be rebuilt.
In any event, this was not an access rights problem at all.
For me, I just had to clean all modules (and ensure they didn't require sudo permission), and rebuild.
The File->Invalidate Caches/Restart... did not work for me.
If you can't access the folder have to either change the rights for the entire hierarchy starting from your project root folder as described here, or move your project to some other directory that you are allowed to access
Tried all the above, but none worked for me. Finally running Intellij 14 in admin mode did the trick.
I had this exact problem, I tried all of the above solutions but none of them worked for me.
The I tried the oldest one in the book (ie rebooting my laptop) and that fixed everything!
Similar to pdinklag's answer, I had to delete my user-level Android Studio caches to get rid of this error. However, Android Studio caches are stored in ~/.android/.
I shut down Android Studio, then ran:
cd
rm .android/cache build-cache build-cache.lock
Then restarted Android Studio, and things worked.
I had the same problem in Intellij 17 version for Mac.
Rebuilding the project, changing the directory of the project, cleaning the module, and running IntelliJ 17 with admin mode did not work.
Updating Intellij to 2019 version solved the error. It seems the application was not able to get the admin permissions.
I'm trying to build a new Android project. It is my first time playing around with Android Studio. Please note I am not a Java expert.
I have included Facebook SDK, and since then it is giving me this error:
Gradle: Execution failed for task ':PROJECTNAME:dexDebug'.
> Running C:\Program Files (x86)\Android\android-studio\sdk\build-tools\android-4.2.2\dx.bat failed. See output
I have tried finding out online what could be wrong, but I didn't find anything.
Also I have no idea how to see the output, some blog websites recommend to run with "--stacktrace", but I have no idea how to add options to rebuild my project.
I just click on Build -> Rebuild Project
Could anyone please help me ?
Thank you!
Here is my own answer, I think I figured it out:
1) To debug the project (at least with Windows). Open CMD.exe, then navigate to your project folder. Then write: "gradlew build --info"
2) This showed me this message:
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Landroid/support/v4/app/Activ
ityCompatHoneycomb;
Following some information on different blogs, I found one solution, I removed this dependency from my project (but kept it in facebook):
compile files('libs/android-support-v4.jar')
This worked and compiled successfully.
I have updated to the latest Android SDK and set JAVA_HOME in .bash_profile using
export JAVA_HOME=$(/usr/libexec/java_home), and I'm getting the following error:
Error Gradle:
FAILURE: Could not determine which tasks to execute.
* What went wrong:
Task 'assembleDebug' not found in project ':CrystalBall'.
* Try:
Run gradle tasks to get a list of available tasks.
Error: Could not execute build using Gradle distribution
http://services.gradle.org/distributions/gradle-1.6-bin.zip
I've attached a screenshot:
What should I do?
The second error in your screenshot seems more important to me. You have to make sure, that the Android Studio is able to download and execute the gradle binary. If you are using a proxy you have to configure it in the Android Studio.
To check the gradle tasks, go to your project folder on the command line and type "gradlew tasks"
You can also configure a proxy for gradle. Just create a gradle.properties file in (your project folder) with these properties:
systemProp.http.proxyHost=www.example.org
systemProp.http.proxyPort=8080
systemProp.http.proxyUser=userid
systemProp.http.proxyPassword=password
systemProp.http.nonProxyHosts=*.nonproxy.com|localhost
I don't believe this is the issue the poster had, but for the benefit of others I'll add what I found as I was helping someone on Windows XP who was getting the same error.
It appears the issue in his case was that the path to the Android Studio project had spaces in it (since Windows XP uses the Documents and Settings directory). I had him generate a new project into a directory without spaces in it and it built and ran without problems. Might have actually been something else, but as usual it is best to avoid spaces in paths.
I'm on Eclipse for hours now and I didn't found a solution yet for my problem even after many searches on internet: I have no more R.java file on my projects.
On just created or on my old projects, i don't have R file anymore and I tried so many solutions (uninstall, re-install Eclipse, clean my project, check all my XMLs, fix problem with android tool and so on ...)
Please someone can tell me what to do in this case?
Hey If you just updated to ADT Rev 22 :
I had the problem too. There is a new component in the Tools folder called "Android SDK Build-tools" that needs to be installed.
Step 1
Open the Android SDK Manager
Step 2
Select the newly added Build Tools and install. (If problem stays then go to Project Properties => Java Build Path => Order and Export and check Android Private Libraries, then clean and build project.
It may be necessary to repeat the process, restart the SDK Manager after the update and make sure it looks like this (all tools installed):
More info:https://groups.google.com/forum/?fromgroups=#!topic/android-developers/rCaeT3qckoE%5B1-25-false%5D
Perhaps in Project Properties -> Java Build Path -> Libraries you don't have:
Android 4.2.2 (or other version)
Android Dependencies ?
If so, then right click project - > Android tools -> fix android properties
and see if this library showed up.
Thank you all for saving me! I've spent the whole afternoon on search this error.
Finally, my project works.
By the way, I also encountered one problem which i wanna share with you:
After upgrading, even if my project has not errors anymore. During runtime, it seems it couldn't find the classes from the jars placed in \libs.
Go into Project=>properties => Java build path= > Order and Export.
Please make sure all your jars are checked.
If this problem occurs suddenly in a well working project,
the first step is to find whether the problem occurs only in the current project or in all other projects.
if all other projects in the current workspace are working then 90% problem is with XML / mainfestfile/resourse file that you edited recently.
This error is not shown as red mark we have to find out what we have done recently in these files.
try this
sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev
it solved my problem
Close your eclipse and after refreshing system, try to open Eclipse again. I think you are using Emulator along with the eclipse. It may be because of the low Memory problem (RAM) of your system. I used to face the same problem when I use Emulator
whenever there is any mistakes in any of the xmls the R goes missing when a build or clean happens so check for any xml errors in your project unless you fix it you cant get back your R on clean or build. fix the xml files and perform a clean you will have the R generated. Also check in File->properties->Builders and see if everything is checked
I was using Eclipse Indigo and nothing I tried worked. I ended up downloading Juno SR2, reinstalling the ADT, and now everything works again.
Reinstall everything and it'll work.. i.e. go back to Google SDK or w.e. you're using and download it.
Update it to latest in SDK Manager.
Go into Eclipse-Project-Prefs-Java build path-order/export TICK EVERYTHING.
problem: No R file get generated.
guess: Try cleaning project if it is old one. Else create new project with no R get generated and with no compile errors but this: no project.apk
In this case you have to check your SDK for the built-tools. May not be installed after updating SDK.
Thus download them if not download here, then put them under directory: SDK/built-tools folder. Lastly, and most important, is to Run the SDK As Administrator. This guarantees refreshing SDK with all packages appearing in it.
Install the SDK-Built-Tools or any missing packages according to the above link and you're done.
hope this helps.
Try one thing, create a new Android Project and transfer all those files which are in the previous project. That worked for me.
In my case there is error due to "&" inside strings.xml file(but error not shown) for declaring string for a array type. Now the problem has been solved as I changed "&" to "and".
So, please make sure that you do not have such silly use of symbols, and clean the project.
I have had the same kind of problem, however Rechecking all XML files in the Resources folder was helpful in my case. I found syntax error in my XML files. Cleaning and building the project again can be helpful sometimes too.
I had the dreaded not more R.java.
Some of the things I've used in the past:
Clean / rebuild (the first thing we all try)
Restart eclipse (optionally reboot pc/mac)
Update both SDK/ADT eclipse plugin to latest version
Create new eclipse workspace and import project
Enable Verbose AAPT build output Eclipse menu>Preferences>Android>Build
Port project to Android Studio / Gradle (this helped my actually see the AAPT error i was getting Error Code:138)
Delete recent XML changes - Ultimately I found deleting recent menu.xml files I'd added and commenting out where they were referenced fixed the issue and I finally got R.java.
I got the error recently and had found no fault in any layout or value file. After a lot of tries I add another Activity and the R.java was build and the error disappeared. I don't know why this occur, but it takes me hours.