diff --git a/Example/android/app/build.gradle b/Example/android/app/build.gradle index 5115ef3a..387179cd 100644 --- a/Example/android/app/build.gradle +++ b/Example/android/app/build.gradle @@ -85,7 +85,6 @@ project.ext.react = [ nodeExecutableAndArgs: ["/usr/local/bin/node"] ] -apply from: "../../node_modules/react-native/react.gradle" /** * Set this to true to create two separate APKs instead of one: @@ -158,6 +157,7 @@ android { keyPassword 'android' } } + namespace 'com.reactnct' buildTypes { debug { signingConfig signingConfigs.debug diff --git a/Example/android/app/src/debug/java/com/reactnct/ReactNativeFlipper.java b/Example/android/app/src/debug/java/com/reactnct/ReactNativeFlipper.java deleted file mode 100644 index 5519a3a0..00000000 --- a/Example/android/app/src/debug/java/com/reactnct/ReactNativeFlipper.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - *

This source code is licensed under the MIT license found in the LICENSE file in the root - * directory of this source tree. - */ -package com.reactnct; - -import android.content.Context; -import com.facebook.flipper.android.AndroidFlipperClient; -import com.facebook.flipper.android.utils.FlipperUtils; -import com.facebook.flipper.core.FlipperClient; -import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; -import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; -import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; -import com.facebook.flipper.plugins.inspector.DescriptorMapping; -import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; -import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; -import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; -import com.facebook.flipper.plugins.react.ReactFlipperPlugin; -import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; -import com.facebook.react.ReactInstanceManager; -import com.facebook.react.bridge.ReactContext; -import com.facebook.react.modules.network.NetworkingModule; -import okhttp3.OkHttpClient; - -public class ReactNativeFlipper { - public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { - if (FlipperUtils.shouldEnableFlipper(context)) { - final FlipperClient client = AndroidFlipperClient.getInstance(context); - - client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); - client.addPlugin(new ReactFlipperPlugin()); - client.addPlugin(new DatabasesFlipperPlugin(context)); - client.addPlugin(new SharedPreferencesFlipperPlugin(context)); - client.addPlugin(CrashReporterPlugin.getInstance()); - - NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); - NetworkingModule.setCustomClientBuilder( - new NetworkingModule.CustomClientBuilder() { - @Override - public void apply(OkHttpClient.Builder builder) { - builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); - } - }); - client.addPlugin(networkFlipperPlugin); - client.start(); - - // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized - // Hence we run if after all native modules have been initialized - ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); - if (reactContext == null) { - reactInstanceManager.addReactInstanceEventListener( - new ReactInstanceManager.ReactInstanceEventListener() { - @Override - public void onReactContextInitialized(ReactContext reactContext) { - reactInstanceManager.removeReactInstanceEventListener(this); - reactContext.runOnNativeModulesQueueThread( - new Runnable() { - @Override - public void run() { - client.addPlugin(new FrescoFlipperPlugin()); - } - }); - } - }); - } else { - client.addPlugin(new FrescoFlipperPlugin()); - } - } - } -} diff --git a/Example/android/app/src/main/AndroidManifest.xml b/Example/android/app/src/main/AndroidManifest.xml index c927d1bb..a8ef4310 100644 --- a/Example/android/app/src/main/AndroidManifest.xml +++ b/Example/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + diff --git a/Example/android/build.gradle b/Example/android/build.gradle index 94d148a7..a9ac15b9 100644 --- a/Example/android/build.gradle +++ b/Example/android/build.gradle @@ -6,7 +6,7 @@ buildscript { minSdkVersion = 21 compileSdkVersion = 34 targetSdkVersion = 34 - ndkVersion = "20.1.5948944" + ndkVersion = "26.2.11394342" } repositories { google() @@ -25,8 +25,8 @@ buildscript { maven { url "https://maven.google.com" } } dependencies { - classpath('com.android.tools.build:gradle:7.3.1') - classpath ('com.google.gms:google-services:4.3.5') + classpath('com.android.tools.build:gradle:8.2.2') + classpath ('com.google.gms:google-services:4.4.1') classpath("com.facebook.react:react-native-gradle-plugin") // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/Example/android/gradle.properties b/Example/android/gradle.properties index 17c81b7a..f7af3114 100644 --- a/Example/android/gradle.properties +++ b/Example/android/gradle.properties @@ -10,7 +10,7 @@ # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m -org.gradle.jvmargs=-Xmx3g -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 +org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit @@ -27,5 +27,7 @@ android.enableJetifier=true # Version of flipper SDK to use with React Native FLIPPER_VERSION=0.125.0 -android.enableDexingArtifactTransform.desugaring=false -hermesEnabled=true \ No newline at end of file +hermesEnabled=true +android.defaults.buildfeatures.buildconfig=true +android.nonTransitiveRClass=false +android.nonFinalResIds=false \ No newline at end of file diff --git a/Example/android/gradle/wrapper/gradle-wrapper.properties b/Example/android/gradle/wrapper/gradle-wrapper.properties index 8fad3f5a..b93c46a5 100644 --- a/Example/android/gradle/wrapper/gradle-wrapper.properties +++ b/Example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/Example/android/settings.gradle b/Example/android/settings.gradle index 445616ac..4ca0d7dd 100644 --- a/Example/android/settings.gradle +++ b/Example/android/settings.gradle @@ -7,7 +7,7 @@ apply from: file("../node_modules/@react-native-community/cli-platform-android/n include ':app' include ':clevertap-react-native' project(':clevertap-react-native').projectDir = new File(settingsDir, '../node_modules/clevertap-react-native/android') -includeBuild('../node_modules/react-native-gradle-plugin') +includeBuild('../node_modules/@react-native/gradle-plugin') diff --git a/Example/metro.config.js b/Example/metro.config.js index e91aba93..87fe8279 100644 --- a/Example/metro.config.js +++ b/Example/metro.config.js @@ -1,17 +1,31 @@ -/** - * Metro configuration for React Native - * https://github.com/facebook/react-native - * - * @format - */ +/* Metro configuration for React Native +* https://github.com/facebook/react-native +* +* @format +*/ -module.exports = { - transformer: { - getTransformOptions: async () => ({ - transform: { - experimentalImportSupport: false, - inlineRequires: true, - }, - }), - }, +const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config'); + +const defaultConfig = getDefaultConfig(__dirname); + +const { + resolver: { sourceExts, assetExts }, +} = getDefaultConfig(__dirname); + +const config = { + transformer: { + getTransformOptions: async () => ({ + transform: { + experimentalImportSupport: false, + inlineRequires: true, + }, + }), + babelTransformerPath: require.resolve('react-native-svg-transformer'), + }, + resolver: { + assetExts: assetExts.filter(ext => ext !== 'svg'), + sourceExts: [...sourceExts, 'svg'], + }, }; + +module.exports = mergeConfig(defaultConfig, config); diff --git a/Example/package.json b/Example/package.json index 6e21bbfb..67b52de8 100644 --- a/Example/package.json +++ b/Example/package.json @@ -10,18 +10,20 @@ "lint": "eslint ." }, "dependencies": { + "@react-native/metro-config": "^0.72.12", "@react-navigation/drawer": "^6.6.2", "@react-navigation/native": "^6.1.6", "@react-navigation/native-stack": "^6.9.12", "clevertap-react-native": "git+https://github.com/CleverTap/clevertap-react-native#develop", "react": "18.2.0", - "react-native": "0.71.8", + "react-native": "0.73.5", "react-native-drawer": "^2.5.1", "react-native-gesture-handler": "^1.10.3", "react-native-pager-view": "^5.1.2", - "react-native-reanimated": "^3.1.0", + "react-native-reanimated": "^3.4.0", "react-native-safe-area-context": "^3.2.0", "react-native-screens": "^3.22.0", + "react-native-svg-transformer": "^1.3.0", "react-native-tab-view": "^3.0.1", "react-navigation-drawer": "^2.7.0" }, diff --git a/android/build.gradle b/android/build.gradle index 679393a7..62c4f9b5 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -8,9 +8,8 @@ buildscript { name 'Google' } } - dependencies { - classpath 'com.android.tools.build:gradle:4.0.1' + classpath 'com.android.tools.build:gradle:8.2.2' } } @@ -24,6 +23,8 @@ android { versionCode 210 versionName "2.1.0" } + + namespace 'com.clevertap.react' buildTypes { release { minifyEnabled false diff --git a/android/gradle.properties b/android/gradle.properties index 2d8d1e4d..d015431a 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1 +1,2 @@ -android.useAndroidX=true \ No newline at end of file +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index b3bb6ac8..7f8acf16 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Tue Oct 06 22:41:12 IST 2020 +#Tue Mar 05 15:25:40 IST 2024 distributionBase=GRADLE_USER_HOME +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip +zipStoreBase=GRADLE_USER_HOME diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index b0292aba..0ceeb8b0 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - +