Android Studio issue with firebase ui storage in Gradle - android

For some reason when I add compile 'com.firebaseui:firebase-ui-storage:0.6.0' to the dependencies it creates a conflict in the gradle with
implementation 'com.android.support:appcompat-v7:27.0.2'
Here is a full copy of my Gradle:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.nick.listofrestaurants"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
//repositories {
// mavenCentral()
// google()
//}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.0.2' //issue here
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-auth:11.8.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.android.support:cardview-v7:27.0.2'
compile 'com.google.android.gms:play-services-maps:11.8.0'
compile 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.android.support:design:27.0.2'
compile 'com.firebase:firebase-client-android:2.5.0'
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
//implementation 'com.github.bumptech.glide:glide:3.8.0'
//annotationProcessor 'com.github.bumptech.glide:compiler:3.8.0'
}
apply plugin: 'com.google.gms.google-services'`

you need to change this:
compile 'com.firebaseui:firebase-ui-storage:0.6.0'
to this:
compile 'com.firebaseui:firebase-ui-storage:3.2.1'
check this for more info: Firebase UI versions compatibility

Related

Places API setup is giving an error during setup in build.gradle

As soon as I add
compile 'com.google.android.libraries.places:places:1.0.0'
It starts giving me error
Cause: duplicate entry: com/bumptech/glide/GeneratedAppGlideModule.class
My build.gradle code is
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.videep.carpool"
minSdkVersion 16
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//noinspection GradleCompatible
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-auth:11.0.4'
compile 'com.google.firebase:firebase-storage:11.0.4'
compile 'com.firebase:geofire-android:2.1.1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.github.bumptech.glide:glide:4.3.1'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.github.jd-alexander:library:1.1.0'
testCompile 'junit:junit:4.12'
compile 'com.google.android.libraries.places:places:1.0.0'
}
apply plugin: 'com.google.gms.google-services'
Add Dependencies for Glide with the latest version.
repositories {
mavenCentral()
google()
}
dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
This issue is in glide library. It is fixed in latest version. Please check link for reference.
Use the latest version of glide. This issue is fixed.
dependencies {
implementation 'com.github.bumptech.glide:glide:4.9.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'
}
for more detail refer here Glide

Android program type already present error

I've gone through several threads with the same error to find a solution (they mention duplicate package names in gradle files, duplicates in AndroidManifests and dependency version mismatches) but none are the same with my case. This is the error message I'm receiving when building the app:
Program type already present: ff.ecochallenges.game.BuildConfig
Message{kind=ERROR, text=Program type already present: ff.ecochallenges.game.BuildConfig, sources=[Unknown source file], tool name=Optional.of(D8)}
My app gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "ff.ecochallenges"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-firestore:17.1.0'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.google.firebase:firebase-auth:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.1.0'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.firebaseui:firebase-ui-storage:0.6.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.firebaseui:firebase-ui-database:4.1.0'
implementation 'com.inthecheesefactory.thecheeselibrary:stated-fragment-support-v4:0.9.1'
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.github.varunest:sparkbutton:1.0.5'
implementation 'info.hoang8f:android-segmented:1.0.6'
implementation "com.android.support:support-compat:27.1.1"
implementation project(":garden-release")
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":game")
// Required for local unit tests (JUnit 4 framework)
// Required for instrumented tests
androidTestImplementation 'com.android.support:support-annotations:24.0.0'
androidTestImplementation 'com.android.support.test:runner:0.5'
}
apply plugin: 'com.google.gms.google-services'
And the gradle for the new library I added (game) is this:
apply plugin: 'com.android.library'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
//[DO NOT REMOVE THE COMMENTED CODE BELOW!]
//////////////////////////////////////////////////////
afterEvaluate {
assembleDebug.finalizedBy(exportJar)
}
/////////////////////////////////////////////////////
//[DO NOT REMOVE THE COMMENTED CODE ABOVE!]
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
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'
}
//[DO NOT REMOVE THE COMMENTED CODE BELOW!]
///////////////////////////////////////////////////////////////////////////////////////////////////
task exportJar(type: Copy) {
from('build/intermediates/packaged-classes/debug/classes.jar')
include('classes.jar')
into('../garden/Assets/Plugins/Android')
rename('classes.jar', 'ecochallenges.jar')
}
task deleteOldJar(type: Delete) {
delete '../garden/Assets/Plugins/Android/ecochallenges.jar'
}
exportJar.dependsOn(deleteOldJar)
///////////////////////////////////////////////////////////////////////////////////////////////////
//[DO NOT REMOVE THE COMMENTED CODE ABOVE!]
When I comment out the "implementation project(":game")" line in my app gradle it builds without error so I'm sure something's wrong with the "game" gradle but I can't find what it is.
one of these lines might define ff.ecochallenges.game twice:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(":garden-release")
implementation project(":game")
would assume, that there either is a .jar contained in the libs directory
or module garden-release might have a dependency on module game.
eg. you could use api project(":game") in module garden-release.
In my case I only run Build->Clean Project and problem have been solved!

Failed in gradle synchronizing

As my gradle file on app level is as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.developer.pkcaller"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.1'
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.google.firebase:firebase-iid:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.1.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 files('libs/volley.jar')
implementation 'com.firebaseui:firebase-ui:2.1.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.hbb20:ccp:1.7.2'
implementation 'com.facebook.android:facebook-login:[4,5)'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'com.google.android.gms:play-services-analytics:16.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
implementation 'com.google.android.gms:play-services-plus:15.0.1'
//implementation 'com.google.android.gms:play-services:16.0.0'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.google.android.gms:play-services:12.0.1'
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
And I got error is as follows:
error: cannot access zzbgl class file for
com.google.android.gms.internal.zzbgl not found
Please help me solve this. I am stuck in this. Please help me regarding I will be highly grateful to you.

How can I completely remove OneSignal library?

I am trying to completely remove OneSignal library ,
I have deleted its library from dependencies
This is gradle app code
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "xxx.xxxxxx.xxxxx"
minSdkVersion 17
targetSdkVersion 26
versionCode 3
versionName "1.0"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
jcenter()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
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-v4:26.1.0'
implementation 'com.google.firebase:firebase-auth:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.firebaseui:firebase-ui-database:3.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:2.2.2'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.google.android.gms:play-services:11.8.0'
implementation 'com.google.android.gms:play-services-location:11.8.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.github.whalemare:sheetmenu:1.3.3'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.android.support:recyclerview-v7:+'
implementation 'com.squareup.picasso:picasso:2.71828'
compile 'de.hdodenhof:circleimageview:2.2.0'
}
apply plugin: 'com.google.gms.google-services'
The problem is that I can't remove this line
plugins {
id 'com.onesignal.androidsdk.onesignal-gradle-plugin' version '0.8.1'
}
when I delete it and put apply plugin: 'com.android.application' in the first line
I get this error
How can I fix this error ? Or What is the right way to remove OneSignal ?
You're using the wrong version of the appcompat-v7 library i.e. 26.1.0 instead of 27.1.0. Also, you've to use the support-compat library:
def final support_libraries_version = '27.1.0'
implementation "com.android.support:appcompat-v7:${support_libraries_version}"
implementation "com.android.support:support-compat:${support_libraries_version}"
which means you'll also have to change your compile sdk version to 27:
compileSdkVersion 27

Unable to Merge Dex - Android Studio 3.0.1 DexArchiveMergerException

I started getting the below error
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I tried to reset my backup when it was working but the same problem
I tried all the solution such as
multiDexEnabled true
cleaning and rebuilding the project, but it didn't work. Any help will be appreciated.
App file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.2'
defaultConfig {
applicationId "com.example"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
resConfigs "auto"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext {
supportLibraryVersion = '27.0.2'
grpcVersion = '1.4.0'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
testImplementation 'junit:junit:4.12'
//appcompat libraries
compile 'com.android.support:design:27.0.2'
compile 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:support-v4:27.1.0'
//butterknife
compile 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.scottyab:aes-crypto:0.0.4'
//circleimageview
implementation 'de.hdodenhof:circleimageview:2.2.0'
//ZXing for barCode reader
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.google.zxing:core:3.2.1'
//gson
compile 'com.google.code.gson:gson:2.8.2'
//recyclerview and cardview
implementation 'com.android.support:cardview-v7:27.0.2'
compile 'com.android.support:recyclerview-v7:+'
//play-services
compile 'com.google.android.gms:play-services-maps:11.8.0'
implementation 'com.github.bumptech.glide:glide:4.3.1'
implementation 'com.jaeger.statusbarutil:library:1.4.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
compile 'com.android.support:support-annotations:27.0.2'
compile 'com.wang.avi:library:2.1.3'
}
Project file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I had looked at many other questions and answers on here but cannot seem to find a solution that will rectify the problem :(
I have solved after try all the solutions on stackoverflow, try to do the following steps in its order
Replace all compile with implementation
Make all supportLibraryVersion = '27.0.2'
Change
'com.google.android.gms:play-services-maps:11.8.0'
to
'com.google.android.gms:play-services-maps:11.4.0'
Remove all the unused library
Delete the .gradle folder inside your project
Remove build folders and the gradle cache
file -> invalidate caches/restart
Build > Clean Project
Add
dependencies { implementation 'com.android.support:multidex:1.0.1'}
Add
android {
defaultConfig {
multiDexEnabled true
}
}
Async project
And finally this is my App file
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
ext {
supportLibraryVersion = '27.0.2'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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.android.support:support-v4:27.0.2'
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support:design:27.0.2'
//constraint
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
//butterknife
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
//avi:library
implementation 'com.wang.avi:library:2.1.3'
//circleimageview
implementation 'de.hdodenhof:circleimageview:2.2.0'
//retrofit2
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.0.2'
//recyclerview and cardview
implementation 'com.android.support:recyclerview-v7:27.0.2'
implementation 'com.android.support:cardview-v7:27.0.2'
//ZXing for barCode reader
implementation 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
implementation 'com.google.zxing:core:3.2.1'
//play-services
implementation 'com.google.android.gms:play-services-maps:11.4.0'
//gson
implementation 'com.google.code.gson:gson:2.8.2'
//statusbarutil
implementation 'com.jaeger.statusbarutil:library:1.4.0'
//glide
implementation 'com.github.bumptech.glide:glide:4.6.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
//multidex
implementation 'com.android.support:multidex:1.0.1'
}
ِِActually I didn't understand the real reason about it and why that happened suddenly
So if anyone know that please tell me with full details
I hope this will help you
this worked for me after couple of hours wasting time
just do this
Implementation >>> annotationProcessor

Categories

Resources