I run Firebase database and I have an error. I have apply plugin: 'com.google.gms.google-services', but I get an error. I did not get an error when I first ran the program but now I get an error
My error:
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/common/api/zza;
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.yavuzoktay.foodapp"
minSdkVersion 19
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'
})
//Add Library
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
compile 'com.android.support:design:26.+'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Your advice important for me
Thank you very much !
You are using different versions of the same libraries:
compile 'com.google.firebase:firebase-core:9.0.0'
compile 'com.google.firebase:firebase-database:9.0.0'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
As you can read here there is a dependency between firebaseui and firebase libraries:
FirebaseUI Version Firebase/Play Services Version
2.3.0 11.0.4
2.2.0 11.0.4
2.1.1 11.0.2
2.0.1 11.0.1
..... .....
1.2.0 10.2.0
Use the same version to avoid these issue.
Related
When I run my project in my phone or in the emulator, it works fine. However, when I try to build the APK, it raises an error.
Error: Execution failed for task
':app:transformClassesWithDexForDebug'. >
com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException:
java.util.concurrent.ExecutionException:
com.android.dex.DexIndexOverflowException: method ID not in [0,
0xffff]: 65536
Here is my build.gradle.
apply plugin: 'com.android.application'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.atm_locator.cbe.cbeatmlocator"
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'
}
}
sourceSets { debug { res.srcDirs = ['src/debug/res', 'src/debug/res/html'] } }
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.volley:volley:1.0.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.7.2'
compile 'com.firebase:geofire-android:2.1.2'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.android.gms:play-services-vision:11.0.4'
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.android.gms:play-services-maps:11.0.4'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'ai.api:libai:1.6.12'
compile 'ai.api:sdk:2.0.7#aar'
compile 'com.google.code.gson:gson:2.3'
compile 'commons-io:commons-io:2.4'
testCompile 'junit:junit:4.12'
compile files('libs/httpclient-4.5.jar')
}
apply plugin: 'com.google.gms.google-services'
What the error is telling you is that you've reached the method count limit in Android. This can be solved two ways: Either you start removing dependencies or you enable multidexing. The latter can be enabled the following way:
android {
defaultConfig {
...
minSdkVersion 15
targetSdkVersion 26
multiDexEnabled true
}
...
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
}
On Android API level >= 21 you don't need the compile dependency, as this is supported natively by ART.
You can read all about this on https://developer.android.com/studio/build/multidex
For release, I'd suggest to enable proGuard to optimize your app and automatically remove not needed code. For debug builds, to simplify debugging, as mentioned above, you can enable multidex.
For proguard, read documentation: https://developer.android.com/studio/build/shrink-code - configuration may be not straightforward
Android Studio 3.0 Unable to merge dex after updating.
And i also tried so many old question from stackoverflow :-
Error:Execution failed for task
Android Studio 3.0 Unable to merge dex
but it not works for me.
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task
':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge
dex
And my app gradle file is give below:-
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.example"
minSdkVersion 15
targetSdkVersion 26
versionCode 5
versionName "1.4"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
manifestPlaceholders = [onesignal_app_id: "One Signal Key",
onesignal_google_project_number: "REMOTE"]
}
lintOptions {
checkReleaseBuilds false
}
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 files('libs/acra-4.5.0.jar')
compile files('libs/signpost-commonshttp4-1.2.1.1.jar')
compile files('libs/signpost-core-1.2.1.1.jar')
compile files('libs/signpost-jetty6-1.2.1.1.jar')
compile files('libs/twitter4j-core-2.1.6.jar')
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:design:26.1.0'
compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1#aar'
compile 'com.intuit.sdp:sdp-android:1.0.4'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.google.android.gms:play-services:11.0.2'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:multidex:1.0.0'
compile 'com.android.support:customtabs:26.1.0'
compile 'com.android.support:palette-v7:26.1.0'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.1.+'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.google.android.exoplayer:exoplayer:r1.5.7'
compile 'com.android.support:support-v4:26.1.0'
compile 'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
}
delete this statement:
multiDexEnabled true
I updated Android Studio and SDK tools to the latest version and now I got this error. I have updated Google Services and firebase dependencies accordingly. I tried to clean and rebuild the project but the result is same.
Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
> java.lang.NullPointerException: element == null
Here is my gradle build:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.crisser.beitnaonline"
minSdkVersion 16
targetSdkVersion 26
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'
}
}
}
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:cardview-v7:23.2.0') {
force = true
}
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-database:11.0.0'
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.firebase:firebase-core:11.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
compile 'com.google.android.gms:play-services-maps:11.0.0'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:multidex:1.0.1'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile
'net.yslibrary.keyboardvisibilityevent:keyboardvisibilityevent:2.1.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.appolica:interactive-info-window:v1.0.6'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
}
apply plugin: 'com.google.gms.google-services'
Anyone knows why it does that? It worked just fine with 25.0.3.
You didn't compile corresponding dependency with annotation
annotationProcessor 'com.github.bumptech.glide:compiler:4.0.0-RC0'
Add this to your gradle file
compile 'com.github.bumptech.glide:glide:4.0.0'
I have gone through same issue. I just removed the dependency I added and my app began to work fine.
you should remove library one by one and build the application..
Error
Error:Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.DexException: Multiple dex files define Lcom/google/android/gms/auth/api/signin/internal/zzf;
I get this error when i add these two dependencies together:
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebaseui:firebase-ui:0.6.0'
app build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"emphasized text
defaultConfig {
applicationId "com.techstrategies.icall"
minSdkVersion 18
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.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-auth:10.0.1'
compile 'com.firebaseui:firebase-ui:0.6.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Check the official doc.
You are using the wrong version.
FirebaseUI Version -> Firebase/Play Services Version
1.1.1 --> 10.0.0 or 10.0.1
1.0.1 --> 10.0.0 or 10.0.1
1.0.0 --> 9.8.0
0.6.2 --> 9.8.0
0.6.1 --> 9.6.1
0.6.0 --> 9.6.0
Since you are using
compile 'com.google.firebase:firebase-core:10.0.1'
you have to use:
compile 'com.firebaseui:firebase-ui:1.1.1'
or
compile 'com.firebaseui:firebase-ui:1.0.1'
EDIT:
Also since you are adding the Firebase-UI Auth library you have to add this repository:
allprojects {
repositories {
// ...
maven { url 'https://maven.fabric.io/public' }
}
}
Check the doc and this issue.
I get and error when I try to Sync project with Gradles files
Here is the error
Error:Execution failed for task ':app:processDebugGoogleServices'.
No matching client found for package name 'ua.com.qascript.android'
And here is the Gradle file content:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.0"
packagingOptions {
exclude('META-INF/NOTICE')
}
packagingOptions {
exclude('META-INF/LICENSE')
}
defaultConfig {
applicationId "ua.com.qascript.android"
minSdkVersion 14
targetSdkVersion 22
versionName '1.7'
versionCode 11
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/volley.jar')
compile('org.apache.httpcomponents:httpmime:4.3.6') {
exclude module: 'httpclient'
}
compile 'org.apache.httpcomponents:httpclient-android:4.3.5'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.google.android.gms:play-services:9.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
compile 'com.android.support:support-v4:24.2.1'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.android.support:appcompat-v7:24.2.1'
compile 'com.android.support:cardview-v7:24.1.1'
compile 'com.android.support:recyclerview-v7:24.1.1'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.android.support:design:24.2.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
}
// Add to the bottom of the file
apply plugin: 'com.google.gms.google-services'
Well, this error appear after I update the Google Play Services to can add Firebase Cloud Messages, it request minimum vers 9.0.
Please help me to fix it. Thanks.