Reputation: 1
I am using my own plugin payment_module
into my Flutter application. For this plugin I need to use external SDK which is in .aar format.
When I sync the gradle it successfully syncs but while running the flutter application I get the following error.
FAILURE: Build failed with an exception.
* Where:
Build file '%Your_Path%/payment_module/android/build.gradle' line: 64
* What went wrong:
A problem occurred evaluating project ':payment_module'.
> Project with path ':boltsdk' could not be found in project ':payment_module'.
As In new android Studio versions we cannot import the .aar as module directly I have followed the suggestion from https://stackoverflow.com/a/70074787/22637043.
bolt sdk location Image payment_module/android/boltsdk
boltsdk gradle file
configurations.maybeCreate("default")
artifacts.add("default", file('boltsdk-release-3.0.86.aar'))
My build.gradle
dependencies {
..
..
api project(path: ':boltsdk')
/// I also tried implementation project(path: ':boltsdk')
/// and also tried implementation files('boltsdk/boltsdk-release-3.0.86.aar')
/// for this I get this error Error building Android library: Direct local .aar file dependencies are not supported
..
}
settings.gradle file
rootProject.name = 'payment_module'
include ':boltsdk'
for this I already tried multiple solutions from Project with path ':mypath' could not be found in root project 'myproject'
Upvotes: 0
Views: 904
Reputation: 417
Add the following content to this file payment_module/android/build.gradle
Note that it is not in the example directory
rootProject.allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs project(':payment_module').file("libs")
}
}
}
Upvotes: 0