I am trying to use Firebase in my Android Studio project and it is giving me an empty Gradle error.
I have tried using the Firebase SDK with Gradle, as well as putting the jar in my libs folder and both give the same blank Gradle error.
i have followed the Android quickstart here: https://www.firebase.com/docs/android/quickstart.html
I put in the packagingOptions and that didn't work. Without an actual error message it's very hard to debug! I haven't written any code for Firebase, i am only trying to get it to run with the Firebase Android SDK without getting a Gradle error
My project works when Firebase is not included.
Any ideas?
Thanks!
Have this content in your build.gradle (Module:app)
android {
//so default auto generated blocks will be here ...
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
} // end of android node
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.android.support:support-v4:22.0.0'
compile 'com.firebase:firebase-client-android:2.3.1'
}
Thanks for your help guys, it looks like it was a dex limit error. Adding the Firebase SDK must have put me over the limit, to fix this i had to add multiDexEnabled true in the defaultConfig section of my app:build.gradle file as well as compile 'com.android.support:multidex:1.0.0' in the dependencies
you might need to enable multidex.
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.0'
}
The complete app/build.gradle from one of my projects:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.firebaseuser.nanochat"
minSdkVersion 21
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.firebase:firebase-client-android:2.3.1+'
}
Related
When I press on run in Android studio an Edit configuration windows pops up and says "Error: Module not specified".
I have added sources to the application libs folder by manually making a folder structure android/hardware/automotive/vehicle/V2_0 and copied the files in there.
Build completes without errors.
I haven't edited the MainActivity -class so it is all pre-generated code.
I believe this error has something to do with incorrect syntax when including but it seems to be hard to get it working :)
this is my settings.gradle file:
include ':app'
project(':app').projectDir = new File('libs/android/hardware/automotive/vehicle/V2_0')
and this is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.s26150.testingopencar"
minSdkVersion 21
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'
}
}
}
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'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile project(":android.hardware.automotive.vehicle.V2_0")
testCompile 'junit:junit:4.12'
}
What could be the issue here?
thanks in advance.
Error description:
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
> com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/api/client/googleapis/auth/clientlogin/ClientLogin$Response.class
build.gradle code here
apply plugin: 'com.android.application'
android {
compileSdkVersion 'Google Inc.:Google APIs:23'
buildToolsVersion '23.0.3'
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.jasp.eventapp"
minSdkVersion 17
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.8.2'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.couchbase.lite:couchbase-lite-android:1.4-46'
//compile 'com.google.api-client:google-api-client-android:1.22.0'
//compile 'com.google.api-client:google-api-client-xml:1.22.0'
compile 'com.google.api.client:google-api-client:1.4.1-beta'
compile 'com.google.api-client:google-api-client-jackson2:1.22.0'
compile files('libs/google-api-client-1.5.0-beta.jar')
compile 'com.google.android.gms:play-services:9.2.1'
}
Any version problem in imported libs...?How can I handle this...?I tried by cleaning the project
Build - > Clean
after that rebuild, But no effect...Can any one please help me...
This error occurs when you are using duplicate version of same library, or when you use a library project which has same dependency
compile 'com.google.api.client:google-api-client:1.4.1-beta'
compile 'com.google.api-client:google-api-client-jackson2:1.22.0'
compile files('libs/google-api-client-1.5.0-beta.jar')
these three looks like same library , removing duplicate version of the library should fix your error
I had the same problem with Feign library. Look in the .idea\libraries directory in your project, find the same library with different versions and remove one. It should be help.
I am making an android app which features navigation drawer. I remember that I used some features that requires sdk version to be 24 so compileSdkVersion needs to be 24 as well as the targetSdkVersion, but my android phone is only 19 so I don't see the app downloaded on my phone, it is opened once I finished running the project but when I close the tab on my phone, I cannot open it again. So I tried to change the compileSdkVersion and targetSdkVersion to 19 but I'm having this error: Unable to find optional library: org.apache.http.legacy
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.marivel.cruz.threatmapping"
minSdkVersion 17
targetSdkVersion 19
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
signingConfigs {}
buildTypes {}
useLibrary 'org.apache.http.legacy'
}
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'
})
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.1.0'
compile 'com.google.android.gms:play-services-maps:9.8.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.google.android.gms:play-services:9.8.0'
testCompile 'junit:junit:4.12'
}
This might seem like a workaround, but try commenting out the use library line and add the following under dependencies in your gradle build file :
dependencies {
compile files('libs/httpclient-4.4.jar')
compile files('libs/httpcore-4.4.jar')
compile files('libs/httpmime-4.3.6.jar')
}
You will have to download those files from apache and add them to your libs directory. This has worked for me before, but as I said, it feels a bit like a workaround.
You can find those jar files here:
Httpclient
Httpcore
Httpmime
I want to use firebase UI in my android app, but it constantly give build error while adding dependency in `android studio
i tried the tutorial at https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app and
https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html
But both gives me same error
here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion '21.1.2'
defaultConfig {
applicationId "re.book.bookify"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.github.shell-software:fab:1.1.2'
compile 'com.github.shell-software:viewmover:1.1.0'
compile 'com.github.shell-software:uitools:1.1.0'
compile 'com.firebase:firebase-client-android:2.3.1+'
compile 'com.firebase:firebase-ui:0.2.0'
}
Please post your build.gradle First
Add the following lines to the dependencies object at the bottom:
compile 'com.firebase:firebase-client-android:2.3.1'
compile 'com.firebaseui:firebase-ui:0.2.0'
Check This Instructions
https://github.com/firebase/FirebaseUI-Android#using-the-library-in-your-android-app
Thanks Frank van Puffelen, that was the exact problem.
The gradle link given at https://www.firebase.com/blog/2015-08-27-firebaseui-makes-mobile-easy.html is not correct,
The 0.2 version of FirebaseUI was published in the com.firebaseui group. So the gradle link for it is compile 'com.firebaseui:firebase-ui:0.2.0'
I have gone through many answers for this question like:
Error :: duplicate files during packaging of APK
Gradle sync fails after adding Firebase dependency: duplicate files during packaging of APK
But still after adding packagingOptions I am getting duplicate file error.
I am working on library and here is my app build gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/NOTICE'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
compile 'com.mcxiaoke.volley:library:1.0.14'
compile 'org.apache.httpcomponents:httpclient-android:4.3.5.1'
compile('org.apache.httpcomponents:httpmime:4.3')
}
EDIT
Adding packagingOption to my sample where I am adding my library as dependency solves the problem can anyone let me know why I have to add it to my sample build.gradle? Or is there any way to remove from sample.