error: package com.google.android.gms.drive does not exist - java

Hi everyone I have this problem that I can't solve even tho I checked on StackOverflow and I tried all the solutions but nothing is working.
So bellow I will put the dependencies and sync them and everything seems ok but when I press compile I get this error:
package com.google.android.gms.drive does not exist
but I included the dependency and I can't understand why I get this error.
Can anyone help me, please? Thank you.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'com.android.support:appcompat-v7:29.1.0'
implementation 'com.android.support:recyclerview-v7:29.1.0'
implementation 'com.android.support:design:29.1.0'
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation "com.google.android.gms:play-services-base:17.1.0"
implementation 'com.google.android.gms:play-services-ads:18.3.0'
implementation 'com.google.android.gms:play-services-auth:17.0.0'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation 'com.google.android.gms:play-services-location:17.0.0'
// Add the Firebase SDK for Google Analytics
// Add the SDKs for any other Firebase products you want to use in your app
// For example, to use Firebase Authentication and Cloud Firestore
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-firestore:21.4.0'
implementation 'com.google.firebase:firebase-analytics:17.2.2'
implementation 'com.google.firebase:firebase-database:19.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.github.bumptech.glide:glide:4.11.0'
// FirebaseUI for Firebase Realtime Database
implementation 'com.firebaseui:firebase-ui-database:6.2.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
}enter code here

The first thing I would recommend you is to check if on top of the build.gradle you added the plugin
apply plugin: 'com.android.application'
then do a clean build, from Build -> Clean build
If should not work downgrade the dependencies just to be sure is not any particular bug from the current version of the play services. Let us know!

Related

Migrating to API31 and com.google.android.gms.internal.zzbej not found error

After hours of trying and analyzing I gave up :( I'm in the process of updating my Google Play app, so I was forced to switch to API31, and this is where the problem started.
I changed targetSdkVersion and compileSdkVersion to 31, the app of course launched without any problem, but notifications stopped coming. I added android:exported="true" to all firebase services and according to the answer in another thread I change firebase libraries to newer ones.
In build.gradle I replaced
implementation 'com.google.firebase:firebase-core:11.6.2'
implementation 'com.google.firebase:firebase-auth:11.6.2'
implementation 'com.google.firebase:firebase-messaging:11.6.2'
at
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-auth:21.1.0'
implementation 'com.google.firebase:firebase-messaging:23.1.1'
The application correctly build OK, but when I try to run it I get an error
map.addMarker(new MarkerOptions().position(new LatLng(lat, lon))
^ class file for com.google.android.gms.internal.zzbej not found
This is my build.gradle.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation group: 'com.squareup.picasso', name: 'picasso', version: '2.5.2'
implementation 'jp.wasabeef:picasso-transformations:2.2.0'
implementation 'com.github.ticofab:android-gpx-parser:2.0.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
implementation 'androidx.work:work-runtime:2.7.1'
implementation 'com.makeramen:roundedimageview:2.3.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.google.firebase:firebase-core:21.1.1'
implementation 'com.google.firebase:firebase-auth:21.1.0'
implementation 'com.google.firebase:firebase-messaging:23.1.1'
implementation 'com.google.android.gms:play-services:11.6.2'
implementation 'com.google.android.gms:play-services-auth:11.6.2'
implementation "com.google.android.material:material:1.4.0-alpha02"
implementation "androidx.viewpager2:viewpager2:1.1.0-alpha01"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.vectordrawable:vectordrawable:1.1.0'
implementation 'androidx.annotation:annotation:1.5.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
}
apply plugin: 'com.google.gms.google-services'
I have updated all possible libraries, but the problem persists. I tried also implementation platform('com.google.firebase:firebase-bom:31.2.0') and still the same. Any ideas? Commenting on the code that causes the problem doesn't help, because new errors with the same content appear. I guess there is something wrong in build.gradle. Thanks in advance.

Build fail when using Tensorflow lite metadata in Android Studio 4.1

guys, I am new to Stackoverflow
A question about using Tensorflow lite in AS4.1
As I "new" -> "other" -> "tensorflow lite model" and import a new .tflite file
The project automatically generate a PosenetMobilenetFloat0751Metadata1.java file
Then "build" -> "Make project", it shows error:
package org.tensorflow.lite.support.metadata does not exist import org.tensorflow.lite.support.metadata.MetadataExtractor;
The error happens in PosenetMobilenetFloat0751Metadata1.java:
import org.tensorflow.lite.support.metadata.MetadataExtractor;
This error seems come from I don't have this dependency,
following is my dependencies in build.gradle
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":posenet")
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'org.tensorflow:tensorflow-lite:1.12.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.2.0'
implementation 'org.tensorflow:tensorflow-lite-support:0.0.0-nightly'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
Can Someone help me how to go next?
I think you need to use implementation 'org.tensorflow:tensorflow-lite-metadata:0.1.0-rc2'.
Please try to add this
configurations {
libMetadata
}
dependencies {
libMetadata 'org.tensorflow:tensorflow-lite-support:0.0.0-experimental-metadata-monolithic'
}
task downloadLibs(type: Sync) {
from configurations.libMetadata
into "$buildDir/libs"
rename 'tensorflow-lite-support-0.0.0-experimental-metadata-monolithic.jar', "tensorflow-lite-support-metadata.jar"
}
Careful when adjust another version, this very sensitive as BUILD!

perfernce Sacreen color picker library unable to implement in android studioH

Hello friends i am beginner and using this library implementation'com.github.kizitonwose.colorpreference:core:'
library link is here https://github.com/kizitonwose/colorpreference
in my project for perfernceSacreen the problem is that when i tried implement this library in my project it give me this exception:
ERROR: Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.github.kizitonwose.colorpreference:core:<latest-version>.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not resolve com.github.kizitonwose.colorpreference:core:<latest-version>.
Show Details
Affected Modules: app
ERROR: Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not resolve com.github.kizitonwose.colorpreference:core:<latest-version>.
Show Details
Affected Modules: app
my dependecies
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'petrov.kristiyan:colorpicker-library:1.1.5'
implementation 'com.github.kizitonwose.colorpreference:core:<latest-version>'
implementation 'com.yokkomi:seekbar-preference:1.0'
implementation 'com.github.ganfra:material-spinner:1.1.0'
implementation 'com.wdullaer:materialdatetimepicker:2.4.0'
implementation 'com.github.ganfra:material-spinner:1.1.0'
implementation 'uk.co.chrisjenx:calligraphy:2.1.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.infideap.drawerbehavior:drawer-behavior:0.1.5'
implementation 'com.github.GrenderG:Toasty:1.4.2'
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4: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'
implementation 'com.google.android.gms:play-services-ads:17.2.1'
}
I also had the same problem while using Toasty library.And realized that its because of a version mismatch.Try suitable version of Android.I recommend you to get the latest version!

I am having trouble with installing library

I am trying to use jlatemath library.
I have put the .jar file under libs folder,
and here is my gradle.
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'
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 files('libs/jlatexmath-android-0.1.0-sources.jar')
implementation files('libs/jlatexmath-android-font-cyrillic-0.1.0-sources.jar')
implementation files('libs/jlatexmath-android-font-greek-0.1.0-sources.jar')
}
I don't think I need both, but I put them just to be sure.
I tried clean and rebuild the project.
The building is done without a problem without runtask,
but my code still not finding the classes from the library, which means the are not finding auto import for the classes.
It's the first time I am using a library so I might have missed something stupid, but it would be much appreciated if anyone could kindly let me know what it is.
What I have just noticed is that you are trying to download and add dependencies manually. That is very long and tiresome process! You can just paste and let android studio to do it for you.
For your case you need to add these lines in build.gradle
implementation 'ru.noties:jlatexmath-android:0.1.0'
// for Cyrillic symbols
implementation 'ru.noties:jlatexmath-android-font-cyrillic:0.1.0'
And sync the project. Don't forget to delete all those lines which you used to add dependencies manually before.
so your code in the question supposed to look like this below
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7: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'
//PASTE HERE DEPENDENCIES
implementation 'ru.noties:jlatexmath-android:0.1.0'
// for Cyrillic symbols
implementation 'ru.noties:jlatexmath-android-font-cyrillic:0.1.0'
}
If it didnt fix your problem let me know.
If you prefer video tutorial, You can follow this tutorial for how to add dependency in android studio here.

Gradle libraries have different version

Last night, I did two things with my android code and now it does no longer work.
The two things I did was:
Add my first adview with the corresponding gradle implementation
Update Android Studio to the latest version (3.1.1)
Now the app can not build because of version mixing in the library versions. My gradle tells me that on the lines
implementation 'com.android.support:appcompat-v7:27.1.1'
and
implementation 'com.google.firebase:firebase-core:12.0.1'
I have no idea on how to fix this and nothing I search for gives me the answer on what to do. Is there a way to auto-generate the needed gradle for my app, or could anyone please point me in the direction of were to start when fixing this?
Thanks beforehand, my gradle dependencies are below.
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
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.google.firebase:firebase-core:12.0.1'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.firebaseui:firebase-ui-auth:3.2.2'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.google.android.gms:play-services-ads:12.0.1'
}
just try this one ,
"com.android.support:support-v13:27.1.1"
reference link
https://developer.android.com/topic/libraries/support-library/packages.html#v14-preference

Categories