代码之家  ›  专栏  ›  技术社区  ›  Abraham

安装Agora颤振RTC包时,任务执行失败:“Agora\u RTC\u引擎:compileProfileKotlin”错误

  •  0
  • Abraham  · 技术社区  · 2 年前

    我有一个工作颤振项目,但当我安装agora RTC包时,它给出的任务执行失败 “:agora\u rtc\u引擎:CompiledBugkotlin” 。错误 我甚至还没有使用该软件包,我尝试在 readme 但我认为问题出在程序包本身,而且我的flutter项目是空安全迁移的,它正在工作,所以我确信我的项目没有问题。

    我还没有使用这个软件包。只需安装它就会出现错误。

    这是 app/gradle.build :

    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 GradleException("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 flutter.compileSdkVersion
        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.malhamti_app"
            // 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 flutter.minSdkVersion
            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"
    }
    

    这是我的 android/build.gradle :

        ext.kotlin_version = '1.6.20'
        repositories {
            google()
            mavenCentral()
        }
    
        dependencies {
            classpath 'com.android.tools.build:gradle:7.1.3'
            classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        }
    }
    
    allprojects {
        repositories {
            google()
            mavenCentral()
            maven { url 'https://jitpack.io' }
        }
    }
    
    rootProject.buildDir = '../build'
    subprojects {
        project.buildDir = "${rootProject.buildDir}/${project.name}"
    }
    subprojects {
        project.evaluationDependsOn(':app')
    }
    
    task clean(type: Delete) {
        delete rootProject.buildDir
    }
    

    这是gradle --stacktrace : 查看完整 stacktrace (字符限制)

    > Task :agora_rtc_engine:compileProfileKotlin FAILED
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraRtcEnginePlugin.kt: (251, 18): Type mismatch: inferred type is String? but String was expected
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraSurfaceViewFactory.kt: (16, 1): Class 'AgoraSurfaceViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraSurfaceViewFactory.kt: (20, 3): 'create' overrides nothing
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraTextureViewFactory.kt: (12, 1): Class 'AgoraTextureViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraTextureViewFactory.kt: (17, 3): 'create' overrides nothing
    
    > Task :agora_rtc_engine:compileDebugKotlin FAILED
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraRtcEnginePlugin.kt: (251, 18): Type mismatch: inferred type is String? but String was expected
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraSurfaceViewFactory.kt: (16, 1): Class 'AgoraSurfaceViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraSurfaceViewFactory.kt: (20, 3): 'create' overrides nothing
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraTextureViewFactory.kt: (12, 1): Class 'AgoraTextureViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraTextureViewFactory.kt: (17, 3): 'create' overrides nothing
    
    > Task :agora_rtc_engine:compileReleaseKotlin FAILED
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraRtcEnginePlugin.kt: (251, 18): Type mismatch: inferred type is String? but String was expected
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraSurfaceViewFactory.kt: (16, 1): Class 'AgoraSurfaceViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraSurfaceViewFactory.kt: (20, 3): 'create' overrides nothing
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraTextureViewFactory.kt: (12, 1): Class 'AgoraTextureViewFactory' is not abstract and does not implement abstract base class member public abstract fun create(p0: Context?, p1: Int, p2: Any?): PlatformView defined in io.flutter.plugin.platform.PlatformViewFactory
    e: /Users/doabletech/Development/Tools/flutter_sdk/.pub-cache/hosted/pub.dartlang.org/agora_rtc_engine-5.1.0/android/src/main/kotlin/io/agora/agora_rtc_engine/AgoraTextureViewFactory.kt: (17, 3): 'create' overrides nothing
    
    FAILURE: Build completed with 3 failures.
    
    1: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':agora_rtc_engine:compileProfileKotlin'.
    > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
       > Compilation error. See log for more details
    
    * Try:
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Exception is:
    see full [stacktrace][3] here (character limit)
    
    
    ==============================================================================
    
    2: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':agora_rtc_engine:compileDebugKotlin'.
    > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
       > Compilation error. See log for more details
    
    * Try:
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Exception is:
    see full [stacktrace][3] here (character limit)
    
    
    ==============================================================================
    
    3: Task failed with an exception.
    -----------
    * What went wrong:
    Execution failed for task ':agora_rtc_engine:compileReleaseKotlin'.
    > A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
       > Compilation error. See log for more details
    
    * Try:
    > Run with --info or --debug option to get more log output.
    > Run with --scan to get full insights.
    
    * Exception is:
    see full [stacktrace][3] here (character limit)
    
    
    BUILD FAILED in 4s
    49 actionable tasks: 49 executed
    
    0 回复  |  直到 2 年前
        1
  •  -1
  •   Abraham    2 年前

    我发现了问题,因为我使用的是颤振开发频道, 如果您有相同的问题,请确保您使用的是最新的颤振稳定版本,以便执行此操作:

    • flutter channel stable

    确保您的 pubspec.yaml 文件已将颤振版本更改为稳定版本,

    • flutter clean
    • flutter run

    您可能会从 flutter lint 包,我通过删除它解决了此问题。

    编辑:颤振3.0.0似乎有问题,导致了与agora相同的错误,将颤振降级到2.12.5为我解决了问题。

    推荐文章