android - com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

标签 android gradle protocol-buffers

请帮助我的项目无法运行它向我显示错误 com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream

这是我的gradle应用

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.mixtape.tz.chat"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 22
        versionName "1.22"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"


        // Enabling multidex support.
        multiDexEnabled true

        javaCompileOptions {
            annotationProcessorOptions {
                includeCompileClasspath false
            }
        }

    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

android {
    lintOptions {
        abortOnError false
    }

    aaptOptions {
        cruncherEnabled = false

    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //compile 'io.github.rockerhieu:emojicon:1.4.0'

    //compile 'com.github.lzyzsd.randomcolor:library:1.0.0'
    implementation 'com.googlecode.libphonenumber:libphonenumber:7.3.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.squareup.okhttp3:okhttp:3.9.0'
    implementation 'com.squareup.okio:okio:1.13.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-places:15.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'org.ocpsoft.prettytime:prettytime:3.2.0.Final'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.vanniktech:emoji-one:0.4.0'
    implementation 'com.daasuu:BubbleLayout:1.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'net.opacapp:multiline-collapsingtoolbar:1.4.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.1.2'
    implementation 'de.hdodenhof:circleimageview:2.1.0'
    implementation 'com.google.cloud:google-cloud-translate:1.14.0'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
    testImplementation 'junit:junit:4.12'
}

apply plugin: 'com.google.gms.google-services'

最佳答案

您在 com.android.support.test.espresso:espresso-core 中存在语法错误,并且还在您的依赖项中添加了 multidex,请尝试下面的代码:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 27
    buildToolsVersion '27.0.3'
    defaultConfig {
        applicationId "com.mixtape.tz.chat"
        minSdkVersion 15
        targetSdkVersion 27
        versionCode 22
        versionName "1.22"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    // Enabling multidex support.
    multiDexEnabled true

    javaCompileOptions {
        annotationProcessorOptions {
            includeCompileClasspath false
        }
    }

}
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

}

android { lintOptions { abortOnError false }

    aaptOptions {
        cruncherEnabled = false

    }

}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2')
    { exclude group: 'com.android.support', module: 'support-annotations' } //compile 'io.github.rockerhieu:emojicon:1.4.0'

//compile 'com.github.lzyzsd.randomcolor:library:1.0.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.googlecode.libphonenumber:libphonenumber:7.3.1'
    implementation 'com.android.support:appcompat-v7:27.1.1'
    implementation 'com.squareup.okhttp3:okhttp:3.10.0'
    implementation 'com.squareup.okio:okio:1.14.0'
    implementation 'com.android.support:multidex:1.0.3'
    implementation 'com.android.support:recyclerview-v7:27.1.1'
    implementation 'com.google.firebase:firebase-messaging:17.0.0'
    implementation 'com.google.android.gms:play-services-location:15.0.1'
    implementation 'com.google.android.gms:play-services-places:15.0.1'
    implementation 'com.google.firebase:firebase-crash:16.0.1'
    implementation 'com.google.firebase:firebase-core:16.0.1'
    implementation 'com.mcxiaoke.volley:library-aar:1.0.0'
    implementation 'org.ocpsoft.prettytime:prettytime:3.2.0.Final'
    implementation 'com.android.support.constraint:constraint-layout:1.1.2'
    implementation 'com.vanniktech:emoji-one:0.4.0'
    implementation 'com.daasuu:BubbleLayout:1.1.1'
    implementation 'com.android.support:cardview-v7:27.1.1'
    implementation 'com.github.bumptech.glide:glide:4.7.1'
    implementation 'com.android.support:design:27.1.1'
    implementation 'com.android.support:support-annotations:27.1.1'
    implementation 'net.opacapp:multiline-collapsingtoolbar:1.4.0'
    implementation 'com.squareup.picasso:picasso:2.5.2'
    implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
    implementation 'de.hdodenhof:circleimageview:2.2.0'
    implementation 'com.google.cloud:google-cloud-translate:1.14.0'
    annotationProcessor 'com.google.dagger:dagger-compiler:2.0'
    testImplementation 'junit:junit:4.12'

}

apply plugin: 'com.google.gms.google-services'

还要检查你的项目 gradle 是这样的:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.1.3'
        classpath 'com.google.gms:google-services:4.0.1'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven { url "https://jitpack.io" }
        maven {
            url "https://maven.google.com"
        }
    }
}

关于android - com.google.protobuf.AbstractMessageLite$Builder$LimitedInputStream,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50894599/

相关文章:

java - 使用 Gradle 编译后运行带有依赖项的 java 程序

java - Android Studio 中定义多个 dex 文件

java - 无法添加 protobuf 自动生成类的一系列实例

java - Android非静态字符串转静态字符串错误

java - AVD 无法启动

android - 错误 :(1, 0) 未找到 ID 为 'com.android.application' 的插件

python - 动态编辑 Tensorflow 对象检测的管道配置

android - 如何在手机休眠时防止 Wifi 断开连接?

android - main.java.srcDirs += 'src/main/AndroidManifest.xml' 这行配置的作用是什么?

protocol-buffers - TakeLock 中的 protobuf-net 并发性能问题