Realm Android Cannot resolve symbol 'SyncUser' - java

I get a "Cannot resolve symbol" error whenever I try to import the classes below.
io.realm.ObjectServerError;
io.realm.SyncCredentials;
io.realm.SyncUser;
but not when I try to import
io.realm.RealmQuery;
io.realm.RealmResults;
io.realm.Realm;
I have added
realm{
syncEnabled = true
}
in my app build.gradle but it still shows the same error.
Here is my app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
realm{
syncEnabled = true
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.ktoon"
minSdkVersion 17
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
Here is my project build.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.0.1"
classpath "io.realm:realm-gradle-plugin:10.0.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
What am I missing?

There was a number of breaking changes to the API in 10.0.0. Among them, SyncUser was renamed to io.realm.mongodb.User. See https://github.com/realm/realm-java/blob/master/CHANGELOG.md#1000-2020-10-15 for the full list

Related

org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException:

I'm getting this error while I run the application:
org.gradle.workers.internal.DefaultWorkerExecutor$WorkExecutionException: A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
I'm wondering if the below "implementation" import statement of SwipeableCardStack in Gradle is the reason:
plugins {
id 'com.android.application'
}
android {
namespace 'com.example.jokesapp'
compileSdk 33
defaultConfig {
applicationId "com.example.jokesapp"
minSdk 21
targetSdk 33
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.github.wenchaojiang:AndroidSwipeableCardStack:0.1.6'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
import org.gradle.api.initialization.resolve.RepositoriesMode
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
}
}
rootProject.name = "JokesApp"
include ':app'

Hello! I can`t connect to firebase

**Could not parse the android application modules gradle config firebase.
I don't know what to do,this is the first project.And I really can't solve it.
I've seen quite a lot of people getting this error, but it seems that they could solve it by upgrading their build tool version, or by updating google-services. I've done all that and haven't been able to make it work so far.
Here are my Gradle scripts:**
build.gradle(project)
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.20'
classpath 'com.google.gms:google-services:4.3.10'
}
}
allprojects {
repositories {
google()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(module)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.gms.google-services'
}
apply plugin: 'kotlin-android'
android {
compileSdk 32
defaultConfig {
applicationId "com.example.simplechatkotlin"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled 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{
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.6.0'
implementation platform('com.google.firebase:firebase-bom:30.0.0')
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-database:20.0.5'
implementation 'com.google.firebase:firebase-common-ktx:20.1.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.core:core-ktx"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
repositories {
mavenCentral()
}
The Kotlin Gradle plugin version should match the Kotlin version you're using, so it should be 1.6.21. And the latest build tools version is 7.1.2.
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.21'
classpath 'com.google.gms:google-services:4.3.10'
}
}

Android Studio 2021.1.1.23 "app:debugCompileClasspath"

so guys i'm trying to launch my Android App , and that error face me.
ERROR : " Caused by: org.gradle.api.internal.artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugCompileClasspath'.
"
build.gradle(Project)
buildscript {
repositories {
google()
jcenter()
maven {url 'https://jitpack.oi'}
}
dependencies {
classpath "com.android.tools.build:gradle:7.1.3"
classpath 'com.google.gms:google-services:4.3.10'
}
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.1.3' apply false
id 'com.android.library' version '7.1.3' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(Module)
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.example.learn"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures{
viewBinding true
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
//for support screens
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.intuit.ssp:ssp-android:1.0.6'
//Rounded imageView
implementation 'com.makeramen:roundedimageview:2.3.0'
//firebase
implementation 'com.google.firebase:firebase-messaging:23.0.3'
implementation 'com.google.firebase:firebase-firestore:24.1.1'
//MultiDex
implementation 'android.multidex:mutidex:2.0.1'
}
can any one help me.I was looking for a solution All day.
Change your 'android.multidex:mutidex:2.0.1' to 'androidx.multidex:multidex:2.0.1' like this:
dependencies {
...
//MultiDex
implementation 'androidx.multidex:multidex:2.0.1'
}

How to fix this gradle sync issue

I am getting this error
ERROR: Could not find method implementation() for arguments [directory 'libs'] on project ':app'.
Open File
These are the contents of build.grade(Module : app)
//noinspection GradleCompatible
//noinspection ExpiredTargetSdkVersion
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "spoorthy.shopping"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
}
grade file(project:shopping)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.waltonbd.myapplication"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/raw'] } }
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Add testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" in defaultConfig{} .Also add buildToolVersion
Also add google()
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Android - Supertypes of the following classes can not be resolved - (Room Persistant Library, Android Library Module)

In my Android project (Kotlin), I want to use Room persistent library for my DATA LAYER.
But when I added dependencies for Room Persistent library suddenly build projects start failing.
Error which I am receiving:
Here is my project level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
globalCompileSdkVersion = 26
globalMinSdkVersion = 19
globalTargetSdkVersion = 26
kotlin_version = '1.2.10'
support_version = "27.0.2"
constraint_layout_version = "1.0.2"
view_animator_version = "1.0.5"
junit_version = "4.12"
runner_version = "1.0.1"
espresso_core_version = "3.0.1"
room_version = "1.0.0"
dagger_version = "2.13"
rxJavaVersion = "2.1.7"
rxAndroidVersion = "2.0.1"
libs = [
appCompatV7 : "com.android.support:appcompat-v7:$support_version",
rxJava : "io.reactivex.rxjava2:rxjava:$rxJavaVersion",
rxAndroid : "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion",
junit : "junit:junit:$junit_version",
runner : "com.android.support.test:runner:$runner_version",
espressoCore: "com.android.support.test.espresso:espresso-core:$espresso_core_version"
]
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is my app module build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion project.globalCompileSdkVersion
defaultConfig {
applicationId "com.keepsafe.app"
minSdkVersion project.globalMinSdkVersion
targetSdkVersion project.globalTargetSdkVersion
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation libs.appCompatV7
implementation "com.android.support:design:$support_version"
implementation "com.android.support.constraint:constraint-layout:$constraint_layout_version"
implementation "com.github.florent37:viewanimator:$view_animator_version"
implementation "com.google.dagger:dagger:$dagger_version"
kapt "com.google.dagger:dagger-compiler:$dagger_version"
implementation libs.rxJava
implementation libs.rxAndroid
testImplementation libs.junit
androidTestImplementation libs.runner
androidTestImplementation libs.espressoCore
implementation project(":data")
implementation project(":domain")
}
Here is my domain module build.gradle
apply plugin: 'java-library'
apply plugin: 'kotlin'
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation libs.rxJava
implementation libs.rxAndroid
implementation libs.junit
}
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
Here is my data module build.gradle
apply plugin: 'com.android.library'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android'
android {
compileSdkVersion project.globalCompileSdkVersion
defaultConfig {
minSdkVersion project.globalMinSdkVersion
targetSdkVersion project.globalTargetSdkVersion
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "android.arch.persistence.room:runtime:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
kapt "android.arch.persistence.room:compiler:$room_version"
testImplementation libs.junit
implementation project(":domain")
}
repositories {
mavenCentral()
}
I don't know how to resolve this issue.
Your help will be appreciated.
Android Gradle Plugin 3.0 and higher added a new behaviour for dependencies. You can read more about this here. Long story short, by using implementation in a submodule you're not sharing a dependency with a consumer module(your app module). Thus, it's not possible to generate the code needed for Room.
Essentially, what you need to do is simply change implementation to api in your data module for the Room's dependencies. The result will be:
api "android.arch.persistence.room:runtime:$room_version"
api "android.arch.persistence.room:rxjava2:$room_version"

Categories

Resources