繁体   English   中英

app:transformClassesWithJarMergingForDebug,com.android.build.api.transform.TransformException:java.util.zip.ZipException:

[英]app:transformClassesWithJarMergingForDebug, com.android.build.api.transform.TransformException: java.util.zip.ZipException:

首先我知道有很多类似的问题,但我的情况有所不同。 请先阅读完整的问题!

这是完整的错误......

Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/firebase/appindexing/Action$Builder$StatusType.class

每当我试图在我的模拟器中运行时,都会显示此错误。

此外,如果我尝试生成.apk文件(在调试或释放模式下),则会显示相同的错误。

现在魔术 ......

如果我在调试模式下运行我的手机,那就完全可以了。 没有错误显示,它运行正常。

这是我的清单文件......

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.brandtechnosolutions.petbaazar">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:name=".MyApplication"
        android:allowBackup="true"
        android:icon="@drawable/iconpetbazar"
        android:label="@string/app_name"
        android:theme="@style/Theme.AppCompat.Light">
        <meta-data
            android:name="com.facebook.sdk.ApplicationId"
            android:value="@string/facebook_app_id" />

        <activity
            android:name=".MainActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <!--
     ATTENTION: This was auto-generated to add Google Play services to your project for
     App Indexing.  See https://g.co/AppIndexing/AndroidStudio for more information.
        -->
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name=".LoginActivity"
            android:label="@string/title_activity_login"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
        <activity android:name=".WebActivity" />
        <activity
            android:name="com.facebook.FacebookActivity"
            android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
            android:label="@string/app_name"
            android:screenOrientation="portrait" />
        <activity
            android:name="com.facebook.CustomTabActivity"
            android:exported="true"
            android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />

                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />

                <data android:scheme="@string/fb_login_protocol_scheme" />
            </intent-filter>
        </activity>
        <activity
            android:name=".BuyerSellerActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
        <activity
            android:name=".OptionActivity"
            android:label="@string/title_activity_option"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar" />
        <activity
            android:name=".TakeAdInfoActivity"
            android:screenOrientation="portrait"
            android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
    </application>

</manifest>

我的build.gradle ......

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    dexOptions {
        javaMaxHeapSize "1g"
    }
    repositories {
        mavenCentral()
    }
    defaultConfig {
        applicationId "com.brandtechnosolutions.petbaazar"
        minSdkVersion 15
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        multiDexEnabled true
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}



dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    //    apply plugin: 'com.google.gms.google-services'
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:design:25.1.0'
    compile 'com.google.android.gms:play-services:10.0.1'
    compile 'com.google.android.gms:play-services-appindexing:9.8.0'
    compile 'com.facebook.android:facebook-android-sdk:[4,5)'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
    compile 'junit:junit:4.12'
}

使用sdk平台......

姜饼,蜂窝,棉花糖

使用带有Jelly Bean的模拟器。

任何人都知道如何解决它,请帮忙!

您应该使用相同级别的库:

compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.google.android.gms:play-services-appindexing:10.0.1'

还要添加文件的buttom:

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

编辑:
要使用该插件,您必须在buildscript块中添加依赖buildscript (在顶级文件或模块文件中):

dependencies {
    classpath 'com.google.gms:google-services:3.0.0'
    // ...
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM