Sarimm Chaudhry
Sarimm Chaudhry

Reputation: 199

Execution failed for task ':app:mergeExtDexDebug' As A Result of A Null Pointer Exception

I’m making an app that displays PDF's in android studio it loads the files and then displays them via an external library I haven't fully implemented the display feature as of yet mainly due to the fact that I have been receiving the following error when running my application

Execution failed for task ':app:mergeExtDexDebug'.

and the following Exception:

java.lang.NullPointerException: Cannot invoke "String.length()" because "<parameter1>" is null

So far I have only built out the initial features such as the Splash Screen, a main screen for the upload and one screen for the PDF display. I have added the part where the user can click the upload button and it will provide the Intent and standard PDF dialogue for android and receive the file. However when I test the code up until this point it gives me this error its quite weird and showed up abruptly as it didn’t show before and I suspect it has something to do with the config files.

Here is the stack trace of the error:

Task :app:mergeExtDexDebug FAILED
    AGPBI: {"kind":"error","text":"java.lang.NullPointerException","sources":

    Execution failed for task ':app:mergeExtDexDebug'.
        > Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
           > Failed to transform appcompat-resources-1.7.0.aar (androidx.appcompat:appcompat-            
      > Execution failed for DexingNoClasspathTransform: 
         > Error while dexing.
   > Failed to transform appcompat-1.7.0.aar (androidx.appcompat:appcompat:1.7.0) to match 
         > Error while dexing.

* Try:
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:mergeExtDexDebug'.
    
Caused by: java.lang.NullPointerException

These are the gradle files

App Level:

plugins {
id 'com.android.application'
}

android {
namespace 'com.example.jurisscan'
compileSdk 34

defaultConfig {
    applicationId "com.example.jurisscan"
    minSdk 24
    targetSdk 34
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-   rules.pro'
    }
}

buildFeatures {
    viewBinding true
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.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'
}

Project Level:

 // Top-level build file where you can add configuration common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.0.0' apply false
id 'com.android.library' version '8.0.0' apply false
}

Project Settings:

pluginManagement {
repositories {
    google()
    mavenCentral()
    gradlePluginPortal()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
    google()
    mavenCentral()
}
}
rootProject.name = "JurisScan"
include ':app'

From what I understood the stack trace showed that this was at its core some Null Pointer Exception somewhere in app-compact resources jar that occurs during the dexing process while the application build's. I tried fiddling with the config files updating the compile sdk's trying to clear caches and restart and rebuild a few times but nothing has worked as of yet.

I have been stuck on this issue for some time now if anyone has any thoughts on something that might help would really appreciate it.

Upvotes: 5

Views: 5431

Answers (1)

Sarimm Chaudhry
Sarimm Chaudhry

Reputation: 199

Hi Everyone i guess the current the solution is to downgrade the verison of androidx.appcompact to 1.6.1 as 1.7.0 is expericing isssues such as this

Upvotes: 12

Related Questions