I just started learning android studio and I just can't get out of this problem... If anybody can help I would appreciate :)
The error I get in main activity:
Cannot access 'androidx.lifecycle.LifecycleOwner' which is a supertype of 'com.my package.base.MainActivity'.
Check your module classpath for missing or conflicting dependencies
Cannot access 'androidx.savedstate.SavedStateRegistryOwner' which is a supertype of 'com.my package.base.MainActivity'.
Check your module classpath for missing or conflicting dependencies
error
I have just started learning KotlinDSL recently.
And in Android added buildSrc. In this folder I have module plugins: AppModulePlugin, CommonModulePlugin, FeatureModulePlugin. All of this compiles and the application installs correctly, everything is fine. but in these files a warning is displayed:
Cannot access 'com.android.build.gradle.internal.dsl.Lockable'
which is a supertype of 'com.android.build.gradle.BaseExtension'.
Check your module classpath for missing or conflicting dependencies
Please tell me how to get rid of these warnings?
IntelliJ has had this issue for months unfortunately - it reports correct code as invalid. See KTIJ-3769. I believe it's dependent on ticket KTIJ-19669.
As a workaround you can either replace the helper methods that the plugins introduce with 'plain' Gradle Kotlin
// androidExtension { }
project.extensions.configure<BaseExtension> {
}
Or only create buildSrc plugins in Kotlin (*.kt files), not Kotlin Script (*.kts files). This requires using the java-gradle-plugin and defining the plugins in buildSrc/build.gradle.kts.
After updating Android Studio from 3.1.2 to 3.2.0, and updating the gradle plugin with it to 3.2.0, I am having a problem with a generated databinding classes which are complaining about a package name that does not exist, but it does exist. The package belongs to a module in the project.
Here are the errors that I am getting when trying to run the app:
error: cannot find symbol class Helper
error: package Helper does not exist
This is my project level build.gradle file:
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
classpath "com.google.gms:google-services:4.0.1"
classpath 'io.fabric.tools:gradle:1.25.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://jitpack.io'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this is the build.gradle for the module which having the problem:
apply plugin: 'com.android.library'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
minSdkVersion 17
targetSdkVersion 28
}
}
dependencies {
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
I tried all sort of things:
Cleaning and rebuilding the project
Invalidating caches and restarting
Cleaning gradle and gradle cache
Updating Gradle to the latest version
Changing the module name and the used package name in it
None did work.
EDIT: added screenshot
I had the SAME ISSUE today.
The problem is your package name itself. You mentioned:
there is no Helper class in my project, it is a package name. The package does exist, but databinding can't find it.
Short Answer:
Change your package name that starts with a lower case letter. The problem happens because your package name is Helper. Change it to helper.
Long Answer:
In Android Plugin 3.2.0 and above, the databinding V2 is enabled by default.
I guess the databinding V2 compiler treats any component that starts with an upper case letter as a class, not a package. It is actually looking for a class with a name Helper, not the package Helper.
Because you were using Android 3.1.2 before, which is using the databinding V1 compiler, the package name wasn't an issue.
I renamed all my package(folder) names in my project to start with a lower case letter and the project was finally compiled. Make sure to use the refactor tool (Shift + F6) when you rename the packages so that the change can be applied to your XML files also!!
BONUS:
Just in case you want to keep the package names to start with upper case letters, but also want to use the Android Plugin 3.2.0 (which is not really recommended), go to gradle.properties in the root folder and add this line. This disables the databindingV2 compiler and forces the project to use the old V1 compiler. Therefore your class name won't matter.
android.databinding.enableV2=false
But why would anyone want to do this? :/
I am using the Highcharts library (https://github.com/highcharts/highcharts-android) and I found the same problem with databinding - import after updating the gradle plugin to 3.2.0.
This version has probably errors included, so stay with the version 3.1.3.
The databinding file in version 3.2.0 :
import error in gradle 3.2.0
The databinding file in version 3.1.3:
import OK in gradle 3.1.3
In your codes, it's actually using EmojiIconEdittext helper class which comes from supernova library but in your dependencies, there is no such dependency added in there.
So, add this to your Build.gradle dependencies:
implementation 'com.github.hani-momanii:SuperNova-Emoji:1.1'
Or remove the class (If you don't wanna use it) and then it will work fine.
P.S: The import actually tells the truth.
import supernova.emoji.helper
I have been trying to link the local copy of Android Beacon Library on my computer with my project on Android Studio and I have tried several methods described in this thread How do I add a library project to the Android Studio?
No matter what method I use, I keep getting the error stated in the title. Some threads on Stack Overflow suggest that this is due to submodules within the library and that it could be fixed with "git submodule update --init" but that didn't do anything for me.
As I've said, I tried different methods for adding the library but just for reference, the latest method I did was to add the library to the app/libs/ folder and make the following changes in the code:
settings.gradle: include ':app',':libs:AndroidBeaconLibrary'
build.gradle: added compile project(":libs:AndroidBeaconLibrary") to dependancies.
Ok so I've solved the problem. The issue was that it should have been ':app:libs:AndroidBeaconLibrary' instead of ':libs:AndroidBeaconLibrary' in both gradle files.
This fixed the error but a new one came up:
Error:Cannot cast object '23.0.0' with class 'com.android.repository.Revision' to class 'com.android.sdklib.repository.FullRevision'
I fixed this using this answer https://stackoverflow.com/a/33889117/3001845
I added the lines in the build.gradle file of the library itself under 'buildscript'
The section now looks like this:
buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
}
}
This class in the build/intermediates/classes/debug/ target
If there is a way (such as a plug-in) to add classpath to build/intermediates/classes/debug/