Blog coding and discussion of coding about JavaScript, PHP, CGI, general web building etc.

Wednesday, January 20, 2016

Android Studio - mergeDebugResources exception

Android Studio - mergeDebugResources exception


I recently updated the Android Studio to it's latest version, and now I am experiencing a headache with an exception in Gradle build.

Every time I run the project, two or three times before it succeed, I get the following error:

Gradle: Execution failed for task ': ProjectName:  mergeDebugResources'.  Java.lang.NullPointerException (no error message)  

After trying again a couple times, the error does not happen again until the next run.

Does anybody have any idea of why this is happening? The project worked just fine 'til the update, never got any error before...

Thanks!

Answer by René M for Android Studio - mergeDebugResources exception


It happens to me only when modifying the XML files on the project. If you rebuild the entire project before running (Build > Rebuild Project) it doesn't show up anymore.

Answer by jmachete for Android Studio - mergeDebugResources exception


inside your project directory, run:

gradle clean build  

this works for me..

Answer by Lorica for Android Studio - mergeDebugResources exception


I found a solution to the problem.

There is an issue reported about gradle build problems, it is not the same, but the solution seems to solve the mergeResourceDebug issues too. (issue here https://code.google.com/p/android/issues/detail?id=56158). In the comments it is stated that the solution is solved in Gradle 0.4.3.

To use Gradle 0.4.3, the build.gradle file needs to be updated manually. (Updating Android Studio does not change the build file)

Here is what I changed In build.gradle:

dependencies {      classpath 'com.android.tools.build:gradle:0.4.3'  }  

Since changing this, I have not seen any more mergeDebugResource issues when running my project. Hope this helps!

Edit: to stay up to date with Gradle you can change the version number to 0.4.+

Answer by Fabio Guerra for Android Studio - mergeDebugResources exception


Drawables into src/main/res/drawables folder, must be into src/main folder too.

This works for me..

Answer by Rajesh for Android Studio - mergeDebugResources exception


This error could also happen if the generated build file path exceeds the windows max path length of 255 characters. Make sure your project path is not too long, use short names as well.

Answer by user1474089 for Android Studio - mergeDebugResources exception


Just try cleaning your project and building it again

Answer by Hiren Patel for Android Studio - mergeDebugResources exception


In my case none of above works, I have just renamed the project name, everything works well.

Example:

My project name Before - sticky-headers-recyclerview-master

My project name After - SHRV

Hope this will help you.


Fatal error: Call to a member function getElementsByTagName() on a non-object in D:\XAMPP INSTALLASTION\xampp\htdocs\endunpratama9i\www-stackoverflow-info-proses.php on line 72

0 comments:

Post a Comment

Popular Posts

Powered by Blogger.