2016-11-22 11 views
2

私は今4週間Androidアプリを開発しています。 Skype for Business - Android用App SDK - プレビュー(https://www.microsoft.com/en-us/download/details.aspx?id=51961)を作っています。アプリはアルファテストの準備が整いました。そのため、Google PlayストアにAPKを公開したいと考えています。 Google Play開発コンソールにアップロードするには、APKファイルが必要です。AndroidスタジオでAPKが作成されませんか?

com.android.build.api.transform.TransformException:java.util.zip私はAPK(トップメニュー> APKを構築するビルド>)を構築しようとした場合

、私は、次のエラーメッセージが表示されました.ZipException:重複したエントリ:okhttp3/Address.class

私がデバッグモードでアプリケーションを実行すると、それはうまく動作します。

私のgradleビルドファイルに何か問題がありますか?

android { 

compileSdkVersion Integer.parseInt(COMPILE_SDK_VERSION) 
buildToolsVersion BUILD_TOOLS_VERSION 

defaultConfig { 
    applicationId "com.microsoft.office.sfb.sfbdemo" 
    minSdkVersion Integer.parseInt(MIN_SDK_VERSION) 
    targetSdkVersion Integer.parseInt(TARGET_SDK_VERSION) 
    versionCode 1 
    versionName "1.0" 
    multiDexEnabled true 
} 

compileOptions { 
    sourceCompatibility JavaVersion.VERSION_1_7 
    targetCompatibility JavaVersion.VERSION_1_7 
} 

buildTypes { 
    debug { 
     minifyEnabled false 
     debuggable true 
     jniDebuggable true 
    } 
    release { 
     debuggable false 
    } 
} 

packagingOptions { 
    exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties' 
    exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.xml' 
    exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties' 
    exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml' 
    exclude 'META-INF/DEPENDENCIES' 
    exclude 'META-INF/LICENSE.txt' 
    exclude 'META-INF/NOTICE.txt' 
    exclude 'META-INF/NOTICE' 
    exclude 'META-INF/LICENSE' 
    exclude 'META-INF/MSFTSIG.RSA' 
    exclude 'META-INF/BCKEY.DSA' 
    exclude 'META-INF/BCKEY.SF' 
    exclude 'META-INF/MSFTSIG.SF' 
} 

dexOptions { 
    preDexLibraries false 
    jumboMode true 
    incremental true 
    javaMaxHeapSize "4g" 
} 
} 

dependencies { 

    compile fileTree(include: ['*.jar'], dir: 'libs') 

    testCompile 'junit:junit:4.12' 

    compile(name: "libucmp", ext: 'aar') 
    compile(name: "platform", ext: 'aar') 
    compile(name: "injector", ext: 'aar') 
    compile(name: "SkypeForBusiness", ext: 'aar') 
    compile(name: "ucmp-enums", ext: 'aar') 
    compile(name: "TelemetryClient2", ext: 'aar') 
    compile(name: "TelemetryService", ext: 'aar') 
    compile(name: "android-database-sqlcipher", ext: 'aar') 

    compile "com.android.support:multidex:1.0.1" 
    compile 'com.google.code.gson:gson:2.6.2' 
    compile 'com.android.support:appcompat-v7:22.2.1' 
    compile 'com.android.support:design:22.2.1' 
    compile 'com.android.support:support-v4:22.2.1' 
    compile 'com.android.support:recyclerview-v7:22.2.1' 
    compile 'com.android.support:cardview-v7:22.2.1' 

    compile ('com.squareup.retrofit2:retrofit:2.1.0') { 
     exclude module: 'com.squareup.okio' 
    } 

    compile ('com.squareup.retrofit2:converter-gson:2.1.0') { 
     exclude module: 'com.squareup.okio' 
    } 
} 

のAndroid Studioでのメッセージのリスト:

Information:Gradle tasks [:sfbdemo:assembleDebug] 
:sfbdemo:preBuild UP-TO-DATE 
:sfbdemo:preDebugBuild UP-TO-DATE 
:sfbdemo:checkDebugManifest 
:sfbdemo:preReleaseBuild UP-TO-DATE 
:sfbdemo:prepareAndroidDatabaseSqlcipherLibrary UP-TO-DATE 
:sfbdemo:prepareComAndroidSupportAppcompatV72221Library UP-TO-DATE 
:sfbdemo:prepareComAndroidSupportCardviewV72221Library UP-TO-DATE 
:sfbdemo:prepareComAndroidSupportDesign2221Library UP-TO-DATE 
:sfbdemo:prepareComAndroidSupportMultidex101Library UP-TO-DATE 
:sfbdemo:prepareComAndroidSupportRecyclerviewV72221Library UP-TO-DATE 
:sfbdemo:prepareComAndroidSupportSupportV42221Library UP-TO-DATE 
:sfbdemo:prepareInjectorLibrary UP-TO-DATE 
:sfbdemo:prepareLibucmpLibrary UP-TO-DATE 
:sfbdemo:preparePlatformLibrary UP-TO-DATE 
:sfbdemo:prepareSkypeForBusinessLibrary UP-TO-DATE 
:sfbdemo:prepareTelemetryClient2Library UP-TO-DATE 
:sfbdemo:prepareTelemetryServiceLibrary UP-TO-DATE 
:sfbdemo:prepareUcmpEnumsLibrary UP-TO-DATE 
:sfbdemo:prepareDebugDependencies 
:sfbdemo:compileDebugAidl UP-TO-DATE 
:sfbdemo:compileDebugRenderscript UP-TO-DATE 
:sfbdemo:generateDebugBuildConfig UP-TO-DATE 
:sfbdemo:mergeDebugShaders UP-TO-DATE 
:sfbdemo:compileDebugShaders UP-TO-DATE 
:sfbdemo:generateDebugAssets UP-TO-DATE 
:sfbdemo:mergeDebugAssets UP-TO-DATE 
:sfbdemo:generateDebugResValues UP-TO-DATE 
:sfbdemo:generateDebugResources UP-TO-DATE 
:sfbdemo:mergeDebugResources UP-TO-DATE 
:sfbdemo:processDebugManifest UP-TO-DATE 
:sfbdemo:processDebugResources UP-TO-DATE 
:sfbdemo:generateDebugSources UP-TO-DATE 
:sfbdemo:incrementalDebugJavaCompilationSafeguard UP-TO-DATE 
:sfbdemo:compileDebugJavaWithJavac UP-TO-DATE 
:sfbdemo:compileDebugNdk UP-TO-DATE 
:sfbdemo:compileDebugSources UP-TO-DATE 
:sfbdemo:prePackageMarkerForDebug 
:sfbdemo:transformClassesWithJarMergingForDebug FAILED 
Error:Execution failed for task ':sfbdemo:transformClassesWithJarMergingForDebug'. 
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: okhttp3/Address.class 
Information:BUILD FAILED 
Information:Total time: 3.576 secs 
Information:1 error 
Information:0 warnings 
Information:See complete output in console 

を私はまた、Gradleのタスクsfddemoを実行します。依存関係とビルドが成功しました。しかし、私はまだAPKを構築することはできません。

依存関係のリスト:

$ gradle :sfbdemo:dependencies 
Incremental java compilation is an incubating feature. 
:sfbdemo:dependencies 

------------------------------------------------------------ 
Project :sfbdemo 
------------------------------------------------------------ 

_debugAndroidTestApk - ## Internal use, do not manually configure ## 
\--- com.android.support:multidex-instrumentation:1.0.1 
    \--- com.android.support:multidex:1.0.1 

_debugAndroidTestCompile - ## Internal use, do not manually configure ## 
\--- com.android.support:multidex-instrumentation:1.0.1 
    \--- com.android.support:multidex:1.0.1 

_debugApk - ## Internal use, do not manually configure ## 
+--- com.android.support:multidex:1.0.1 
+--- :libucmp: 
+--- :platform: 
+--- :injector: 
+--- :SkypeForBusiness: 
+--- :ucmp-enums: 
+--- :TelemetryClient2: 
+--- :TelemetryService: 
+--- :android-database-sqlcipher: 
+--- com.google.code.gson:gson:2.6.2 -> 2.7 
+--- com.android.support:appcompat-v7:22.2.1 
| \--- com.android.support:support-v4:22.2.1 
|   \--- com.android.support:support-annotations:22.2.1 
+--- com.android.support:design:22.2.1 
| +--- com.android.support:appcompat-v7:22.2.1 (*) 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:recyclerview-v7:22.2.1 
| +--- com.android.support:support-annotations:22.2.1 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:cardview-v7:22.2.1 
+--- com.squareup.retrofit2:retrofit:2.1.0 
| \--- com.squareup.okhttp3:okhttp:3.3.0 
|   \--- com.squareup.okio:okio:1.8.0 
\--- com.squareup.retrofit2:converter-gson:2.1.0 
    +--- com.squareup.retrofit2:retrofit:2.1.0 (*) 
    \--- com.google.code.gson:gson:2.7 

_debugCompile - ## Internal use, do not manually configure ## 
+--- com.android.support:multidex:1.0.1 
+--- :libucmp: 
+--- :platform: 
+--- :injector: 
+--- :SkypeForBusiness: 
+--- :ucmp-enums: 
+--- :TelemetryClient2: 
+--- :TelemetryService: 
+--- :android-database-sqlcipher: 
+--- com.google.code.gson:gson:2.6.2 -> 2.7 
+--- com.android.support:appcompat-v7:22.2.1 
| \--- com.android.support:support-v4:22.2.1 
|   \--- com.android.support:support-annotations:22.2.1 
+--- com.android.support:design:22.2.1 
| +--- com.android.support:appcompat-v7:22.2.1 (*) 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:recyclerview-v7:22.2.1 
| +--- com.android.support:support-annotations:22.2.1 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:cardview-v7:22.2.1 
+--- com.squareup.retrofit2:retrofit:2.1.0 
| \--- com.squareup.okhttp3:okhttp:3.3.0 
|   \--- com.squareup.okio:okio:1.8.0 
\--- com.squareup.retrofit2:converter-gson:2.1.0 
    +--- com.squareup.retrofit2:retrofit:2.1.0 (*) 
    \--- com.google.code.gson:gson:2.7 

_debugUnitTestApk - ## Internal use, do not manually configure ## 
\--- junit:junit:4.12 
    \--- org.hamcrest:hamcrest-core:1.3 

_debugUnitTestCompile - ## Internal use, do not manually configure ## 
\--- junit:junit:4.12 
    \--- org.hamcrest:hamcrest-core:1.3 

_releaseApk - ## Internal use, do not manually configure ## 
+--- com.android.support:multidex:1.0.1 
+--- :libucmp: 
+--- :platform: 
+--- :injector: 
+--- :SkypeForBusiness: 
+--- :ucmp-enums: 
+--- :TelemetryClient2: 
+--- :TelemetryService: 
+--- :android-database-sqlcipher: 
+--- com.google.code.gson:gson:2.6.2 -> 2.7 
+--- com.android.support:appcompat-v7:22.2.1 
| \--- com.android.support:support-v4:22.2.1 
|   \--- com.android.support:support-annotations:22.2.1 
+--- com.android.support:design:22.2.1 
| +--- com.android.support:appcompat-v7:22.2.1 (*) 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:recyclerview-v7:22.2.1 
| +--- com.android.support:support-annotations:22.2.1 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:cardview-v7:22.2.1 
+--- com.squareup.retrofit2:retrofit:2.1.0 
| \--- com.squareup.okhttp3:okhttp:3.3.0 
|   \--- com.squareup.okio:okio:1.8.0 
\--- com.squareup.retrofit2:converter-gson:2.1.0 
    +--- com.squareup.retrofit2:retrofit:2.1.0 (*) 
    \--- com.google.code.gson:gson:2.7 

_releaseCompile - ## Internal use, do not manually configure ## 
+--- com.android.support:multidex:1.0.1 
+--- :libucmp: 
+--- :platform: 
+--- :injector: 
+--- :SkypeForBusiness: 
+--- :ucmp-enums: 
+--- :TelemetryClient2: 
+--- :TelemetryService: 
+--- :android-database-sqlcipher: 
+--- com.google.code.gson:gson:2.6.2 -> 2.7 
+--- com.android.support:appcompat-v7:22.2.1 
| \--- com.android.support:support-v4:22.2.1 
|   \--- com.android.support:support-annotations:22.2.1 
+--- com.android.support:design:22.2.1 
| +--- com.android.support:appcompat-v7:22.2.1 (*) 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:recyclerview-v7:22.2.1 
| +--- com.android.support:support-annotations:22.2.1 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:cardview-v7:22.2.1 
+--- com.squareup.retrofit2:retrofit:2.1.0 
| \--- com.squareup.okhttp3:okhttp:3.3.0 
|   \--- com.squareup.okio:okio:1.8.0 
\--- com.squareup.retrofit2:converter-gson:2.1.0 
    +--- com.squareup.retrofit2:retrofit:2.1.0 (*) 
    \--- com.google.code.gson:gson:2.7 

_releaseUnitTestApk - ## Internal use, do not manually configure ## 
\--- junit:junit:4.12 
    \--- org.hamcrest:hamcrest-core:1.3 

_releaseUnitTestCompile - ## Internal use, do not manually configure ## 
\--- junit:junit:4.12 
    \--- org.hamcrest:hamcrest-core:1.3 

androidJacocoAgent - The Jacoco agent to use to get coverage data. 
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.agent/0.7.6.201602                                                180812/org.jacoco.agent-0.7.6.201602180812.pom 
\--- org.jacoco:org.jacoco.agent:0.7.6.201602180812 

androidJacocoAnt - The Jacoco ant tasks to use to get execute Gradle tasks. 
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.ant/0.7.6.20160218                                                0812/org.jacoco.ant-0.7.6.201602180812.pom 
Download https://repo1.maven.org/maven2/org/jacoco/org.jacoco.report/0.7.6.20160                                                2180812/org.jacoco.report-0.7.6.201602180812.pom 
\--- org.jacoco:org.jacoco.ant:0.7.6.201602180812 
    +--- org.jacoco:org.jacoco.core:0.7.6.201602180812 
    | \--- org.ow2.asm:asm-debug-all:5.0.4 
    +--- org.jacoco:org.jacoco.report:0.7.6.201602180812 
    | +--- org.jacoco:org.jacoco.core:0.7.6.201602180812 (*) 
    | \--- org.ow2.asm:asm-debug-all:5.0.4 
    \--- org.jacoco:org.jacoco.agent:0.7.6.201602180812 

androidTestApk - Classpath packaged with the compiled 'androidTest' classes. 
No dependencies 

androidTestCompile - Classpath for compiling the androidTest sources. 
No dependencies 

androidTestProvided - Classpath for only compiling the androidTest sources. 
No dependencies 

androidTestWearApp - Link to a wear app to embed for object 'androidTest'. 
No dependencies 

apk - Classpath packaged with the compiled 'main' classes. 
No dependencies 

archives - Configuration for archive artifacts. 
No dependencies 

compile - Classpath for compiling the main sources. 
+--- :libucmp: 
+--- :platform: 
+--- :injector: 
+--- :SkypeForBusiness: 
+--- :ucmp-enums: 
+--- :TelemetryClient2: 
+--- :TelemetryService: 
+--- :android-database-sqlcipher: 
+--- com.android.support:multidex:1.0.1 
+--- com.google.code.gson:gson:2.6.2 -> 2.7 
+--- com.android.support:appcompat-v7:22.2.1 
| \--- com.android.support:support-v4:22.2.1 
|   \--- com.android.support:support-annotations:22.2.1 
+--- com.android.support:design:22.2.1 
| +--- com.android.support:appcompat-v7:22.2.1 (*) 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:recyclerview-v7:22.2.1 
| +--- com.android.support:support-annotations:22.2.1 
| \--- com.android.support:support-v4:22.2.1 (*) 
+--- com.android.support:cardview-v7:22.2.1 
+--- com.squareup.retrofit2:retrofit:2.1.0 
| \--- com.squareup.okhttp3:okhttp:3.3.0 
|   \--- com.squareup.okio:okio:1.8.0 
\--- com.squareup.retrofit2:converter-gson:2.1.0 
    +--- com.squareup.retrofit2:retrofit:2.1.0 (*) 
    \--- com.google.code.gson:gson:2.7 

debugApk - Classpath packaged with the compiled 'debug' classes. 
No dependencies 

debugCompile - Classpath for compiling the debug sources. 
No dependencies 

debugProvided - Classpath for only compiling the debug sources. 
No dependencies 

debugWearApp - Link to a wear app to embed for object 'debug'. 
No dependencies 

default - Configuration for default artifacts. 
No dependencies 

default-mapping - Configuration for default mapping artifacts. 
No dependencies 

default-metadata - Metadata for the produced APKs. 
No dependencies 

findbugs - The FindBugs libraries to be used for this project. 
No dependencies 

findbugsPlugins - The FindBugs plugins to be used for this project. 
No dependencies 

provided - Classpath for only compiling the main sources. 
No dependencies 

releaseApk - Classpath packaged with the compiled 'release' classes. 
No dependencies 

releaseCompile - Classpath for compiling the release sources. 
No dependencies 

releaseProvided - Classpath for only compiling the release sources. 
No dependencies 

releaseWearApp - Link to a wear app to embed for object 'release'. 
No dependencies 

testApk - Classpath packaged with the compiled 'test' classes. 
No dependencies 

testCompile - Classpath for compiling the test sources. 
\--- junit:junit:4.12 
    \--- org.hamcrest:hamcrest-core:1.3 

testDebugApk - Classpath packaged with the compiled 'testDebug' classes. 
No dependencies 

testDebugCompile - Classpath for compiling the testDebug sources. 
No dependencies 

testDebugProvided - Classpath for only compiling the testDebug sources. 
No dependencies 

testDebugWearApp - Link to a wear app to embed for object 'testDebug'. 
No dependencies 

testProvided - Classpath for only compiling the test sources. 
No dependencies 

testReleaseApk - Classpath packaged with the compiled 'testRelease' classes. 
No dependencies 

testReleaseCompile - Classpath for compiling the testRelease sources. 
No dependencies 

testReleaseProvided - Classpath for only compiling the testRelease sources. 
No dependencies 

testReleaseWearApp - Link to a wear app to embed for object 'testRelease'. 
No dependencies 

testWearApp - Link to a wear app to embed for object 'test'. 
No dependencies 

wearApp - Link to a wear app to embed for object 'main'. 
No dependencies 

BUILD SUCCESSFUL 

Total time: 4.811 secs 
+0

コンパイル 'com.squareup.retrofit2:retrofit:2.1.0'、 コンパイル 'com.squareup.retrofit2:converter-gson:2.1.0'をコンパイルして、packagingOptions {...}を削除する最初の2行 – Vadivel

+0

完全なログを投稿できますか? – Raghavendra

+2

gradleタスク ':app:dependencies'を実行して、複製がどこから来ているかを確認します。 –

答えて

0

が、私はようやく私の質問への解決策を見つけました。インターネットで長年検索したところ、私は次のような解決策に遭遇しました。私はそれぞれの「コンパイル」行をコメントに入れて、すべてが機能しているかどうかを確認するためにプロジェクトを再構築します。

問題の原因となったコードが見つかるまで、このプロセスを繰り返し続けました。次のコード行で問題が発生していることが判明しました。

私はこれがあなた自身の問題を解決するのに役立つことを願っています。 :)

関連する問題