Experimental plugin and duplicated dependencies on libgnustl_shared.so

94 views
Skip to first unread message

Thasso Griebel

unread,
Sep 2, 2015, 3:45:11 AM9/2/15
to adt-dev
Hi,

I just stumbled across an issue with the experimental plugin 0.3.1. I have three projects, two library projects and one app project. The app depends on both libraries and both libraries contain JNI code and depend on libgnustl_shared.so. Now the build fails in the packaging tasks with:

...
:app:dexDebug
:app:validateDebugSigning
:app:packageDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':examples:dev_app:packageDebug'.
> Failed to add <path_to_app_folder>/build/intermediates/exploded-aar/app/lib_two/unspecified/jni/armeabi-v7a/libgnustl_shared.so

Running it with --debug shows:

09:37:30.392 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter] Executing actions for task ':examples:dev_app:packageDebug'.
09:37:30.392 [INFO] [org.gradle.api.internal.changedetection.changes.RebuildIncrementalTaskInputs] All input files are considered out-of-date for incremental task ':app:packageDebug'.
09:37:30.396 [DEBUG] [org.gradle.api.Project] Packaging dev_app-debug-unaligned.apk
09:37:30.396 [DEBUG] [org.gradle.api.Project] <path_to_project>/app/build/intermediates/res/resources-debug.ap_:
09:37:30.396 [DEBUG] [org.gradle.api.Project] => AndroidManifest.xml
...
09:37:31.384 [DEBUG] [org.gradle.api.Project] Native folder: <path_to_project>/app/build/intermediates/rs/debug/lib
09:37:31.384 [DEBUG] [org.gradle.api.Project] Native folder: <path_to_project>/app/build/intermediates/exploded-aar/lib_one/unspecified/jni
09:37:31.758 [DEBUG] [org.gradle.api.Project] => lib/armeabi-v7a/libgnustl_shared.so
09:37:31.866 [DEBUG] [org.gradle.api.Project] => lib/armeabi-v7a/libone.so
...
09:37:32.706 [DEBUG] [org.gradle.api.Project] Native folder: <path_to_project>/app/build/intermediates/exploded-aar/lib_two/unspecified/jni
09:37:32.706 [DEBUG] [org.gradle.api.Project] => lib/armeabi-v7a/libtwo.so
09:37:33.102 [DEBUG] [org.gradle.api.Project] => lib/armeabi-v7a/libgnustl_shared.so
09:37:33.121 [DEBUG] [org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter] Finished executing task ':examples:dev_app:packageDebug'

When I remove the dependency to gnustl in any of the library projects, the build is okay. 

Any ideas how to work around this issue? 

Thanks,
-Thasso

mazen shihab

unread,
Sep 3, 2015, 7:42:46 PM9/3/15
to adt-dev
Yeah I have the same issue. I hope there is a workaround.

Thasso Griebel

unread,
Sep 4, 2015, 6:01:14 AM9/4/15
to adt-dev
Just FYI I found a workaround ... but its ... really just a workaround.

I added a task to the apps build.gradle and squeeze it between dexDebug and packageDebug. The task just deletes all but one of the duplicated files from the intermediate folders so there is only one copy left before packaging. Obviously this is bound to the Debug variant, but thats all I needed to continue and it at least solved my immediate problem.

afterEvaluate{
    task workaround(dependsOn: "dexDebug"){
        doLast{
            file("build/intermediates/exploded-aar/lib_one/unspecified/jni/armeabi-v7a/libgnustl_shared.so").delete()
        }
    }
    tasks.packageDebug.dependsOn(tasks.workaround)
Reply all
Reply to author
Forward
0 new messages