15

I've just installed android studio and there's an error I don't know how to fix

enter image description here

user3100088
  • 335
  • 3
  • 8
  • 20

15 Answers15

11

Try clean project...

If it doesn't work... Then... Goto build.gradle in project section

Try downgrading the gradle version

From...

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

To...

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

Then gradle.properties, add this

 org.gradle.jvmargs=-XX\:MaxHeapSize\=256m -Xmx256m

Sync it... Clean/Rebuild... It worked for me... So, I am sharing...

ashumeow
  • 141
  • 1
  • 10
  • Same prob when updating to 2.1.0 from 1.3. Its working when changing gradle version to 1.3 but NOT to 2.1.0. How can we resolve with gradle version 2.1.0 ? Any solution? – Karthikeyan Ve Apr 30 '16 at 06:35
9

I can see libc error in the log.

install these packages in your system

sudo apt-get install lib32stdc++6 lib32z1 lib32z1-dev

Restart android studio after installation

John
  • 8,846
  • 8
  • 50
  • 85
6

I had that problem, but it was because my images changed them manually from .JPG to .PNG, so I just changed them with PNG paint and solved the problem

Isaias Grifo
  • 61
  • 1
  • 1
4

This issue can be resolved by trying multiple solutions like:

  1. Clean the project OR delete build folder and rebuild.
  2. Downgrading gradle version
  3. Check for the generated build file path, as it may be exceeding the windows max path length of 255 characters. Try using short names to make sure your project path is not too long.
  4. You may have a corrupted .9.png in your drawables directory
Gaurav Saluja
  • 357
  • 3
  • 11
3

In My case, I've written below code in build.gradle

android {
// ...
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
// ...
}

It's work for me!...

Saravana Kumar
  • 3,230
  • 7
  • 26
  • 44
2

How to fix app:mergeDebugResources in Android Studio (Resource path could not resolved / R.id is not accessible)

  • Go to the project folder from file explorer.
  • Delete(before delete Backup all files) .idea folder
  • If there are any .gradle folder do the 2nd step to the .gradle folder too.
  • If the Exception is referring any 3rd party library/jar file delete that also(keep a backup to add later)
  • Open the project again from Android studio as "Open an existing android studio project"
  • On right side gradle tab click "Refresh all Gradle projects".This will create the gradel project dependancies
  • Now add again 3rd party libraries to the same previous folder structure

This should resolve your Gradle issue.. good luck.

2

click here for the image

  1. Click Gradle in the right side tab

  2. Click the toggle offline icon (enable the Gradle online)

  3. Now try building the project

    And that's it!

Community
  • 1
  • 1
1

Okay here is a simple fix.

This error popped in front of me when I tried to manually change .jpg file to .png and then was copying & pasting it in my 'drawable' folder.

I rebuild and cleaned Project many times but nothing happened, then I removed that .png image and replaced that file with a different pre-existing .png image (or you can change it by help of paint and then paste it in drawable folder)

Now rebuild and clean the project . It works.

Hope it helps..!

enigma
  • 1,029
  • 10
  • 11
0

If you have recently used ionic cordova resources or ionic resources command please check the files generated in folders of platform/build/res there might be some files corrupted , so just delete those files and build the apk.. hope it helps someone worked for me

MSD
  • 437
  • 6
  • 18
0

For me upgrading gradle version and plugin to the latest version did the trick.

Nikos Hidalgo
  • 3,666
  • 9
  • 25
  • 39
0

By default, Android Studio has a maximum heap size of 1280MB. If you are working on a large project, or your system has a lot of RAM, you can improve performance by increasing the maximum heap size for Android Studio processes, such as the core IDE, Gradle daemon, and Kotlin daemon.

If you use a 64-bit system that has at least 5 GB of RAM, you can also adjust the heap sizes for your project manually. To do so, follow these steps:

Click File > Settings from the menu bar (or Android Studio > Preferences on macOS). Click Appearance & Behavior > System Settings > Memory Settings.

For more Info click

https://developer.android.com/studio/intro/studio-config

enter image description here

vinod
  • 1,126
  • 13
  • 18
0

For me. I changed the color of .xml image (vector image) like this.

ic_action_add.xml

  <vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="#FFFFFF"
    android:alpha="0.8">
  <path
      android:fillColor="@android:color/white"
      android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

to:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="24dp"
    android:viewportWidth="24"
    android:viewportHeight="24"
    android:tint="#FFFFFF"
    android:alpha="0.8">
  <path
      android:fillColor="#FF000000"
      android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/>
</vector>

i just changed android:fillColor="@android:color/white" to android:fillColor="#FF000000"

and it's worked for me :)

Mkurbanov
  • 197
  • 3
  • 13
0

Android Studio + Kotlin + MacOS

This happining generally with "google-services.json" file. This is my example:

Solved. I deleted red line in strings.xml file because system already created same name variable which is "google_api_key" in values.xml file.

enter image description here

canerkaseler
  • 6,204
  • 45
  • 38
0

At build.gradle (app) not (root) inside dependencies {[here]} add this line :

**implementation 'com.android.tools.build:gradle:7.2.2'**

This worked for me ^_^ Hope it will help , , , Good lock coding

0

I have the smae problem when adding geolocator add jcenter() to build.gradle solve the problem

repositories {
        google()
        mavenCentral()
        jcenter() //here
    }
Ali Salhab
  • 21
  • 4