簡體   English   中英

D8:程序類型已經存在:com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

[英]D8: Program type already present: com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

我在我的 flutter 項目中收到以下錯誤並且不知道如何解決它錯誤:

D8: Program type already present: com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForDebug'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

* 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.

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 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 30

    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 "com.example.tajicEasy"
        minSdkVersion 18
        targetSdkVersion 30
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
        multiDexEnabled true
    }

    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"
    implementation 'com.android.support:multidex:2.0.1'
}
apply plugin: 'com.google.gms.google-services'

我已經嘗試升級所有內容。 也嘗試通過現有的可用相關答案解決它,但對我沒有任何幫助。 還檢查了 protobuf 沒有兩個類。 嘗試刪除構建,.gradle 文件

好的,如果有人遇到同樣的問題,我解決了這個問題,那么您必須檢查以下內容

  1. 所有依賴項都已更新
  2. multiDexEnabled true

如果上面沒有解決問題然后檢查是否有重復的依賴如果你找不到任何重復的依賴然后嘗試一個一個刪除依賴然后再次運行應用程序這將需要一些時間但是一旦導致錯誤你的應用程序就會運行依賴被移除

謝謝,希望有用

> 在 org.gradle.api.Project

[英]> Could not find method apply() for arguments [com.google.gms.google-services] on project ':app' of type org.gradle.api.Project

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM