CocosCreator SDKBox (play and facebook) compile error

Hi,
Im having compile error when I install both sdkbox facebook and play from sdkbox gui. Its a weird behavior, if I only install one from either of them, everything works fine, however if both goes together, it causes compile error.

Warning: Exception while processing task java.io.IOException: Can't write [/Users/sample/Documents/cocos_demo/NewProject_6/build/jsb-link/frameworks/runtime-src/proj.android-studio/app/build/intermediates/transforms/proguard/release/0.jar] (Can't read [/Users/sample/.gradle/caches/transforms-1/files-1.1/support-compat-27.0.2.aar/7a12062a54c85fe015d38f81096f4bb0/jars/classes.jar(;;;;;;;**.class)] (Duplicate jar entry [android/support/v4/os/b$a$a.class]))
Thread(Tasks limiter_17): destruction

> Task :hello_world:transformClassesAndResourcesWithProguardForRelease FAILED
:hello_world:transformClassesAndResourcesWithProguardForRelease (Thread[Daemon worker Thread 55,5,main]) completed. Took 12.905 secs.
51 actionable tasks: 15 executed, 36 up-to-date
AAPT2 aapt2-3.2.0-4818971-osx Daemon #0: shutdown
AAPT2 aapt2-3.2.0-4818971-osx Daemon #1: shutdown

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':hello_world:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details

Im using cocoscreator 2.1.1. To replicate the issue, simply install sdkbox play and sdkbox facebook then compile on android.

Any help would be appreciated.

We can ask @yinjimmy to provide advice.

plz add

android.useAndroidX=true
android.enableJetifier=true

to

build/jsb-link/frameworks/runtime-src/proj.android-studio/gradle.properties

Hi @yinjimmy, I used this solution as well and it’s working, found some where in stackoverflow.

However, May I know what’s the explanation of this? Is it some sort of hack just to pass by the issue? I’m just worried there could be overhead behind the scene as this issue only happens when I install 2 or more sdk plugins. Maybe there’s a duplication happening and could compromise the performance in the future?

Thanks for all the help btw.

check dependencies

 ./gradlew hello_world:dependencies



> Configure project :hello_world
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Observed package id 'build-tools;19.0.3' in inconsistent location '/Users/admin/Documents/sdk/android/android-sdk-macosx/build-tools/android-4.4.2' (Expected '/Users/admin/Documents/sdk/android/android-sdk-macosx/build-tools/19.0.3')
Observed package id 'tools' in inconsistent location '/Users/admin/Documents/sdk/android/android-sdk-macosx/tools.new' (Expected '/Users/admin/Documents/sdk/android/android-sdk-macosx/tools')
Already observed package id 'tools' in '/Users/admin/Documents/sdk/android/android-sdk-macosx/tools'. Skipping duplicate at '/Users/admin/Documents/sdk/android/android-sdk-macosx/tools.new'
Observed package id 'tools' in inconsistent location '/Users/admin/Documents/sdk/android/android-sdk-macosx/toolsb' (Expected '/Users/admin/Documents/sdk/android/android-sdk-macosx/tools')
Already observed package id 'tools' in '/Users/admin/Documents/sdk/android/android-sdk-macosx/tools'. Skipping duplicate at '/Users/admin/Documents/sdk/android/android-sdk-macosx/toolsb'

> Task :hello_world:dependencies

------------------------------------------------------------
Project :hello_world
------------------------------------------------------------

_internal_aapt2_binary - The AAPT2 binary to use for processing resources.
\--- com.android.tools.build:aapt2:3.2.0-4818971

androidApis - Configuration providing various types of Android JAR file
No dependencies

androidTestAnnotationProcessor - Classpath for the annotation processor for 'androidTest'. (n)
No dependencies

androidTestApi - API dependencies for 'androidTest' sources. (n)
No dependencies

androidTestApk - Apk dependencies for 'androidTest' sources (deprecated: use 'androidTestRuntimeOnly' instead). (n)
No dependencies

androidTestCompile - Compile dependencies for 'androidTest' sources (deprecated: use 'androidTestImplementation' instead). (n)
No dependencies

androidTestCompileOnly - Compile only dependencies for 'androidTest' sources. (n)
No dependencies

androidTestDebugAnnotationProcessor - Classpath for the annotation processor for 'androidTestDebug'. (n)
No dependencies

androidTestDebugApi - API dependencies for 'androidTestDebug' sources. (n)
No dependencies

androidTestDebugApk - Apk dependencies for 'androidTestDebug' sources (deprecated: use 'androidTestDebugRuntimeOnly' instead). (n)
No dependencies

androidTestDebugCompile - Compile dependencies for 'androidTestDebug' sources (deprecated: use 'androidTestDebugImplementation' instead). (n)
No dependencies

androidTestDebugCompileOnly - Compile only dependencies for 'androidTestDebug' sources. (n)
No dependencies

androidTestDebugImplementation - Implementation only dependencies for 'androidTestDebug' sources. (n)
No dependencies

androidTestDebugProvided - Provided dependencies for 'androidTestDebug' sources (deprecated: use 'androidTestDebugCompileOnly' instead). (n)
No dependencies

androidTestDebugRuntimeOnly - Runtime only dependencies for 'androidTestDebug' sources. (n)
No dependencies

androidTestDebugWearApp - Link to a wear app to embed for object 'androidTestDebug'. (n)
No dependencies

androidTestImplementation - Implementation only dependencies for 'androidTest' sources. (n)
No dependencies

androidTestProvided - Provided dependencies for 'androidTest' sources (deprecated: use 'androidTestCompileOnly' instead). (n)
No dependencies

androidTestRuntimeOnly - Runtime only dependencies for 'androidTest' sources. (n)
No dependencies

androidTestUtil - Additional APKs used during instrumentation testing.
No dependencies

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

annotationProcessor - Classpath for the annotation processor for 'main'. (n)
No dependencies

api - API dependencies for 'main' sources. (n)
No dependencies

apk - Apk dependencies for 'main' sources (deprecated: use 'runtimeOnly' instead). (n)
No dependencies

archives - Configuration for archive artifacts.
No dependencies

compile - Compile dependencies for 'main' sources (deprecated: use 'implementation' instead).
+--- com.google.android.gms:play-services-base:16.0.0 -> 17.0.0
|    +--- androidx.collection:collection:1.0.0
|    |    \--- androidx.annotation:annotation:1.0.0
|    +--- androidx.core:core:1.0.0
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0
|    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.arch.core:core-common:2.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    \--- androidx.versionedparcelable:versionedparcelable:1.0.0
|    |         +--- androidx.annotation:annotation:1.0.0
|    |         \--- androidx.collection:collection:1.0.0 (*)
|    +--- androidx.fragment:fragment:1.0.0
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    +--- androidx.legacy:legacy-support-core-ui:1.0.0
|    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    +--- androidx.documentfile:documentfile:1.0.0
|    |    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.loader:loader:1.0.0
|    |    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0
|    |    |    |    |    |    +--- androidx.arch.core:core-runtime:2.0.0
|    |    |    |    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|    |    |    |    |    |    +--- androidx.lifecycle:lifecycle-livedata-core:2.0.0
|    |    |    |    |    |    |    +--- androidx.lifecycle:lifecycle-common:2.0.0 (*)
|    |    |    |    |    |    |    +--- androidx.arch.core:core-common:2.0.0 (*)
|    |    |    |    |    |    |    \--- androidx.arch.core:core-runtime:2.0.0 (*)
|    |    |    |    |    |    \--- androidx.arch.core:core-common:2.0.0 (*)
|    |    |    |    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0
|    |    |    |    |         \--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.localbroadcastmanager:localbroadcastmanager:1.0.0
|    |    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    |    \--- androidx.print:print:1.0.0
|    |    |    |         \--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.customview:customview:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    \--- androidx.core:core:1.0.0 (*)
|    |    |    +--- androidx.viewpager:viewpager:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    |    +--- androidx.coordinatorlayout:coordinatorlayout:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    |    +--- androidx.drawerlayout:drawerlayout:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    |    +--- androidx.slidingpanelayout:slidingpanelayout:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    \--- androidx.customview:customview:1.0.0 (*)
|    |    |    +--- androidx.interpolator:interpolator:1.0.0
|    |    |    |    \--- androidx.annotation:annotation:1.0.0
|    |    |    +--- androidx.swiperefreshlayout:swiperefreshlayout:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    +--- androidx.core:core:1.0.0 (*)
|    |    |    |    \--- androidx.interpolator:interpolator:1.0.0 (*)
|    |    |    +--- androidx.asynclayoutinflater:asynclayoutinflater:1.0.0
|    |    |    |    +--- androidx.annotation:annotation:1.0.0
|    |    |    |    \--- androidx.core:core:1.0.0 (*)
|    |    |    \--- androidx.cursoradapter:cursoradapter:1.0.0
|    |    |         \--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.legacy:legacy-support-core-utils:1.0.0 (*)
|    |    +--- androidx.annotation:annotation:1.0.0
|    |    +--- androidx.loader:loader:1.0.0 (*)
|    |    \--- androidx.lifecycle:lifecycle-viewmodel:2.0.0 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- androidx.core:core:1.0.0 (*)
|    |    \--- androidx.fragment:fragment:1.0.0 (*)
|    \--- com.google.android.gms:play-services-tasks:17.0.0
|         \--- com.google.android.gms:play-services-basement:17.0.0 (*)
+--- com.google.android.gms:play-services-auth:17.0.0
|    +--- androidx.fragment:fragment:1.0.0 (*)
|    +--- androidx.loader:loader:1.0.0 (*)
|    +--- com.google.android.gms:play-services-auth-api-phone:17.0.0
|    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    +--- com.google.android.gms:play-services-auth-base:17.0.0
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
+--- com.google.android.gms:play-services-games:19.0.0
|    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    +--- com.google.android.gms:play-services-drive:17.0.0
|    |    +--- androidx.collection:collection:1.0.0 (*)
|    |    +--- com.google.android.gms:play-services-base:17.0.0 (*)
|    |    +--- com.google.android.gms:play-services-basement:17.0.0 (*)
|    |    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
|    \--- com.google.android.gms:play-services-tasks:17.0.0 (*)
+--- com.google.android.gms:play-services-drive:17.0.0 (*)
\--- com.facebook.android:facebook-android-sdk:[5,6) -> 5.15.3
     +--- com.facebook.android:facebook-core:5.15.3
     |    +--- com.parse.bolts:bolts-android:1.4.0
     |    |    +--- com.parse.bolts:bolts-tasks:1.4.0
     |    |    \--- com.parse.bolts:bolts-applinks:1.4.0
     |    |         \--- com.parse.bolts:bolts-tasks:1.4.0
     |    +--- com.android.support:support-annotations:27.0.2
     |    +--- com.android.support:support-core-utils:27.0.2
     |    |    +--- com.android.support:support-annotations:27.0.2
     |    |    \--- com.android.support:support-compat:27.0.2
     |    |         +--- com.android.support:support-annotations:27.0.2
     |    |         \--- android.arch.lifecycle:runtime:1.0.3
     |    |              +--- android.arch.lifecycle:common:1.0.3
     |    |              \--- android.arch.core:common:1.0.0
     |    \--- com.android.installreferrer:installreferrer:1.0
     +--- com.facebook.android:facebook-common:5.15.3
     |    +--- com.facebook.android:facebook-core:5.15.3 (*)
     |    +--- com.android.support:support-v4:27.0.2
     |    |    +--- com.android.support:support-compat:27.0.2 (*)
     |    |    +--- com.android.support:support-media-compat:27.0.2
     |    |    |    +--- com.android.support:support-annotations:27.0.2
     |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
     |    |    +--- com.android.support:support-core-utils:27.0.2 (*)
     |    |    +--- com.android.support:support-core-ui:27.0.2
     |    |    |    +--- com.android.support:support-annotations:27.0.2
     |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
     |    |    \--- com.android.support:support-fragment:27.0.2
     |    |         +--- com.android.support:support-compat:27.0.2 (*)
     |    |         +--- com.android.support:support-core-ui:27.0.2 (*)
     |    |         +--- com.android.support:support-core-utils:27.0.2 (*)
     |    |         \--- com.android.support:support-annotations:27.0.2
     |    +--- com.android.support:appcompat-v7:27.0.2
     |    |    +--- com.android.support:support-annotations:27.0.2
     |    |    +--- com.android.support:support-core-utils:27.0.2 (*)
     |    |    +--- com.android.support:support-fragment:27.0.2 (*)
     |    |    +--- com.android.support:support-vector-drawable:27.0.2
     |    |    |    +--- com.android.support:support-annotations:27.0.2
     |    |    |    \--- com.android.support:support-compat:27.0.2 (*)
     |    |    \--- com.android.support:animated-vector-drawable:27.0.2
     |    |         +--- com.android.support:support-vector-drawable:27.0.2 (*)
     |    |         \--- com.android.support:support-core-ui:27.0.2 (*)
     |    +--- com.android.support:cardview-v7:27.0.2
     |    |    \--- com.android.support:support-annotations:27.0.2
     |    +--- com.android.support:customtabs:27.0.2
     |    |    +--- com.android.support:support-compat:27.0.2 (*)
     |    |    \--- com.android.support:support-annotations:27.0.2
     |    \--- com.google.zxing:core:3.3.3
     +--- com.facebook.android:facebook-login:5.15.3
     |    +--- com.facebook.android:facebook-core:5.15.3 (*)
     |    +--- com.facebook.android:facebook-common:5.15.3 (*)
     |    \--- com.android.support:appcompat-v7:27.0.2 (*)
     +--- com.facebook.android:facebook-share:5.15.3
     |    +--- com.facebook.android:facebook-core:5.15.3 (*)
     |    +--- com.facebook.android:facebook-common:5.15.3 (*)
     |    \--- com.android.support:appcompat-v7:27.0.2 (*)
     +--- com.facebook.android:facebook-places:5.15.3
     |    \--- com.facebook.android:facebook-core:5.15.3 (*)
     +--- com.facebook.android:facebook-applinks:5.15.3
     |    +--- com.facebook.android:facebook-core:5.15.3 (*)
     |    +--- com.parse.bolts:bolts-android:1.4.0 (*)
     |    +--- com.android.support:support-annotations:27.0.2
     |    \--- com.android.support:support-core-utils:27.0.2 (*)
     \--- com.facebook.android:facebook-messenger:5.15.3
          +--- com.facebook.android:facebook-core:5.15.3 (*)
          \--- com.parse.bolts:bolts-android:1.4.0 (*)


sdkboxplay: use androidx
facebook: use com.android.support:appcompat-v7:27.0.2

solution from https://stackoverflow.com/a/51263999/5443510