Description
When providing an extra maven repository that provides a dependency in a modules build.gradle file, when building an application that uses that dependency cannot be resolved.
*Workaround*:
In your application, add a build.gradle to
platform/android
(classic) or
app/platform/android
(alloy) that contains the repository definition.
Steps to reproduce
1. Copy the below to a build.gradle file in a module
allprojects {
repositories {
maven { url 'https://dl.bintray.com/radiusnetworks/flybuy-sdk'}
}
}
dependencies {
implementation "com.radiusnetworks.flybuy:sdk:1.1.1"
implementation "com.radiusnetworks.flybuy:api:1.1.1"
}
2. Build the module using
appc run -p android
(so the app creation/building happens)
Actual
During the *application build* the following error occurs
[ERROR] [GRADLE]
[ERROR] [GRADLE] FAILURE: Build failed with an exception.
[ERROR] [GRADLE]
[ERROR] [GRADLE] * What went wrong:
[ERROR] [GRADLE] Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
[ERROR] [GRADLE] > Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
[ERROR] [GRADLE] > Could not find com.radiusnetworks.flybuy:api:1.1.1.
[ERROR] [GRADLE] Required by:
[ERROR] [GRADLE] project :app > com.awam:foo:1.0.0
[ERROR] [GRADLE]
[ERROR] [GRADLE] * Try:
[ERROR] [GRADLE] 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.
[ERROR] [GRADLE]
[ERROR] [GRADLE] * Get more help at https://help.gradle.org
[ERROR] [GRADLE]
[ERROR] [GRADLE] BUILD FAILED in 2s
[ERROR] "gradlew" tool returned exit code: 1
[ERROR] Failed to run ti /Users/awam/.nvm/versions/node/v10.16.3/bin/ti
Expected
My expectation is that the repository definition shouldn't be required in app and module (but I could be wrong)
It's an issue with the "build.gradle" file. The "allprojects" part can only be used by the root "build.gradle" which the app developer cannot define; it's auto-generated by Titanium. So, just get rid of the "allprojects" part like the below. I've tested it and it works.
Note that if you're building a module, then you need the above "build.gradle" in your module's "android" directory. Unfortunately, gradle ignores custom repo URLs in the POM file used to declare the libraries dependencies. https://github.com/gradle/gradle/issues/8811 So, in your Titanium app project, you need to add a "build.gradle" under the "./platform/android" directory too
Closing as not our bug based off previous comments. This is a limitation in gradle where a repository set in a module isn't persisted in the built sources (gradle does this for security). As stated in the ticket description the repository needs to be set in both the