任务执行失败:':honeywell_scanner:compileDebugJavaWithJavac'。

3

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.example.deneme_kaynak">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <application
        android:name="${applicationName}"
        android:label="deneme_kaynak"
        android:icon="@mipmap/launcher_icon"
        android:requestLegacyExternalStorage="true"
        android:usesCleartextTraffic="true">

        <activity
            android:name=".MainActivity"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:exported="true"
            android:hardwareAccelerated="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
                android:name="io.flutter.embedding.android.NormalTheme"
                android:resource="@style/NormalTheme" />
            <meta-data
                android:name="io.flutter.embedding.android.SplashScreenDrawable"
                android:resource="@drawable/launch_background"
                />
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!-- Don't delete the meta-data below.
             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationBootReceiver" android:exported="false">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED"></action>
            </intent-filter>
        </receiver>
        <receiver android:name="com.dexterous.flutterlocalnotifications.ScheduledNotificationReceiver" />


        <meta-data
            android:name="flutterEmbedding"
            android:value="2" />
    </application>
</manifest>


符号: 变量BarcodeReader 位置: 类HoneywellScannerNative /Users/ddo/development/flutter/.pub-cache/hosted/pub.dartlang.org/honeywell_scanner-3.2.0+13/android/src/main/java/com/plugin/flutter/honeywell_scanner/HoneywellScannerNative.java: 108: 错误: 找不到符号 properties.put(BarcodeReader.PROPERTY_UPC_E_ENABLED, true); ^ 符号: 变量BarcodeReader 位置: 类HoneywellScannerNative 注意: /Users/ddo/development/flutter/.pub-cache/hosted/pub.dartlang.org/honeywell_scanner-3.2.0+13/android/src/main/java/com/plugin/flutter/honeywell_scanner/HoneywellScannerPlugin.java使用或覆盖了已过时的API。 注意: 重新编译时使用-Xlint:deprecation以获取详细信息。 37个错误

失败:构建失败。

  • 出现了什么问题: 任务“:honeywell_scanner:compileDebugJavaWithJavac”执行失败。

编译失败;有关详细信息,请参见编译器错误输出。

  • 尝试:

运行时加上 --stacktrace 选项可以获得堆栈跟踪信息。 运行时加上 --info 或 --debug 选项可以获得更多的日志输出。 运行时加上 --scan 选项可以获得完整的分析结果。

app/build.gradle

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
    localPropertiesFile.withReader('UTF-8') { reader ->
        localProperties.load(reader)
    }
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
    throw new FileNotFoundException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
    flutterVersionCode = '1'
}

def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
    flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
    compileSdkVersion 33
    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 {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.deneme_kaynak"
        // You can update the following values to match your application needs.
        // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
        minSdkVersion 29
        targetSdkVersion flutter.targetSdkVersion
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
        }
    }
}

flutter {
    source '../..'
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

build.gradle


buildscript {
    ext.kotlin_version = '1.6.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath 'com.android.tools.build:gradle:7.2.2'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
    delete rootProject.buildDir
}


编辑:

失败: 出现异常无法构建。

  • 问题所在: 无法确定任务':app:mergeDebugAssets'的依赖关系。

无法解决配置':app:debugRuntimeClasspath'的所有任务依赖项。 无法解决项目:honeywell。 由以下要求: 项目:app > 项目:honeywell_scanner > 找不到匹配的项目honeywell配置。 消费者被配置为查找组件的运行时,最好是针对Android进行优化,并具有属性'com.android.build.api.attributes.BuildTypeAttr',其值为'debug',属性'com.android.build.api.attributes.AgpVersionAttr',其值为'7.2.2',属性'org.jetbrains.kotlin.platform.type',其值为'androidJvm',但: - 没有可消耗的配置具有属性。


请将您的lib honeywell_scanner升级到最新版本。 - Hardik Mehta
帮帮我,拜托! - Umutcan Bağdu
在终端中运行以下命令: flutter pub upgrade --major-versions - Kashif Ali Bhatti
1个回答

0

请按照以下步骤正确集成 honeywell_scanner

https://pub.dev/packages/honeywell_scanner

1. flutter pub add honeywell_scanner 2. 将位于以下路径的示例代码源内的honeywell文件夹复制到将要使用此插件的Android项目模块中:
.../.pub-cache/hosted/pub.dartlang.org/honeywell_scanner-x.x.x+x/example/android/honeywell
这一步是必需且至关重要的,因为Honeywell Data Collection Android库是一个捆绑的.aar文件,必须作为项目库引用。 3. 在您的Android项目模块的settings.gradle中添加include ':honeywell',以便插件可以定位honeywell.aar库。 4. 在AndroidManifest.xml的application标签下添加tools:replace="android:label",这是必需的,因为honeywell.aar库定义了android:label="@string/app_name",与您项目的标签冲突,导致合并清单失败错误。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接