I can\'t compile my Android Kotlin project.
I have no idea what is this...
Gradle log:
error: supertypes of the following classes ca
I fixed this error upgrading others libraries. My error showed when I added firebase=ads (from google adsmob). So I found a conflict in my firebase-auth (16.0.5) and firebase ads (19.0.1).
Migrating firebase to 19.3.0 solved the problem.
In my case, I went to the project structure and updated all firebase dependencies to the latest and the highest. At the moment here are implementations with their versions:
implementation 'com.google.firebase:firebase-auth:19.3.1'
implementation 'com.google.firebase:firebase-database:19.3.1'
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-analytics:17.4.3'
Well in my case this error randomly occurs which usually occurs during execution through Android Studio.
The root cause was that My Activity class were extending some interfaces which was in another nested package:
package tv.activities
public class MainActivity implements MyListener {
}
package tv.activities.error
interface MyListener {
}
Hence it usually happens during execution but after second run it resolves automatically so no one bother to resolve it. Sometimes Android Studio fail to recognise that interface is accessible so there is no sense of showing error for the same:
Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath:
class tv.activities.MainActivity, unresolved supertypes: MyListener
Final Solution:
Making interface public resolves this issue permanently.
public interface MyListener {
}
Or refactor the package accessibility where AS doesn't get confuse
When setting up the crashlytics to my app, I used "recommended" dependency as well, as shown below. But this was the part causes error.
// Firebase Crashlytics
// (Recommended) Add the Google Analytics dependency.
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
Removing "analytics" line solved my problem.
// Firebase Crashlytics
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
Hope this helps someone else too,
best
Update your Android Studio sdk and run this project again.. Then your problem will be solved..
I was getting error for below lib in app level build.gradle
implementation 'com.google.firebase:firebase-iid:20.0.2'
So the solution is the order in project level build.gradle, So before solving error the structure was
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
After Solving the error the struture is :
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
maven {
url "https://maven.google.com"
}
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://maven.google.com" // Google's Maven repository
}
google()
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
By default it tries to download using google() as it comes first in the sequence but when we move maven on top of all then it creates the build again using maven and the build succeeds. Cheers :)