I tried making a chatapp with firebase, but when i try to run the app on an emulator i get this "Error: Type com.google.firebase.FirebaseApp$zza is referenced as an interface from com.google.android.gms.internal.zzbkv$3."
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.firebasechat"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0-alpha02'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-core:16.0.7'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'com.google.android.material:material:1.1.0-alpha03'
implementation 'com.firebaseui:firebase-ui:1.1.1'
implementation 'com.google.firebase:firebase-auth:16.1.0'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.jakewharton:butterknife:10.1.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.1.0'
}
apply plugin: 'com.google.gms.google-services'
classpath 'com.google.gms:google-services:4.0.1'
check declare plugin in gradle module. and define classpath to project gradle
Related
I imported a project as a library in my base project but I am not able to access the class files present in my imported library , in my base project. Forgive me if the question is stupid , I am relatively new in android studio
Steps I did -
Changed apply plugin: 'com.android.application' to apply plugin: 'com.android.library'
Added Implementation project(':project_name')
Changed the compileSdkVersion, minSdkVersion and targetSdkVersion to the same values
Did an Invalidate Cache / Restart
Following are my gradle files
build.gradle(:app) (Main Project)
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.consensus.deg_project"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
}
}
dependencies {
implementation platform('com.google.firebase:firebase-bom:25.12.0')
implementation 'com.google.firebase:firebase-analytics'
implementation 'com.google.firebase:firebase-auth:19.4.0'
implementation 'com.google.firebase:firebase-firestore:22.0.0'
implementation 'com.google.android.gms:play-services-auth:18.1.0'
implementation 'com.google.android.material:material:1.1.0'
implementation 'com.google.firebase:firebase-database:19.2.0'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
exclude group: 'org.apache.httpcomponents'
exclude group:'com.google.guava'
}
implementation('com.google.apis:google-api-services-sheets:v4-rev506-1.23.0') {
exclude group: 'org.apache.httpcomponents'
exclude group:'com.google.guava'
}
implementation 'com.shobhitpuri.custombuttons:google-signin:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment:2.3.1'
implementation 'androidx.navigation:navigation-ui:2.3.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'me.dm7.barcodescanner:zxing:1.9'
implementation 'com.android.volley:volley:1.1.1'
implementation 'pub.devrel:easypermissions:0.3.0'
implementation project(':TF_Lite')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}
build.gradle(:TF_Lite) (Project imported as a library)
apply plugin: 'com.android.library'
android {
compileSdkVersion 29
defaultConfig {
applicationId "org.tensorflow.lite.examples.classification"
minSdkVersion 19
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
aaptOptions {
noCompress "tflite"
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
lintOptions {
abortOnError false
}
flavorDimensions "tfliteInference"
productFlavors {
// The TFLite inference is built using the TFLite Support library.
support {
dimension "tfliteInference"
}
// The TFLite inference is built using the TFLite Task library.
taskApi {
dimension "tfliteInference"
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
supportImplementation project(":lib_support2")
taskApiImplementation project(":lib_task_api2")
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'com.google.truth:truth:1.0.1'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
}
So all i had to do was add this:-
flavorDimensions "tfliteInference"
productFlavors {
// The TFLite inference is built using the TFLite Support library.
support {
dimension "tfliteInference"
}
// The TFLite inference is built using the TFLite Task library.
taskApi {
dimension "tfliteInference"
}
}
in my main project's build gradle
I've searched through previous post and can't find the answer to my question here is my code from my build.gradle file.
Error: A problem occurred evaluating project ':app'.
Could not get unknown property 'implementation' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.loganwiley.findmyphone"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
compileKotlin {
kotlinOptions.suppressWarnings = true
}
compileKotlin {
kotlinOptions {
suppressWarnings = true
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'+
implementation 'com.android.support.constraint:constraint-layout:1.0.2'+
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'+
implementation 'com.google.firebase:firebase-auth:10.2.4'+
implementation 'com.google.firebase:firebase-database:10.2.4'+
implementation 'com.google.android.gms:play-services-maps:10.2.4'+
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'+
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'
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
Remove all those weird plus signs (+) you have after many of your dependency declerations. So, for instance, instead of:
implementation 'com.android.support:appcompat-v7:28.0.0'+
Write:
implementation 'com.android.support:appcompat-v7:28.0.0'
everytime I try to build and run my app I get
Error: Program type already present: org.eclipse.jetty.websocket.client.io.UpgradeListener
I've already tried to exclude some groups and tried to remove every library
This is my build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "de.profi.obsstreamdeck"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.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
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
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'
implementation 'org.eclipse.jetty.websocket:websocket-client:9.4.18.v20190429'
//implementation files('libs/gson-2.6.2.jar')
}
When I try to build and run the app on my emulator, I keep getting the error "Error: Program type already present: org.eclipse.jetty.websocket.client.io.UpgradeListener"
I'm trying to import a custom library to a freshly created project, but when I try to build it I get the next error:
Exception in thread "main" java.lang.TypeNotPresentException: Type org.openjdk.jdi.ReferenceType not present
at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:85)
at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:63)
at sun.invoke.util.BytecodeDescriptor.parseMethod(BytecodeDescriptor.java:41)
at java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:1067)
at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.toMethodHandle(LambdaDesugaring.java:599)
at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.toJvmMetatype(LambdaDesugaring.java:586)
at com.google.devtools.build.android.desugar.LambdaDesugaring$InvokedynamicRewriter.visitInvokeDynamicInsn(LambdaDesugaring.java:401)
at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(Unknown Source)
at org.objectweb.asm.MethodVisitor.visitInvokeDynamicInsn(Unknown Source)
at org.objectweb.asm.ClassReader.a(Unknown Source)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:401)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:326)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:280)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:584)
Caused by: java.lang.ClassNotFoundException: Class org.openjdk.jdi.ReferenceType not found
at com.google.devtools.build.android.desugar.HeaderClassLoader.findClass(HeaderClassLoader.java:53)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.invoke.util.BytecodeDescriptor.parseSig(BytecodeDescriptor.java:83)
... 16 more
I have already checked similar questions but none worked for me.
This is the build.gradle for my freshly new created project:
apply plugin: 'com.android.application'
repositories {
maven { url 'http://my.artifactory.repo.com/artifactory/' }
}
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.whatever.myapplicationtest"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation('com.whatever.coollibrary:module:1.0.1#aar') {
transitive = true
}
annotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta5'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
}
And this is the build.gradle for my custom library:
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'maven-publish'
buildscript {
repositories {
jcenter()
google()
}
}
android {
compileSdkVersion 26
defaultConfig {
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "0.1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/services/javax.annotation.processing.Processor'
exclude 'META-INF/rxjava.properties'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.2.21"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.android.support:appcompat-v7:26.1.0"
implementation "com.android.support:cardview-v7:26.1.0"
implementation "com.android.support:support-v4:26.1.0"
implementation "com.android.support:design:26.1.0"
implementation project(':javaModule1')
implementation project(':javaModule2')
implementation project(':javaModule3')
implementation project(':androidModule')
provided 'com.google.auto.factory:auto-factory:1.0-beta5'
annotationProcessor 'com.google.auto.factory:auto-factory:1.0-beta5'
implementation 'com.google.dagger:dagger:2.11'
annotationProcessor 'com.google.dagger:dagger-compiler:2.11'
kapt 'com.google.dagger:dagger-compiler:2.11'
provided 'javax.annotation:jsr250-api:1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.1.3'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
So far I've tried to use several Google libraries' versions (27.0.2, 26.1.0), several kotlin versions (jre7, jdk7, jdk8).
And, of course, I've used clean, rebuild, Invalidate Caches and Restart, etc so many times I can't even remember.
After lots of tests and different approaches, I found out that the problem was related with the local Java modules included in the custom library.
Converting these modules into Android modules solved all the problems.
Still no idea of why the Java modules produced that error though. If anyone has any idea or insight about it, please share them.
I can't tune up material drawer 6.0.2 from https://github.com/mikepenz/MaterialDrawer
Build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.vlado.navigationsandfragments"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility 1.8
sourceCompatibility 1.8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation("com.mikepenz:materialdrawer:6.0.2#aar") {
transitive = true
}
//required support lib modules
implementation "com.android.support:appcompat-v7:${versions.supportLib}"
implementation "com.android.support:recyclerview-v7:${versions.supportLib}"
implementation "com.android.support:support-annotations:${versions.supportLib}"
implementation "com.android.support:design:${versions.supportLib}"
}
Exception:Error:(38, 0) Could not get unknown property 'versions' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler
I think the problem is in "required support lib modules" ,but if I delete them , the application have no error and doesn't work.