This is my app level build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 16
targetSdkVersion 24
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'])
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:design:24.2.1'
compile 'com.android.support:cardview-v7:24.2.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
compile 'org.jsoup:jsoup:1.10.2'
compile 'com.google.firebase:firebase-messaging:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I have tried:
Building/Cleaning the project.
Invalidate Caches/Restart.
Enabling multidex gives new errors and does not work.
Version 9.6.1 of the firebase-messaging library builds the apk but app crashes on start up.
Updated the versions of google support repository/play services.
I use only the messaging library so different version numbers are not the problem. Adding the firebase-core library seems to be of no use.
Used API level 25 as well.
Needless to say, I double-checked the project-level build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have searched and tried many related answers on stackoverflow but failed to come up with a solution.
Possible solution:
Version 9.6.1 builds the apk but crashes the app on startup. Maybe the problem is with the version.
Here is the error:
Error:Error converting bytecode to dex:
Cause: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zze;
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
Related
I am trying to add firebase push notifications to app. I started with a fresh application with Basic Activity but facing errors
First I got below error during gradle build
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in
project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1)
differ. See https://d.android.com/r/tools/test-apk-dependency-
conflicts.html for details.
then I added dependency in app level build.gradle and issue resolved
implementation 'com.android.support:support-annotations:27.1.1'
then I got some font related errors which was resolved by changing compileSdkVersion 28
from 26 in app gradle build
Then I followed the steps to add firebase to my project. The gradle sync worked properly but when I am trying to Run the app in my connected device its showing
Error:
Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
I tried a few solutions from but none of them worked for me.
app level build.gradle
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.rakesh.firecast"
minSdkVersion 22
targetSdkVersion 26
versionCode 1
versionName "1.0"
multi
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
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 'com.android.support:support-annotations:27.1.1'
implementation 'com.google.firebase:firebase-core:17.0.0'
}
apply plugin: 'com.google.gms.google-services'
Project level build.gradle
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
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 help me figure it out and resolve this issue
I'm having a lot of issues when I changed firebase version to 11.4.2, it was working well before. But when I changed it caused several issues such
as:
com.google.firebase:firebase-database:11.4.2
Error:Failed to resolve: com.android.support:support-v4:26.1.0
Error:Failed to resolve: com.android.support:recyclerview-v7:26.1.0
Error:Failed to resolve: android.arch.lifecycle:runtime:1.0.0-beta1
Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "28.0.2"
defaultConfig {
applicationId "com.andisofttechnology.foodapp"
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'
}
}
}
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'
})
//Add Library
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-database:9.2.1'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support:cardview-v7:+'
compile 'com.android.support:recyclerview-v7:+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.firebaseui:firebase-ui-database:3.1.0'
compile 'com.android.support:design:25.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
app
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
/* maven { url "https://maven.google.com" }*/
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
But when I changed it caused several issues such
as:But when I changed it caused several issues such
as:But when I changed it caused several issues such
as:But when I changed it caused several issues such
as:But when I changed it caused several issues such
as:
But when I changed it caused several issues such
as:
But when I changed it caused several issues such
as:
It's always a good thing to specify in our projects the last stable version of the libraries we use, specially when it comes with libraries such as Firebase, that could lead to a lot of dependency conflicts.
You can find the latest versions for each Firebase's library here: https://firebase.google.com/docs/android/setup#available_libraries
Refer to them in your build.gradle, and your issue should be solved.
I have an android app that I want to add firebase messaging service functionality so I can receieve notifications that are sent from my self-built server to the firebase cloud.
I started adding the configuration lines to the gradle files, but after adding the
apply plugin: 'com.google.gms.google-services'
line, I get an error as follows:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.0.2.
This is my module:app gradle script file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "br.com.berait.brecar"
minSdkVersion 21
targetSdkVersion 25
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:25.3.1'
compile 'com.google.android.gms:play-services-maps:11.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.okhttp3:okhttp:3.8.1'
compile 'com.android.support:design:25.3.1'
compile 'com.wdullaer:materialdatetimepicker:3.2.2'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.7'
compile 'com.google.firebase:firebase-messaging:10.2.6'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
if needed, this is my project level gradle script file:
//Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I have searched S.O for sometime now and all the answers to this type of error haven't worked for me. As you can see, i have the apply plugin line at the bottom of the file. I believe the conflict is being generated by the
compile 'com.google.android.gms:play-services-maps:11.0.2'
line, which was automatically added when I added google maps API support to my application.
Any help is appreciated, thanks in advance!
Bump up the firebase dependency version to
compile 'com.google.firebase:firebase-messaging:11.0.2'
or lower the maps dependency to
compile 'com.google.android.gms:play-services-maps:10.2.6'
I am using Android Studio 2.3 on a mac mini.
I began by opening a fresh project.
MainActivity is a loadingScreen
connect project to firebase using Firebase Assistant
Write to firebase
Everything works up to here.
Then I attempt to add a GoogleMaps Activity and the project no longer compiles. The error I am being shown is:
Error:Execution failed for task ':app:processDebugGoogleServices'.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.0.1.
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "us.n_e_ar.akita"
minSdkVersion 14
targetSdkVersion 25
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:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha8'
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
And here is the other gradle file
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Thank you in advance.
The versions of the Firebase and Google Play Services libraries must be identical. You can either downgrade to 10.0.1:
compile 'com.google.firebase:firebase-database:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
or upgrade to 10.2.1:
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.android.gms:play-services-maps:10.2.1'
While you updating, it's probably wise to use the latest constraint layout lib:
compile 'com.android.support.constraint:constraint-layout:1.0.2'
Trying to compile my android app with google app engine module but the darn thing won't work. It WAS working before but for some reason after I cleared my Android Studio cache and restarted, it stopped compiling. Here is the error I get:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> java.io.IOException: Failed to delete /Users/Me/AndroidStudioProjects/MyCoolApp/app/build/intermediates/pre-dexed/debug/appengine-api-1.0-sdk-1.9.18_0179742441e08a2aeb8477eb85038e2130d180e7.jar
I checked the folder and the above file does not even exist - so why does it try to delete it?
I also tried putting in a dummy file with the above name hoping that might work but it did not.
Here are what my gradle files look like:
app
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.me.mycoolapp"
minSdkVersion 13
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:8.4.0' //Needed for GCM
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':backend')
}
apply plugin: 'com.google.gms.google-services' // Needed for GCM
Project:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3' // Needed for GCM
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Very dumb but for some reason (I have no clue why) Android studio added this line to my file
compile project(':backend')
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services-gcm:8.4.0' //Needed for GCM
testCompile 'junit:junit:4.12'
compile project(path: ':backend', configuration: 'android-endpoints')
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
//compile project(':backend') //DELETE THIS
}
Man, Android Studio + GAE module getting really annoying to make these days...
In your build.gradle script, set the dexOptions.javaMaxHeapSize configuration
android {
...
...
dexOptions {
javaMaxHeapSize "4g"
}
}