Closed burakakyol closed 1 year ago
Hi @burakakyol you can remove the play core dependency module from dengage library
for help you can consult these links :
I was able to exclude it like that
implementation(project(':dengage-tech_react-native-dengage')) {
exclude group: 'com.google.android.play', module:'core'
}
but com.google.android.play:core library is deprecated you need to migrate new versions
hi @AuroPick glad it worked for you...
regarding the dependency upgradation... we will update it in future
thanks
Thank you for your responses.
I tried some solutions to exclude them, but none worked for me except a workaround. As far as I understand, the problem isn't directly related to dengage SDK. Because whenever I excluded these libraries for all, the problem was solved.
This solution didn't work for me. @AuroPick Can you check the following code? Is there any mistake with the implementation?
implementation('com.github.dengage-tech:dengage-android-sdk:6.0.38.2') {
exclude group: 'com.google.android.play', module: 'core-common'
exclude group: 'com.google.android.play', module: 'core'
}
Workaround solution
configurations {
all*.exclude group: 'com.google.android.play', module: 'core-common'
all*.exclude group: 'com.google.android.play', module: 'core'
}
Thank you
implementation('com.github.dengage-tech:dengage-android-sdk:6.0.38.2') { exclude group: 'com.google.android.play', module: 'core-common' exclude group: 'com.google.android.play', module: 'core' }
I tried this too but it is not working you need to do this
implementation(project(':dengage-tech_react-native-dengage')) {
exclude group: 'com.google.android.play', module:'core'
}
instead this
implementation('com.github.dengage-tech:dengage-android-sdk:6.0.38.2') {
exclude group: 'com.google.android.play', module: 'core-common'
exclude group: 'com.google.android.play', module: 'core'
}
Also if you are not sure that only com.github.dengage-tech:dengage-android-sdk:6.0.38.2 is using com.google.android.play:core you can run this code in android folder
./gradlew app:dependencies
Hi @AuroPick , Can you elaborate on your implementation? I've just implemented your comment, however, the package wasn't installed. Do you store the engage library in your local?
app/build.gradle
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation(project(':dengage-tech_react-native-dengage')) {
exclude group: 'com.google.android.play', module:'core'
}
If I specify like this, Gradle throws the error that says dengage SDK is not found.
No I don't can you share your all build.gradle and app/build.gradle
These are mine
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "33.0.0"
minSdkVersion = 23
compileSdkVersion = 33
targetSdkVersion = 33
kotlin_version = '1.6.10'
kotlinVersion = '1.6.10'
// We use NDK 23 which has both M1 support and is the side-by-side NDK version from AGP.
ndkVersion = "23.1.7779620"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.facebook.react:react-native-gradle-plugin'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// Firebase app
classpath 'com.google.gms:google-services:4.3.15'
// Firebase crashlytics
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.9'
// Firebase perf
classpath 'com.google.firebase:perf-plugin:1.4.2'
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
maven { url "https://www.jitpack.io" }
// this is added due to android build gradle resolve dependency performance
// DEngage needs huawei repo because it uses huawei to send notification
maven {
url 'https://developer.huawei.com/repo/'
content {
includeGroup "com.huawei.hms"
includeGroup "com.huawei.agconnect"
includeGroup "com.huawei.hmf"
includeGroup "com.huawei.android.hms"
}
}
}
}
app/build.gradle
apply plugin: "com.android.application"
apply plugin: "com.facebook.react"
// Firebase app
apply plugin: 'com.google.gms.google-services'
// Firebase crashlytics
apply plugin: 'com.google.firebase.crashlytics'
// Firebase perf
apply plugin: 'com.google.firebase.firebase-perf'
// react-native-config
project.ext.envConfigFiles = [
dev: ".env.dev",
preprod: ".env.preprod",
prod: ".env",
]
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
import com.android.build.OutputFile
/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '..'
// root = file("../")
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
// reactNativeDir = file("../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
// codegenDir = file("../node_modules/react-native-codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
// cliFile = file("../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. By default is just 'debug'.
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "prodDebug"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
}
/**
* Set this to true to create four separate APKs instead of one,
* one for each native architecture. This is useful if you don't
* use App Bundles (https://developer.android.com/guide/app-bundle/)
* and want to have separate APKs to upload to the Play Store.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Private function to get the list of Native Architectures you want to build.
* This reads the value from reactNativeArchitectures in your gradle.properties
* file and works together with the --active-arch-only flag of react-native run-android.
*/
def reactNativeArchitectures() {
def value = project.getProperties().get("reactNativeArchitectures")
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}
android {
ndkVersion rootProject.ext.ndkVersion
compileSdkVersion rootProject.ext.compileSdkVersion
def dateFormat = new Date().format('dd.MM.yy_HH.mm')
namespace "x"
defaultConfig {
applicationId "x"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 71
versionName "3.2.0"
archivesBaseName = "$dateFormat-v$versionName ($versionCode)"
// Adjust
ndk.abiFilters 'armeabi-v7a','arm64-v8a','x86','x86_64'
// react-native-config
resValue "string", "build_config_package", "x"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include (*reactNativeArchitectures())
}
}
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
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
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 =
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
}
}
}
flavorDimensions "x"
productFlavors {
dev {
applicationIdSuffix ".dev"
}
preprod {
applicationIdSuffix ".preprod"
}
prod {
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation 'com.facebook.react:react-android'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
debugImplementation "com.facebook.flipper:flipper:${FLIPPER_VERSION}"
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation "com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}"
if (hermesEnabled.toBoolean()) {
implementation 'com.facebook.react:hermes-android'
} else {
implementation jscFlavor
}
// Facebook
implementation 'com.facebook.fresco:animated-gif:2.5.0'
implementation 'com.facebook.fresco:animated-webp:2.0.0'
implementation 'com.facebook.fresco:webpsupport:2.0.0'
// WIS
implementation 'com.github.WebInStats:android_wis:3.0.45@aar'
// Adjust
implementation 'com.android.installreferrer:installreferrer:2.2'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
// this is required because DEngage android library uses the old com.google.android.play:core library and this library has refactored and separated different modules, for example com.google.android.play:core-common and com.google.android.play:review
// check this link https://github.com/dengage-tech/dengage-react-sdk/issues/6
// if DEngage android library switches v2 you can remove this exclude
implementation(project(':dengage-tech_react-native-dengage')) {
exclude group: 'com.google.android.play', module:'core'
}
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
package.json
"@dengage-tech/react-native-dengage": "0.6.0",
Hi @AuroPick I appreciate your support. I solved the issue by combining your solution with mine.
Since we need to dengage native SDK to write custom receivers, I should have excluded both react-native SDK and native android SDK.
implementation ("com.github.dengage-tech:dengage-android-sdk:6.0.38.2"){
exclude group: 'com.google.android.play', module:'core'
}
implementation(project(':dengage-tech_react-native-dengage')) {
exclude group: 'com.google.android.play', module:'core'
}
Hi @hasnainTanvir
After upgrading dengage sdk, We get duplicate class errors while building android project.
Old Configuration
Npm Module "@dengage-tech/react-native-dengage": "0.4.9", --without geofence without huawei Android Sdk implementation "com.github.dengage-tech:dengage-android-sdk:6.0.30.2" --without geofence without huawei
New Configuration Npm Module "@dengage-tech/react-native-dengage": "0.6.1", --without geofence without huawei Android Sdk implementation "com.github.dengage-tech:dengage-android-sdk:6.0.38.2" --without geofence without huawei
Error