I have been trying to write test case for my Activity. But, android lint showing warnings while accessing public variable/method in Activity from Kotlin Test Class.
Here is the lint warning:
Cannot access 'androidx.core.app.OnMultiWindowModeChangedProvider' which is a supertype of 'com.app.sample.MyActivity'. Check your module classpath for missing or conflicting dependencies
Cannot access 'androidx.core.app.OnNewIntentProvider' which is a supertype of 'com.app.sample.MyActivity'. Check your module classpath for missing or conflicting dependencies
Cannot access 'androidx.core.app.OnPictureInPictureModeChangedProvider' which is a supertype of 'com.app.sample.MyActivity'. Check your module classpath for missing or conflicting dependencies
Cannot access 'androidx.core.content.OnConfigurationChangedProvider' which is a supertype of 'com.app.sample.MyActivity'. Check your module classpath for missing or conflicting dependencies
Cannot access 'androidx.core.content.OnTrimMemoryProvider' which is a supertype of 'com.app.sample.MyActivity'. Check your module classpath for missing or conflicting dependencies
Cannot access 'androidx.core.view.MenuHost' which is a supertype of 'com.app.sample.MyActivity'. Check your module classpath for missing or conflicting dependencies
These lint warnings disappear when I access same variable/method from a Java test class.
I have tried:
Cleaning and rebuilding the project.
Invalidated cache and restarted the project.
Related
I just installed the new Electric Eel Android Studio stable version, but I am getting the following error messages below although the project builds without errors. The errors are happening in the build.gradle.kts file for the buildSrc module. What do I have to do to resolve the error messages?
import org.gradle.kotlin.dsl.`kotlin-dsl`
plugins {
`kotlin-dsl`
}
repositories {
mavenCentral()
}
Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.plugin.use.PluginDependenciesSpec'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.lang.Comparable' which is a supertype of 'org.gradle.api.Project'. Check your module classpath for missing or conflicting dependencies
Cannot access 'java.lang.Object' which is a supertype of 'org.gradle.api.Project'. Check your module classpath for missing or conflicting dependencies
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 am using android studio 3.2.1 and Kotlin 1.2.71
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
for almost time whenever I build project getting below errors with respect to Kotlin classes name and object references
Eg: class DelUserIP
Unresolved reference: DelUserIP
: Cannot access class ‘input.DelUserIP’. Check your module classpath for missing or conflicting dependencies
but after an error, if I build project once again it will be success build without error after some build again I am experiencing same above error…
after renaming my package name of data classes from name "module" to some other name,then i didn't experienced issue again.
I have a project with two Android Gradle modules: a library, :mylib, and an app, :demo. In the build.gradle for :demo, I added a dependency on :mylib:
dependencies {
compile project(':mylib')
}
In turn, :mylib has this dependency:
dependencies {
compile 'com.google.code.ksoap2-android:ksoap2-android:3.5.0'
}
The repo is set up correctly, and :mylib built fine before I added the :demo module to the project. But now when I build, I get this:
Error:Gradle: A problem occurred configuring project ':demo'.
> Could not resolve all dependencies for configuration ':demo:_debugCompile'.
> Could not find com.google.code.ksoap2-android:ksoap2-android:3.5.0.
Searched in the following locations:
https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
file:/home/kevin/local/android-sdk-linux/extras/android/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
file:/home/kevin/local/android-sdk-linux/extras/android/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
file:/home/kevin/local/android-sdk-linux/extras/google/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.pom
file:/home/kevin/local/android-sdk-linux/extras/google/m2repository/com/google/code/ksoap2-android/ksoap2-android/3.5.0/ksoap2-android-3.5.0.jar
Required by:
MyProject:demo:unspecified > MyProject:mylib:unspecified
I don't understand why :demo is even aware that :mylib uses ksoap2, let alone why it tries to resolve the dependency itself. I don't think there's anything public or even protected in :mylib that exposes its use of ksoap2.
Since you are including a module, gradle is trying to resolve all nested dependencies (somenthing similar to a pom file).
The library com.google.code.ksoap2-android isn't in the jcenter or maven central repository and it is the reason of your issue.
Just add the repository where gradle can find this library.
I have a dependency that looks like this:
dependencies {
apt 'io.sweers.barber:barber-compiler:1.3.0'
compile 'io.sweers.barber:barber-api:1.3.0'
}
This dependency does exist in both jcenter and mavenCentral, but whenever gradle resolves it, it uses the incorrect artifactId (dropping the "barber-" prefix).
Error:Could not find io.sweers.barber:api:1.3.0.
Searched in the following locations:
https://jcenter.bintray.com/io/sweers/barber/api/1.3.0/api-1.3.0.pom
https://jcenter.bintray.com/io/sweers/barber/api/1.3.0/api-1.3.0.jar
https://maven.fabric.io/public/io/sweers/barber/api/1.3.0/api-1.3.0.pom
https://maven.fabric.io/public/io/sweers/barber/api/1.3.0/api-1.3.0.jar
file:/Users/hsweers/dev/android/android-sdk/extras/android/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.pom
file:/Users/hsweers/dev/android/android-sdk/extras/android/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.jar
file:/Users/hsweers/dev/android/android-sdk/extras/google/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.pom
file:/Users/hsweers/dev/android/android-sdk/extras/google/m2repository/io/sweers/barber/api/1.3.0/api-1.3.0.jar
Required by:
MyAppProject.app:unspecified > io.sweers.barber:barber-compiler:1.3.0
If the dependency would resolve correctly to https://jcenter.bintray.com/io/sweers/barber/barber-api/1.3.0/barber-api-1.3.0.pom
If it helps, the library can be found here: https://github.com/hzsweers/barber
Turns out the problem is somewhere in my library and causing the generated pom for the compiler module to use the api module name rather than its artifactId. Hotfixed it for now