Reputation: 11
The entire error code:
What went wrong: Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'. Failed to transform UsbSerial-6.1.0.aar (com.github.felHR85:UsbSerial:6.1.0) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}. Could not find UsbSerial-6.1.0.aar (com.github.felHR85:UsbSerial:6.1.0). Searched in the following locations: https://jitpack.io/com/github/felHR85/UsbSerial/6.1.0/UsbSerial-6.1.0.aar https://jitpack.io/com/github/felHR85/UsbSerial/6.1.0/UsbSerial-6.1.0.jar
My gradle file:
buildscript {
ext.kotlin_version = '1.9.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.application") ||
project.plugins.hasPlugin("com.android.library")) {
project.android {
compileSdkVersion 34
buildToolsVersion "34.0.0"
}
}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
and app/gradle:
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
def flutterTargetSdkVersion = localProperties.getProperty('flutter.targetSdkVersion')
if (flutterTargetSdkVersion == null) {
flutterTargetSdkVersion = '30' // Установите значение по умолчанию, если необходимо
}
android {
namespace "name"
compileSdkVersion 34
ndkVersion flutter.ndkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
defaultConfig {
applicationId "name"
minSdkVersion 21
targetSdkVersion flutterTargetSdkVersion.toInteger()
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation 'com.yandex.android:maps.mobile:4.6.1-full'
implementation 'com.github.felHR85:UsbSerial:6.1.0'
constraints {
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.8.0") {
because("kotlin-stdlib-jdk7 is now a part of kotlin-stdlib")
}
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.8.0") {
because("kotlin-stdlib-jdk8 is now a part of kotlin-stdlib")
}
}
}
I have added the following line to the gradle file:
implementation 'com.github.felHR85:UsbSerial:6.1.0'
I have also included maven:
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
version android studio - LadyBug
Also tried to change the JDK version and Android Studio itself, but nothing helped
i need help, please
Upvotes: 1
Views: 1308
Reputation: 1931
try to change on your pubspec.yaml
usb_serial:
git:
url: https://github.com/jymden/usbserial.git
ref: master
Upvotes: 0
Reputation: 1
change the version you used in the implementation to earlier version - i used 6.0.3 - , if you have the same error you might uses a package that implements the version 6.1.0 -in my case it was "usb-serial-0.5.2" -, so you need to change the version in the package build gradle too, go to your project on android studio => external libraries => Flutter plugins=> the package ,and change the version from dependencies as you did with the build gradle file of your project
Upvotes: 0