skip to Main Content

Today I was not able to compile my application. This is the error that I obtain if I try to Rebuild my project.

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

Execution failed for task ':app:dexBuilderDebug'.
 Could not resolve all files for configuration ':app:detachedConfiguration18'.
    Failed to transform jetified-appcompat-resources-1.7.0-beta01-runtime.jar to match attributes {artifactType=ext-dex-dexBuilderDebug, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
       Execution failed for DexingExternalLibArtifactTransform: C:UsersJohn Doe.gradlecachestransforms-3a17cb0bdbb9802eb5b30084992aad901transformedjetified-appcompat-resources-1.7.0-beta01-runtime.jar.
          Error while dexing.
    Failed to transform appcompat-1.7.0-beta01-runtime.jar to match attributes {artifactType=ext-dex-dexBuilderDebug, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
       Execution failed for DexingExternalLibArtifactTransform: C:UsersJohn Doe.gradlecachestransforms-3cb6538e8f72401bf3ec35fdf09737324transformedappcompat-1.7.0-beta01-runtime.jar.
          Error while dexing.

enter image description here

enter image description here

enter image description here

Any ideas on what could be wrong?

3

Answers


  1. I solved it by upgrading to gradle 8 using the automatic version updater. Then you’ll have to fix a few more cascading bugs that are minor tweaks to the build.gradle and manifest.xml. Keep commenting and I’ll let you know.

    Login or Signup to reply.
  2. I added following code in app build.gradle after reviewing error details. Details were as following

    Could not resolve all files for configuration ‘:app:stagingDebugRuntimeClasspath’. > Failed to transform core-1.14.0-alpha01.aar (androidx.core:core:1.14.0-alpha01) to match attributes.

    Possible Fix:

    configurations.all {
            resolutionStrategy {
                force("androidx.core:core-ktx:1.9.0")
            }
        }
    
    Login or Signup to reply.
  3. On our side, the problem comes from the "react-native-google-fit" package which uses the latest version of appcompat in android/build.gradle:

    dependencies {
         def supportLibVersion = safeExtGet('supportLibVersion', null)
         def androidXVersion = safeExtGet('androidXVersion', null)
    
         implementation fileTree(include: ['*.jar'], dir: 'libs')
         implementation('com.facebook.react:react-native:+') {
             exclude group: 'com.android.support'
         }
         if (supportLibVersion && androidXVersion == null) {
             implementation "com.android.support:appcompat-v7:$supportLibVersion"
         } else {
             def defaultAndroidXVersion = "1.+"
             implementation "androidx.appcompat:appcompat:${safeExtGet(androidXVersion, defaultAndroidXVersion)}"
         }
         implementation "com.google.android.gms:play-services-auth:${safeExtGet('authVersion', '+')}"
         implementation "com.google.android.gms:play-services-fitness:${safeExtGet('fitnessVersion', '+')}"
    }
    

    The latest version 1.7.0-beta01 seems to be causing problems with our build configuration.

    While waiting to find the solution, I made this temporary patch, just replace react-native-google-fit in your package.json:

    "react-native-google-fit": "0.20.0" by "react-native-google-fit": "IlanAMG/react-native-google-fit"

    (https://github.com/IlanAMG/react-native-google-fit)

    run yarn and it works.

    Follow the same method on the problematic package on your side or in your android/build.gradle

    This is just a temporary patch for today

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search