Injector icon indicating copy to clipboard operation
Injector copied to clipboard

Could not find .. :unspecified, when trying to inject a library module

Open gabriel-rajadurai opened this issue 3 years ago • 1 comments

I took the sample project available in the repo, added another module utils. Then instead of injecting the lottie library, I injected this module instead.

inject project(':utils')

But this failed with, Cannot choose between the following variants of project :utils: - debugRuntimeElements - releaseRuntimeElements

A stackoverflow answer suggested to keep configuration as default,

inject project(path: ':utils', configuration: 'default')

This worked, but when building the project, I get the following error.

`Execution failed for task ':lib:javaPreCompileDebug'.

Could not resolve all files for configuration ':lib:debugCompileClasspath'. Could not find injector-android-example:utils:unspecified. Searched in the following locations: - https://dl.google.com/dl/android/maven2/injector-android-example/utils/unspecified/utils-unspecified.pom - https://dl.google.com/dl/android/maven2/injector-android-example/utils/unspecified/utils-unspecified.jar - https://repo.maven.apache.org/maven2/injector-android-example/utils/unspecified/utils-unspecified.pom - https://repo.maven.apache.org/maven2/injector-android-example/utils/unspecified/utils-unspecified.jar - https://jcenter.bintray.com/injector-android-example/utils/unspecified/utils-unspecified.pom - https://jcenter.bintray.com/injector-android-example/utils/unspecified/utils-unspecified.jar Required by: project :lib

  • Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ==============================================================================

2: Task failed with an exception.

  • What went wrong: Execution failed for task ':lib:mergeDebugManifest'.

com.android.manifmerger.ManifestMerger2$MergeFailureException: java.io.FileNotFoundException: /Users/gabriel/Development/Injector/injector-android-example/lib/build/exploded-aar/injector-android-example/utils/unspecified/AndroidManifest.xml (No such file or directory)`

From the error logs, it seems to be trying to find the module in the maven repositories setup in the project gradle, instead of local project directory.

gabriel-rajadurai avatar Nov 24 '21 13:11 gabriel-rajadurai

@artyomd After checking one of the issue -https://github.com/artyomd/Injector/issues/70

I tried to inject an aar file instead of a module. The aar file is located in libs folder.

inject(name: 'dll_settings', ext: 'aar')

But this doesn't work as well. I am getting this exception.

Unable to find method ''void org.gradle.api.internal.file.DefaultFileCollectionFactory.<init>(org.gradle.internal.file.PathToFileResolver, org.gradle.api.internal.tasks.TaskResolver)'' 'void org.gradle.api.internal.file.DefaultFileCollectionFactory.<init>(org.gradle.internal.file.PathToFileResolver, org.gradle.api.internal.tasks.TaskResolver)'

I have created a sample project for reproducing this issue. Here's the github link, https://github.com/gabriel-rajadurai/injector-sample

gabriel-rajadurai avatar Dec 20 '21 04:12 gabriel-rajadurai