Execution failed for task ':app:mergeDebugResources' occur while running the app - android-studio

I am a beginner in android studio. When I try to run the app on my mobile phone, android studio shows me this error:
"execution failed for task ':app:mergedebugresources'. A failure
occurred while executing
com.android.build.gradle.internal.res.ResourceCompilerRunnable"
My build gradle(app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.example.newlogin2"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
aaptOptions{
cruncherEnabled = false
useNewCruncher = false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'com.google.firebase:firebase-auth:21.0.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.rengwuxian.materialedittext:library:2.1.4'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.recyclerview:recyclerview-selection:1.1.0'
implementation platform('com.google.firebase:firebase-bom:28.2.0')
implementation 'com.google.firebase:firebase-analytics'
}
Any one can help please? Thank you!

Check your code if you follow some tutorials and then
go to
file -> invalidate caches/Restart

Related

i am getting error in Gradle of Android Studio

I am developing a music player app since 10 days. Recently, Android Studio asked me to update but after updating there are some gradle and code errors showing.
the error message due to 200 lines i am able to give here is i upload image
I tried all ways to solve but I have no other option so please tell me the solve
Here are the gradle details
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.example.h3mplayer'
compileSdk 33
defaultConfig {
applicationId "com.example.h3mplayer"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
implementation 'androidx.media:media:1.6.1'
implementation "android.arch.lifecycle:extensions:1.1.1"
dependencies {
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
}
}
I tried the last gradle version but also showing some error please help me out

Android resource linking failed, error: failed parsing overlays Android

Recently I got this error when I build my app. I did not modify anything from my last successful build.
here is the error that I got
Android resource linking failed
C:\Users\Asus\.gradle\caches\transforms-3\d7936c72110369b4f70374bb97b71a45\transformed\com.google.android.gms.base\drawable-hdpi-v4_common_full_open_on_phone.png.flat: error: failed to read file: magic value is 0x929c1a24 but AAPT expects 0x54504141.
error: failed parsing overlays.
Here is my build.gradle
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
id 'kotlin-parcelize'
}
android {
namespace 'com.example.amiconnew'
compileSdk 33
defaultConfig {
applicationId "com.example.amiconnew"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.2'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.2'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
/*CUSTOM LIBRARY*/
// MAPS
implementation 'com.google.android.gms:play-services-maps:18.1.0'
implementation "com.google.android.gms:play-services-location:20.0.0"
implementation 'com.google.maps.android:android-maps-utils:2.3.0'
//LIVE DATA
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
implementation "androidx.activity:activity-ktx:1.6.0"
//LIFECYCLE SCOPES LIBRARY
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.5.1'
implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.5.1"
implementation 'androidx.datastore:datastore-preferences:1.0.0'
// RETROFIT
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
// MATERIAL DESIGN
implementation "com.google.android.material:material:1.8.0-alpha01"
//NAVIGATION
implementation 'androidx.navigation:navigation-fragment-ktx:2.5.3'
implementation 'androidx.navigation:navigation-ui-ktx:2.5.3'
//SWIPE REFRESH LAYOUT
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
}
Can someone help me?
I have cleaned and rebuild my app, I have restarted my Android Studio, I also updated to the last version of IDE but nothing seem to work.

Can not extract resource from com.android.aaptcompiler.ParsedResource#51dfe79f

This error is coming when i build my app,please help
This is gradle code:
applicationId "com.example.rubychatbot"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildToolsVersion '33.0.1'
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
implementation "app.alan:sdk:4.12.0"
}
I tried to change sdk version but does'nt help.
Execution failed for task ':app:mergeDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
Resource compilation failed (Failed to compile values resource file E:\Rubychatbot\app\build\intermediates\incremental\debug\mergeDebugResources\merged.dir\values\values.xml. Cause: java.lang.IllegalStateException: Can not extract resource from com.android.aaptcompiler.ParsedResource#51dfe79f.). Check logs for more details.

My application is not launched in Android Emulator

I am new to the development of mobile applications with Android.
The Kotlin application once built, does not appear in the android-studio emulator (Pixel XL API 30: Android 11.0 (Google API))
ADB is unable to debug the application:
$ adb shell am start -n "paris.ksainthi.soundpark/paris.ksainthi.soundpark.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
Timed out waiting for process (paris.ksainthi.soundpark) to appear on Pixel_XL_API_30 [emulator-5554].
The application is present in the list of applications in the configuration. But it is not on the home, nor launched.
Here is my build.gradle file:
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdkVersion 31
buildToolsVersion '30.0.2'
defaultConfig {
applicationId "paris.ksainthi.soundpark"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation 'com.google.android.material:material:1.5.0-alpha02'
}
Here is the configuration of my application:
Deploy: Default APK
Launch: Specified Activity, paris.ksainthi.soundpark.MainActivity

Gradle project sync fails with ParseError

Gradle keeps failing to sync the project.
I get the following error message:
For best of my understating, the interpreter has an issue with parsing the module's build.gradle file.
Here is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.b.b3"
minSdkVersion 23
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
maxSdkVersion 28
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
buildToolsVersion = '28.0.2'
}
ext {
supportLibrary = "27.0.2"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'android.arch.navigation:navigation-fragment:1.0.0-alpha06'
implementation 'android.arch.navigation:navigation-ui:1.0.0-alpha06'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:design:${supportLibrary}"
implementation 'org.osmdroid:osmdroid-android:6.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Could you check the following setting in your build.gradle file?
dependencies {
classpath 'com.android.tools.build:gradle:xxxxx'
}
I used to have the same problem as you. I don't know why. But I adjusted the above version information and the problem was solved.

Resources