firebase-android-sdk: :app:generateCrashlyticsSymbolFileRelease - Specified path for unstripped native libs is not a directory

Describe your environment

    dependencies {
        classpath 'com.android.tools.build:gradle:3.5.3'
        classpath 'com.google.gms:google-services:4.3.3'
        classpath 'com.google.firebase:firebase-crashlytics-gradle:2.0.0-beta02'
        classpath 'com.google.firebase:firebase-appdistribution-gradle:1.3.1'
    }

Describe the problem

Steps to reproduce:

When I try to run: ./gradlew clean assembleRelease uploadCrashlyticsSymbolFileRelease

I get next error:

Execution failed for task ':app:generateCrashlyticsSymbolFileRelease'.
> java.io.IOException: Specified path for unstripped native libs is not a directory: /Users/martin/repos/example-app-android/app/obj

If I manually move all my NDK libs to ./app folder I get the same error with different path:

Execution failed for task ':app:generateCrashlyticsSymbolFileRelease'.
> java.io.IOException: Specified path for stripped native libs is not a directory: /Users/martin/repos/example-app-android/app/build/intermediates/transforms/stripDebugSymbol/release

In this second case the build command sometimes fails, sometimes not.

This issue started to appear after I moved from Fabric Crashlytics plugin to Firebase Crashlytics plugin. In the Fabric case, I had the option to define: androidNdkOut and androidNdkLibsOut paths. Is that missing in the new Firebase plugin?

Relevant Code:

Old code example:

    crashlytics {
        enableNdk true
        androidNdkOut "$buildDir/ndklibs/obj"
        androidNdkLibsOut "$buildDir/ndklibs/libs"
    }

New Code example:

            firebaseCrashlytics {
                nativeSymbolUploadEnabled true

            }

In the Firebase case, I didn’t specify any paths.

To collect all ndk libs I use following code:

    configurations {
        ndkzip
    }

    task setupNdklibs(type: Sync) {
        dependsOn configurations.ndkzip
        from {
            configurations.ndkzip.collect { zipTree(it) }
        }
        into "$buildDir/ndklibs/"
    }
    build.finalizedBy setupNdklibs

and executing ./gradlew build

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 26 (5 by maintainers)

Most upvoted comments

In the new Firebase Crashlytics plugin, the androidNdkOut and androidNdkLibsOut properties have been changed to strippedNativeLibsDir and unstrippedNativeLibsDir, and should be declared in firebaseCrashlytics within the variant block, where you declared nativeSymbolUploadEnabled true.

Those options aren’t currently documented, though they will be shortly.

😠 firebase-crashlytics-gradle:2.2.0 can NOT build but 2.1.1 works good

Crashlytics could not determine stripped/unstripped native library directories for project ‘:app’, variant Release. These are required for generating symbol files when NDK build tasks cannot be automatically inferred. Please specify strippedNativeLibsDir and unstrippedNativeLibsDir in the firebaseCrashlytics extension.

Hello, thanks for your answer @mrichards What should I do if I have a separate module with native code and include it in a project like aar? Is it possible to work with new Crashlytics this way?

@mrichards I tested and I get the same issues, but now the problem is with the path:

> java.io.IOException: Specified path for unstripped native libs is not a directory: /Users/martin/repos/example-app-android/app/Users/martin/repos/example-app-android/app/build/ndklibs/libs

It looks like this task prepends <your-path-to-app>/app to strippedNativeLibsDir and unstrippedNativeLibsDir paths. Code:

            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                strippedNativeLibsDir "$buildDir/ndklibs/obj"
                unstrippedNativeLibsDir "$buildDir/ndklibs/libs"
            }

I solved my problem using relative paths:

            firebaseCrashlytics {
                nativeSymbolUploadEnabled true
                // These paths are relative to the app/ folder
                strippedNativeLibsDir "build/ndklibs/obj"
                unstrippedNativeLibsDir "build/ndklibs/libs"
            }

But it looks like a issue with the app:generateCrashlyticsSymbolFileRelease task 😃

@mrichards Even after updating the crashlytics plugin to 2.2.0, I get the same error. It still assumes the given path is relative path. If this was expected to work, how do you differentiate whether the given path is absolute or relative?

@mrichards — Still doesn’t seem quite right: with the 2.2.0 plugin, now get “Crashlytics could not find NDK build tasks on which to depend. You many need to manually enforce task dependencies for generateCrashlyticsSymbolFileFlavorAmazonRelease” message.

Crashlytics Gradle plugin v2.2.0 will fix both the task ordering issue and the absolute path issue. These two fixes together should make it easier to get symbols uploaded for 3rd party libraries using as described here.

We’ll update this issue when the release goes live within the next couple of weeks.

com.android.tools.build:gradle:3.5.3 com.google.firebase:firebase-crashlytics-gradle:2.0.0

Since both properties are relative paths to ‘app’ dir, how should I reference other modules? For example, my native libs are in ‘:external’ which sits on the same leve as ‘:app’ dir. setting something like the following doesn’t work: strippedNativeLibsDir "${rootProject.projectDir}/external/build/intermediates/stripped_native_libs/release/out/lib/"

Glad you got it working! I’ll take a look at the absolute path issue.