I am using Firebase for uplodaing the images but whenever i am using StorageReference then it saying cannot able to resolve this symbol i have tried to add dependency of storage but it is also not adding and giving me the error.
Please tell how can i use StorageReference
my build.gradle(app):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "example.example1.adminshayariapp"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.firebase:firebase-database:16.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.intuit.sdp:sdp-android:1.0.6'
implementation 'com.squareup.picasso:picasso:2.71828'
}
build.gradle(Project):
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please tell what is wrong why i am not able to use StorageReference.
If you are planning on using the Storage Bucket feature from Firebase I notice you are missing some implementations in your App Gradle:
implementation 'com.google.firebase:firebase-storage:19.1.1'
implementation 'com.google.firebase:firebase-auth:19.3.1'
You might not need the second one, but i would recommend authentication anyway. Go ahead and add these into your dependencies, that should solve the issue. If it persists let me know and I'll give it a second look.
Also ensure that you have connected your app to your Firebase project...
In android studio, if you go to tools(top bar) > FireBase > Storage it will guide you through the installation, and ensure that you have all the dependencies you need.
Related
i'm developing an Android Studio App and trying to create a user register activity. I already added firebase into the project but when i try to add the firebase database dependencies, the app crashes instantly and not a single error is reported. However, when i remove the 3 implements from the build gradle, it runs correctly. Here i leave both build gradle codes. Thanks.
Build gradle project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.4'
classpath 'com.google.gms:google-services:4.3.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build gradle app (this works properly):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.jota02"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//new implements
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.android.material:material:1.4.0-beta01'
implementation platform('com.google.firebase:firebase-bom:28.0.1')
}
Build gradle app (this crashes):
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.example.jota02"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
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.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
//new implements
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.android.material:material:1.4.0-beta01'
implementation platform('com.google.firebase:firebase-bom:28.0.1')
implementation 'com.google.firebase:firebase-auth:21.0.1'
implementation 'com.google.firebase:firebase-core:19.0.0'
implementation 'com.google.firebase:firebase-database:20.0.0'
}
SOLVED
The problem just was that i was running an old Android Studio version. I updated Android Studio and checked the gradle versions and now it's all working properly, thanks.
When you use firebase-bom dependency, you no need to mention version for firebase-database and other firebase library.
firebase-bom will choose right version for you or if you want particular version of firebase remove firebase-bom.so add dependency like below
// Import the BoM for the Firebase platform
implementation platform('com.google.firebase:firebase-bom:28.0.1')
// When using the BoM, you don't specify versions in Firebase library dependencies
implementation 'com.google.firebase:firebase-auth'
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-database'
I an trying to import Ksoap2 library in android studio using .jar file version 3.6.4. I have successfully implemented the jar file to android studio. However, on the module app activity when I try to import e.g. import "org.ksoap2.SoapEnvelope;", it gets and error it shows following results:
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.google.code.ksoap2-android:ksoap2-android:3.6.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom
- https://dl.google.com/dl/android/maven2/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom
- https://jcenter.bintray.com/com/google/code/ksoap2-android/ksoap2-android/3.6.4/ksoap2-android-3.6.4.pom
Required by:
project :app
Possible solution:
Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
Also the imports library have error, please see the pic:
Here is the Build.gradle module code:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Here is Build.gradle(app) Module code:
plugins {
id 'com.android.application'
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.kowloondairycompanykdl.milk_ic"
minSdkVersion 27
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.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
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.2.1'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation files('libs\\ksoap2-android-assembly-3.6.4.jar')
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.code.ksoap2-android:ksoap2-android:3.6.4'
}
Please help me, I been stuck here for a long time. How to fix the error and how can I implement the Ksoap2 library properly. Thanks
There doesn't seem to be a 3.4.3 version of that library. There's a 3.4.0. And the newest is 3.6.4. You're going to need to use one of those. I'd move to 3.6.4 as 3.4.0 is over 5 years old, and likely lacks security updates.
Remove the dependencyResolutionManagement block from the setting.gradle file to have your project work the old way.
Related issue: Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'build.gradle'
I'm trying to develop an app in AndroidStudio and i'm using cloud firestore as database. I'm having some issues when i try to add both 'com.google.firebase:firebase-admin:6.11.0'and 'com.google.firebase:firebase-core:17.0.0 dependencies. I get these messages when I try to make the project:
Duplicate class com.google.firebase.FirebaseAppLifecycleListener found in modules firebase-admin-6.11.0.jar (com.google.firebase:firebase-admin:6.11.0) and firebase-common-18.0.0-runtime.jar (com.google.firebase:firebase-common:18.0.0)
Duplicate class com.google.firebase.FirebaseException found in modules firebase-admin-6.11.0.jar (com.google.firebase:firebase-admin:6.11.0) and jetified-play-services-basement-17.0.0-runtime.jar (com.google.android.gms:play-services-basement:17.0.0)
Duplicate class com.google.firebase.FirebaseOptions found in modules firebase-admin-6.11.0.jar (com.google.firebase:firebase-admin:6.11.0) and firebase-common-18.0.0-runtime.jar (com.google.firebase:firebase-common:18.0.0)
Duplicate class com.google.firebase.FirebaseOptions$1 found in modules firebase-admin-6.11.0.jar (com.google.firebase:firebase-admin:6.11.0) and firebase-common-18.0.0-runtime.jar (com.google.firebase:firebase-common:18.0.0)
Duplicate class com.google.firebase.FirebaseOptions$Builder found in modules firebase-admin-6.11.0.jar (com.google.firebase:firebase-admin:6.11.0) and firebase-common-18.0.0-runtime.jar (com.google.firebase:firebase-common:18.0.0)
Duplicate class com.google.firebase.iid.FirebaseInstanceId found in modules firebase-admin-6.11.0.jar (com.google.firebase:firebase-admin:6.11.0) and firebase-iid-19.0.0-runtime.jar (com.google.firebase:firebase-iid:19.0.0)
Go to the documentation to learn how to Fix dependency resolution errors.
I have tried with some other versions, older and newer but got the same problem. Anybody has any idea how to solve this? Thanks a lot. Here's my app gradle code
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "br.com.valorinveste.nextmobilefx"
minSdkVersion 16
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
packagingOptions {
exclude 'META-INF/INDEX.LIST'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/io.netty.versions.properties'
}
multiDexEnabled true
}
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'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
// implementation 'com.google.firebase:firebase-analytics:17.0.0'
implementation 'com.google.firebase:firebase-admin:6.11.0'
implementation 'com.google.firebase:firebase-core:17.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
and the project gradle code
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I never used this library. It cannot sync properly but my internet is working good enough to download that .jar file
Here is my error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not download rxjava.jar (io.reactivex.rxjava2:rxjava:2.1.0)
Open File
Show Details
Unable to resolve dependency for ':app#debugAndroidTest/compileClasspath': Could not download rxjava.jar (io.reactivex.rxjava2:rxjava:2.1.0)
Open File
Show Details
Unable to resolve dependency for ':app#debugUnitTest/compileClasspath': Could not download rxjava.jar (io.reactivex.rxjava2:rxjava:2.1.0)
Open File
Show Details
Unable to resolve dependency for ':app#release/compileClasspath': Could not download rxjava.jar (io.reactivex.rxjava2:rxjava:2.1.0)
Open File
Show Details
Unable to resolve dependency for ':app#releaseUnitTest/compileClasspath': Could not download rxjava.jar (io.reactivex.rxjava2:rxjava:2.1.0)
Open File
Show Details
Here is my build.app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.tekemuradov.aman.ulgmada"
minSdkVersion 18
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
// implement support libraries
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:animated-vector-drawable:27.0.2'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:27.0.2'
// implement firebase libraries
implementation 'com.google.firebase:firebase-auth:11.0.4'
implementation 'com.google.firebase:firebase-database:11.0.4'
implementation 'com.google.firebase:firebase-storage:11.0.4'
implementation 'com.google.firebase:firebase-core:11.0.4'
// implement firebase-ui
implementation 'com.firebaseui:firebase-ui-database:2.3.0'
// implement lifecycle
implementation 'android.arch.lifecycle:extensions:1.1.0'
// implement circle image view
implementation 'de.hdodenhof:circleimageview:2.2.0'
// implement image cropper
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
// implement image compressor
implementation 'id.zelory:compressor:2.1.0'
// implement test
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'
}
apply plugin: 'com.google.gms.google-services'
configurations.all{
resolutionStrategy.eachDependency{DependencyResolveDetails details ->
def requested = details.requested
if(requested.group == 'com.android.support'){
if (!requested.name.startsWith("multidex")){
details.useVersion('27.0.2')
}
}
}
}
here is my build.project gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
use
implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
from https://github.com/ReactiveX/RxJava/issues/5794
I've been going at this for a while now, and it's driving me insane. I've looked through a few existing Stack Overflow questions, but nothing has worked. I keep getting this error whenever I add the last line, which I need for my AdMob ad units. People seem to solve this issue by changing the version number for this line to 15.0.0, but, as you can see, I've already done this. Please help, if you can. Also, this isn't even the first time I've worked with ad units.
Build.gradle (App level)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.coincalc.anduril.sharetale"
minSdkVersion 17
targetSdkVersion 26
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.android.support:support-v4: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'
compile 'com.google.firebase:firebase-core:12.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle (Project level)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update the following classpath dependency in your top-level build.gradle:
classpath 'com.google.gms:google-services:4.0.1'
Only newer versions of this plugin understand that the new Firebase dependencies no longer all have to be at the same version.
Read this for more information.
Upgrade your firebase dependencies to latest version, by changing your dependencies to this:
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com. google.firebase:firebase-core:16.0.1'
And in your project level Gradle file, increment your Google services plugin to 4.0.0
Change this:
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
into this:
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
Check this for more info:
https://firebase.google.com/support/release-notes/android