sdkbox / issues

The issue tracker for SDKBOX
MIT License
4 stars 0 forks source link

FireBase integration cause the build to fail #40

Closed hussain-sohaib closed 6 years ago

hussain-sohaib commented 6 years ago

We have sdkbox included in our project (review, google analytics, IAP, facebook, adcolony).

we now need to implement push notification in our project and we added firebase for that. we followed the instructions on the link below from google.

https://firebase.google.com/docs/android/setup https://firebase.google.com/docs/cloud-messaging/android/client

our app/build.gradle dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':libcocos2dx')
implementation 'com.google.firebase:firebase-messaging:11.8.0'

}

//at the end apply plugin: 'com.google.gms.google-services'

our proj.android-studio/build.gradle

dependencies { classpath 'com.android.tools.build:gradle:3.0.1' classpath 'io.realm:realm-gradle-plugin:3.5.0' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files classpath 'com.google.gms:google-services:3.1.1' }

now when we build APK we get error

::transformDexWithDexForRelease FAILED

FAILURE: Build failed with an exception.

@yinjimmy please have a look. we need it asap.

Thanks

hugohuang1111 commented 6 years ago

firebase include google play service lib and sdkbox also provide a google play service(gps) lib,

just keep one.

hussain-sohaib commented 6 years ago

how we do it?

hugohuang1111 commented 6 years ago

you are using gradle, remove gps lib is better.

your app/build.gradle

dependencies {

compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':libcocos2dx')
implementation 'com.google.firebase:firebase-messaging:11.8.0'

//maybe need add this
implementation 'com.google.android.gms:play-services:11.8.0'

}
hussain-sohaib commented 6 years ago

now i get this error after the change you told

com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65536

hussain-sohaib commented 6 years ago

can you please do one thing make a sample project and add SKDBOX (review, google analytics, IAP, facebook, adcolony) and than add firebase using instructions on the link below from google.

https://firebase.google.com/docs/android/setup https://firebase.google.com/docs/cloud-messaging/android/client

and see if you can compile and generate a release apk.

hugohuang1111 commented 6 years ago
  1. method ID not in [0, 0xffff]: 65536, take a look at this
  2. ok, we will try.

btw, what's your cocos2d-x version

hussain-sohaib commented 6 years ago

Cocos2dx 3.14.1.

Its not the issue you are referring to. Its because of earlier issue. Multiple dependencies issues.

You guys should make a sample project and test. Please do it asap because this is happening in a live project and we need a solution fast.

Thanks

On Wed, 27 Dec 2017 at 14:42, hugo notifications@github.com wrote:

  1. method ID not in [0, 0xffff]: 65536, take a look at this http://docs.sdkbox.com/en/qa/android_64k/
  2. ok, we will try.

btw, what's your cocos2d-x version

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/sdkbox/issues/issues/40#issuecomment-354085697, or mute the thread https://github.com/notifications/unsubscribe-auth/ACC8g4oIuBQ64mL2rn1VgKcEcDUSNre1ks5tEhERgaJpZM4RNQ6J .

-- Best Regards Sohaib Hussain

hugohuang1111 commented 6 years ago

you can add this:

android {
    defaultConfig {
       multiDexEnabled true
    }
}

take a look at this:

app/build.gradle

android {
    compileSdkVersion 25
    buildToolsVersion '26.0.2'

    defaultConfig {
        ...
        minSdkVersion 15

        multiDexEnabled true
    }
    ...
}

dependencies {
    ...
    implementation 'com.google.firebase:firebase-core:11.8.0'
    implementation 'com.google.firebase:firebase-messaging:11.8.0'

    implementation 'com.google.android.gms:play-services:11.8.0'
}
hugohuang1111 commented 6 years ago

i didn't got 65536 issue, but got this:

Error:Execution failed for task ':cppTest314:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex

and i fixed it with the previous comment then i can compile success

hussain-sohaib commented 6 years ago

after doing what you have done I am getting

transformClassesWithJarMergingForRelease'.

com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/dynamite/descriptors/com/google/android/gms/tagmanager/ModuleDescriptor.class

can you please ask @yinjimmy or somebody else. we need to solve this issue asap.

hugohuang1111 commented 6 years ago

ok, let jimmy handle this.

ghost commented 6 years ago

@hussain-sohaib ,

Because facebook contains support-v4, plz try

android{
    configurations {
        all*.exclude group: 'com.android.support', module: 'support-v4'
        all*.exclude group: 'com.android.support', module: 'support-annotations'
    }
}

https://stackoverflow.com/a/39388746/5443510

Or import facebook with gradle

implementation 'com.facebook.android:facebook-android-sdk:[4,5)'
hussain-sohaib commented 6 years ago

Nope it did not work, Also please note we are also using realm, scroll to the top and check.

Please take the sample project from @hugohuang1111 and try to make this work your self first, please build for release build only.

ghost commented 6 years ago

https://github.com/yinjimmy/issue40

hussain-sohaib commented 6 years ago

Were you able to create apk? On Thu, 28 Dec 2017 at 15:26, Jimmy Yin notifications@github.com wrote:

https://github.com/yinjimmy/issue40

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sdkbox/issues/issues/40#issuecomment-354266316, or mute the thread https://github.com/notifications/unsubscribe-auth/ACC8g7z3Vg4EQr99AEwlW0OLXQ9PSBbbks5tE2zFgaJpZM4RNQ6J .

-- Best Regards Sohaib Hussain

ghost commented 6 years ago

yes, both debug and release mode.

hussain-sohaib commented 6 years ago

Finally got it to work! Thanks

Major point to note We need to comment compile gps line in libcocosdx/build.gradle

On Thu, 28 Dec 2017 at 19:05, Jimmy Yin notifications@github.com wrote:

yes, both debug and release mode.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sdkbox/issues/issues/40#issuecomment-354293375, or mute the thread https://github.com/notifications/unsubscribe-auth/ACC8g5CnagwdwXaqR_Ef5Miuwk4olDPlks5tE6AXgaJpZM4RNQ6J .

-- Best Regards Sohaib Hussain