Я пытаюсь импортировать библиотеку в плагин Flutter, но настройка очень странная, поскольку у вас есть папка android и папка example/android. По сути, мне просто нужно иметь доступ к библиотеке в папке android. Сейчас пишет, что не может найти файлы. Кто-нибудь знает какие-либо примеры или имеет мысли о том, что я делаю неправильно?
Мои файлы aar находятся в папке android/libs.
android/build.gradle:
group 'com.mycompany.myplugin'
version '1.0-SNAPSHOT'
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
flatDir {
dirs 'libs'
}
}
}
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
if (project.android.hasProperty("namespace")) {
namespace 'com.mycompany.myplugin'
}
compileSdk 34
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
defaultConfig {
minSdkVersion 21
}
dependencies {
testImplementation 'org.jetbrains.kotlin:kotlin-test'
testImplementation 'org.mockito:mockito-core:5.0.0'
}
testOptions {
unitTests.all {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed", "standardOut", "standardError"
outputs.upToDateWhen {false}
showStandardStreams = true
}
}
}
}
dependencies {
implementation(name: 'my-library', ext: 'aar')
}
Ошибка:
Execution failed for task ':app:checkReleaseAarMetadata'.
> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.
> Could not find :my-library:.
Required by:
project :app > project :myplugin
Подробнее здесь: https://stackoverflow.com/questions/785 ... ter-plugin