Snapchat / creative-kit-sample

Sample Apps For Creative Kit
Other
141 stars 88 forks source link

Method addObserver must be called on the main thread: Android #43

Closed edpapyan902 closed 2 years ago

edpapyan902 commented 2 years ago

I'm going to build share to snapchat app with snapchat creative kit. But I can't run app. I've tested with creating new latest project, but same result. When I run example project in snapchat integration, it works well.

When I run app, I can't open.

https://github.com/nano5319/react-native-snapchat-share image I've followed all steps in document

It's error when I run app. image

ramanpreetSinghKhinda commented 2 years ago

This issue has been fixed internally and the fix for the same will be released soon.

To unblock you for now you can try this in your build.gradle file for Android:

configurations.all {
        resolutionStrategy { 
            force 'androidx.lifecycle:lifecycle-process:2.1.0'
        }
    }
edpapyan902 commented 2 years ago

I've done in ios part. It's my work video. https://drive.google.com/file/d/1H5jeEK7VfukZxVf466gfI7yI8VhhSdCj/view?usp=sharing

edpapyan902 commented 2 years ago

image In Android directory, build.gradle file looks like. Am I right? @ramanpreetSinghKhinda

edpapyan902 commented 2 years ago

`apply plugin: "com.android.application"

import com.android.build.OutputFile

/**

project.ext.react = [ enableHermes: false ]

apply from: '../../node_modules/react-native-unimodules/gradle.groovy' apply from: "../../node_modules/react-native/react.gradle" apply from: "../../node_modules/expo-constants/scripts/get-app-config-android.gradle" apply from: "../../node_modules/expo-updates/scripts/create-manifest-android.gradle"

/**

/**

/**

/**

android { compileSdkVersion rootProject.ext.compileSdkVersion

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId 'com.ydc.crowdshare'
    minSdkVersion rootProject.ext.minSdkVersion
    targetSdkVersion rootProject.ext.targetSdkVersion
    versionCode 2
    versionName "1.1"
    multiDexEnabled true
}
splits {
    abi {
        reset()
        enable enableSeparateBuildPerCPUArchitecture
        universalApk false  // If true, also generate a universal APK
        include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
    }
}
signingConfigs {
    debug {
        storeFile file('debug.keystore')
        storePassword 'android'
        keyAlias 'androiddebugkey'
        keyPassword 'android'
    }
}
buildTypes {
    debug {
        signingConfig signingConfigs.debug
    }
    release {
        // Caution! In production, you need to generate your own keystore file.
        // see https://reactnative.dev/docs/signed-apk-android.
        signingConfig signingConfigs.debug
        minifyEnabled enableProguardInReleaseBuilds
        proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
    }
}

// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
    variant.outputs.each { output ->
        // For each separate APK per architecture, set a unique version code as described here:
        // https://developer.android.com/studio/build/configure-apk-splits.html
        def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
        def abi = output.getFilter(OutputFile.ABI)
        if (abi != null) {  // null for the universal-debug, universal-release variants
            output.versionCodeOverride =
                    versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
        }

    }
}

}

configurations.all { resolutionStrategy { force 'androidx.lifecycle:lifecycle-process:2.1.0' } }

dependencies { implementation fileTree(dir: "libs", include: ["*.jar"])

implementation 'androidx.multidex:multidex:2.0.1'
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+"  // From node_modules
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
  exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
    exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
    exclude group:'com.facebook.flipper'
}
addUnimodulesDependencies()

if (enableHermes) {
    def hermesPath = "../../node_modules/hermes-engine/android/";
    debugImplementation files(hermesPath + "hermes-debug.aar")
    releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
    implementation jscFlavor
}

}

// Run this once to be able to run the application with BUCK // puts all compile dependencies into folder libs for BUCK to use task copyDownloadableDepsToLibs(type: Copy) { from configurations.compile into 'libs' }

apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

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

// Photo & Video Editor apply plugin: 'ly.img.android.sdk' apply plugin: 'kotlin-android'

imglyConfig { modules { include 'ui:text' include 'ui:focus' include 'ui:frame' include 'ui:brush' include 'ui:filter' include 'ui:sticker' include 'ui:overlay' include 'ui:transform' include 'ui:adjustment' include 'ui:text-design' // For only video editor include 'ui:video-trim' include 'ui:video-library' include 'ui:video-composition' include 'ui:audio-composition'

    // This module is big, remove the serializer if you don't need that feature.
    include 'backend:serializer'

    // Remove the asset packs you don't need, these are also big in size.
    include 'assets:font-basic'
    include 'assets:frame-basic'
    include 'assets:filter-basic'
    include 'assets:overlay-basic'
    include 'assets:sticker-shapes'
    include 'assets:sticker-emoticons'

    include 'assets:sticker-animated'

    include 'backend:sticker-animated'
    include 'backend:sticker-smart'
}

} ` It's my android directory build.gradle file. I've tried, but I got same error. @ramanpreetSinghKhinda

filipef101 commented 2 years ago

configurations.all might be in the wrong place, try above android

edpapyan902 commented 2 years ago

image Like this?@filipef101

filipef101 commented 2 years ago

give it a shot

edpapyan902 commented 2 years ago

I've just tried, but got same error. @ramanpreetSinghKhinda @filipef101

edpapyan902 commented 2 years ago

This issue has been fixed internally and the fix for the same will be released soon.

To unblock you for now you can try this in your build.gradle file for Android:

configurations.all {
        resolutionStrategy { 
            force 'androidx.lifecycle:lifecycle-process:2.1.0'
        }
    }

I think it's not affected to me.

edpapyan902 commented 2 years ago

Is there any other solution? @ramanpreetSinghKhinda

edpapyan902 commented 2 years ago

image I saw Android sdk is upgraded. But react-native module has not been updated. When are you going to update it? @ramanpreetSinghKhinda

batuhankerimtr commented 2 years ago

Still haven't found a solution for this error? I'm getting the same error.

edpapyan902 commented 2 years ago

This issue was fixed on new version. Thanks for your updating