当前位置: 首页 > 知识库问答 >
问题:

任务执行失败:rtmp_publisher: compileReleaseKotlin

韦高格
2023-03-14

编译项目(生成apk)时返回错误:

e: C:\Users\1\FlutterSDK\flutter\.pub-cache\hosted\pub.dartlang.org\rtmp_publisher-0.3.7\android\src\main\kotlin\com\app\rtmp_publisher\Camera.kt: (634, 49): Unresolved reference: startStream

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':rtmp_publisher:compileReleaseKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

科特林的版本是相关的

Gradle文件android\build。格雷德尔:

buildscript {
    ext.kotlin_version = '1.5.10'
    repositories {
        google()
        jcenter()
    }

    dependencies {

        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
        classpath 'com.android.tools.build:gradle:4.2.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"

    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}

subprojects {
    project.evaluationDependsOn(':app')
}

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

Gradle文件android\app\build。格雷德尔:

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"

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
    keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
    compileSdkVersion 30 // was 28

    // added for rtmp
    packagingOptions {
        exclude 'project.clj'
    }

    sourceSets {
        main.java.srcDirs += 'src/main/kotlin'
    }

    lintOptions {
        disable 'InvalidPackage'
    }

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "youinroll.com"
        minSdkVersion 23
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        versionCode 3

    }

    signingConfigs {
        release {
            keyAlias keystoreProperties['keyAlias']
            keyPassword keystoreProperties['keyPassword']
            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
            storePassword keystoreProperties['storePassword']
        }
    }
    buildTypes {
        release {
            signingConfig signingConfigs.release
            shrinkResources false
            minifyEnabled false
        }
    }

    allprojects {
        repositories {
            google()
            mavenCentral()
            maven{url "https://storage.googleapis.com/download.flutter.io"}
        }
    }

}
flutter {
    source '../..'
}
dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}

该应用程序已经广播使用手机摄像头,问题是在它。显然问题是在连接java和kotlin。更新和删除flutter/gradle已完成。

共有1个答案

益和雅
2023-03-14

在升级项目和gradle设置后,我面临着完全相同的问题。

我把Kotlin版本缩小到

ext.kotlin_version = '1.3.50'

这开始给代码编译带来问题,为此,我从构建中删除了这一行。格雷德尔锉刀

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
 类似资料: