This is the Gradle. The app code will be below.
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("com.google.gms.google-services")
}
android {
namespace = "com.backendless.learnbackendless"
compileSdk = 33
defaultConfig {
applicationId = "com.backendless.learnbackendless"
minSdk = 21
targetSdk = 33
versionCode = 1
versionName = "1.0"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
}
}
buildTypes {
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
compose = true
}
composeOptions {
kotlinCompilerExtensionVersion = "1.4.3"
}
packaging {
resources {
excludes += "/META-INF/{AL2.0,LGPL2.1}"
}
}
}
dependencies {
implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
implementation("androidx.activity:activity-compose:1.7.0")
implementation(platform("androidx.compose:compose-bom:2023.03.00"))
implementation("androidx.compose.ui:ui")
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
// Import the Firebase BoM
implementation(platform("com.google.firebase:firebase-bom:32.3.1"))
// When using the BoM, you don't specify versions in Firebase library dependencies
// Add the dependency for the Firebase SDK for Google Analytics
implementation("com.google.firebase:firebase-analytics-ktx")
// TODO: Add the dependencies for any other Firebase products you want to use
// See https://firebase.google.com/docs/android/setup#available-libraries
// For example, add the dependencies for Firebase Authentication and Cloud Firestore
// implementation("com.google.firebase:firebase-core")
implementation("com.google.firebase:firebase-messaging")
implementation("com.google.firebase:firebase-auth-ktx")
implementation("com.google.firebase:firebase-firestore-ktx")
implementation("com.backendless:android-client-sdk:7.0.7")
// required for real-time database and real-time messaging
implementation("io.socket:socket.io-client:2.1.0") {
// excluding org.json which is provided by Android
exclude(group = "org.json", module = "json")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
androidTestImplementation(platform("androidx.compose:compose-bom:2023.03.00"))
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
}
App Code:
package com.backendless.learnbackendless
import android.os.Bundle
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.backendless.Backendless
import com.backendless.async.callback.AsyncCallback
import com.backendless.exceptions.BackendlessFault
import com.backendless.learnbackendless.ui.theme.LearnBackEndlessTheme
import com.backendless.push.DeviceRegistrationResult
import weborb.util.ThreadContext.context
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Toast.makeText(this@MainActivity,
"Before - Backendless.initApp!",
Toast.LENGTH_LONG)
.show()
Backendless.initApp(
this,
"A842DF0C-E73A-4DE3-FFB1-2F1315340400",
"241CA1D7-7A34-4852-8E81-FB8179147F38"
)
Toast.makeText(this@MainActivity,
"After - Backendless.initApp!",
Toast.LENGTH_LONG)
.show()
val channels: MutableList<String> = ArrayList()
channels.add("default")
Toast.makeText(this@MainActivity,
"Before Register!",
Toast.LENGTH_LONG)
.show()
Backendless.Messaging.registerDevice(channels)
Toast.makeText(this@MainActivity,
"After Register!",
Toast.LENGTH_LONG)
.show()
}
}
This is the error list.
* :app:checkDebugAarMetadata
* :app:mapDebugSourceSetPaths
* :app:mergeDebugResources
* :app:processDebugMainManifest
* :app:mergeDebugAssets
* :app:checkDebugDuplicateClasses
* :app:mergeDebugNativeLibs
* :app:writeDebugSigningConfigVersions
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=android-aar-metadata, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=android-res, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=android-res, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=android-manifest, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=android-assets, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=enumerated-runtime-classes, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).
* org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
* org.gradle.api.internal.artifacts.transform.TransformException: Failed to transform android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7) to match attributes {artifactType=android-jni, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
* org.gradle.internal.resolve.ArtifactNotFoundException: Could not find android-client-sdk-7.0.7.aar (com.backendless:android-client-sdk:7.0.7).