Error showing
i did multidexenabled true and clean,rebuild project.
the same error is happen..
Error:Execution failed for task ':mobile:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
buildToolsVersion '26.0.3'
defaultConfig {
applicationId "za.co.riggaroo.motioncamera"
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'
}
}
}
ext {
googlePlayServices = "11.8.0"
firebaseUI = "2.3.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.google.firebase:firebase-database:${googlePlayServices}"
implementation "com.google.firebase:firebase-storage:${googlePlayServices}"
implementation "com.google.firebase:firebase-auth:${googlePlayServices}"
implementation "com.google.firebase:firebase-messaging:${googlePlayServices}"
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
// FirebaseUI Database only
api "com.firebaseui:firebase-ui-database:${firebaseUI}"
api "com.firebaseui:firebase-ui-auth:${firebaseUI}"
api "com.firebaseui:firebase-ui-storage:${firebaseUI}"
api "com.firebaseui:firebase-ui:${firebaseUI}"
}
apply plugin: 'com.google.gms.google-services'
You're getting the error because you're using versions of firebase-ui and google-play-services that are not compatible with each other. You should be using either a lower play-services version
ext {
googlePlayServices = "11.0.4"
firebaseUI = "2.3.0"
}
or higher firebase-ui version
ext {
googlePlayServices = "11.8.0"
firebaseUI = "3.2.2"
}
Check this for reference
Related
ERROR: Could not find net.simonvt.schematic:-compiler:0.6.3.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/net/simonvt/schematic/-compiler/0.6.3/-compiler-0.6.3.pom
- https://dl.google.com/dl/android/maven2/net/simonvt/schematic/-compiler/0.6.3/-compiler-0.6.3.jar
- https://jcenter.bintray.com/net/simonvt/schematic/-compiler/0.6.3/-compiler-0.6.3.pom
- https://jcenter.bintray.com/net/simonvt/schematic/-compiler/0.6.3/-compiler-0.6.3.jar
Required by:
project :app
i tried to change version and change project place to make the path length less
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "android.example.com.squawker"
minSdkVersion 16
targetSdkVersion 28
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(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation'junit:junit:4.12'
// RecyclerView
implementation 'com.android.support:recyclerview-v7:28.0.0'
// Schematic dependencies for ContentProvider
apt 'net.simonvt.schematic:-compiler:0.6.3'
implementation 'net.simonvt.schematic:schematic:0.6.3'
// Preferences Dependencies
implementation 'com.android.support:preference-v7:28.0.0'
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "android.example.com.squawker"
minSdkVersion 16
targetSdkVersion 28
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(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:28.0.0'
testImplementation'junit:junit:4.12'
// RecyclerView
implementation 'com.android.support:recyclerview-v7:28.0.0'
// Schematic dependencies for ContentProvider
apt 'net.simonvt.schematic:-compiler:0.6.3'
implementation 'net.simonvt.schematic:schematic:0.6.3'
// Preferences Dependencies
implementation 'com.android.support:preference-v7:28.0.0'
}enter image description here
Project level "build.gradle" remove this line:
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
App level "build.gradle" remove this line:
apply plugin: 'android-apt'
and change this line replacing apt with annotationProcessor:
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
Looks like you have the dependency path wrong. Can you try changing your dependency block to:
annotationProcessor 'net.simonvt.schematic:schematic-compiler:0.6.3'
compile 'net.simonvt.schematic:schematic:0.6.3'
Note that it should be schematic-compiler, not -compiler.
After implementing Firebase Cloud Messaging to my project I was getting an error during a run time Failed to merge manifest, so I migrate my app to Androidx. After migrating to androidx I'm getting this error
"Cannot specify -processorpath or --processor-path via CompileOptions.compilerArgs. Use the CompileOptions.annotationProcessorPath property instead."
My build.gradle(Module: app) file
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "android.example.com.squawker"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
dependencies {
implementation ('com.google.firebase:firebase-messaging:20.0.0')
{force= true}
implementation fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('androidx.test.espresso:espresso-
core:3.1.0',
{
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.0.2'
testImplementation 'junit:junit:4.12'
// RecyclerView
implementation 'androidx.recyclerview:recyclerview:1.0.0'
// Schematic dependencies for ContentProvider
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
implementation 'net.simonvt.schematic:schematic:0.6.3'
// Preferences Dependencies
implementation 'androidx.preference:preference:1.0.0'
}
The problem is here.Remove this line from code.
apply plugin: 'android-apt'
And use only this plugin.
apply plugin: 'com.android.application'
From Android Gradle plugin version 2.2 or above android-apt is deprecated for this versions and all functionality that was previously provided by android-apt is now available in the Android plugin. You can read more about this from here.
I'm trying to use the new Navigation Architecture Component for android and I'm getting the error
Failed to resolve: androidx.lifecycle:lifecycle-viewmodel-ktx:1.1.1
when I'm defining the lifecycle_version to "1.1.1"
I'm basically just copying and pasting what is in the documentation so I'm running out of ideas of what is wrong in here :(
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.mobile.codgin.newnavigation"
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 {
def lifecycle_version = "1.1.1"
// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
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.0'
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
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'
}
try replace
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
with this
//https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel-ktx
implementation group: 'androidx.lifecycle', name:'lifecycle-viewmodel-ktx', version: '2.0.0-alpha1'
then sync again.
You can have a look here :
https://mvnrepository.com/artifact/androidx.lifecycle/lifecycle-viewmodel-ktx/2.0.0-alpha1
it seems to be that the repository was emptied somehow. Hence, you can not download it from the repository.
When it shows you this error add this code to section build.gradle
configurations {
all {
exclude group: 'androidx.lifecycle', module: 'lifecycle-viewmodel-ktx'
}
}
i am doing project on motion sensor camera using android things and firebase and notification through mobile
Error:Execution failed for task
':mobile:transformDexArchiveWithExternalLibsDexMergerForDebug'.
com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
i add "multidexenabled true" but no solution
this is App level gradle
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "za.co.riggaroo.motioncamera"
minSdkVersion 27
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true //Added this
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
ext {
archVersion = '1.1.0'
playServices = "11.8.0"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation "com.google.firebase:firebase-core:${playServices}"
implementation "com.google.firebase:firebase-database:${playServices}"
implementation "com.google.firebase:firebase-storage:${playServices}"
implementation "com.google.firebase:firebase-auth:${playServices}"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
implementation "com.android.support:animated-vector-drawable:27.1.0"
implementation "com.android.support:support-v4:27.1.0"
implementation "com.android.support:support-media-compat:27.1.0"
implementation "com.android.support:cardview-v7:27.1.0"
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
compileOnly 'com.google.android.things:androidthings:0.7-devpreview'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "android.arch.lifecycle:runtime:${archVersion}"
implementation "android.arch.lifecycle:extensions:${archVersion}"
annotationProcessor "android.arch.lifecycle:compiler:${archVersion}"
implementation "com.android.support:appcompat-v7:27.1.0"
compile 'com.android.support:support-vector-drawable:27.1.0'
}
apply plugin: 'com.google.gms.google-services'
I'm trying to set up an app where data module is a library and presentation layer is the actual android app. Ideally I want the firebase dependency to just live in the data module however apply plugin: 'com.google.gms.google-services' can only be called from the presentation module.
Putting dagger 2 and firebase dependency together gives me the following error:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':presentation:transformDexArchiveWithExternalLibsDexMergerForDebug'.
> java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Removing the firebase auth dependency or dagger 2 dependency resolves this issue. How can I use both of these libraries together in the data module?
My build.gradle for data
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation('com.android.support.test.espresso:espresso-core:3.0.1', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "android.arch.lifecycle:extensions:1.0.0-alpha9-1"
compile 'com.google.dagger:dagger:2.11'
kapt 'com.google.dagger:dagger-compiler:2.11'
compile 'com.google.firebase:firebase-auth:11.4.2'
}
And build.gradle for presentation:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
def configs = rootProject.extensions.getByName("ext")
compileSdkVersion configs["compileSdkVersion"]
buildToolsVersion configs["buildToolsVersion"]
defaultConfig {
applicationId configs["androidApplicationId"]
minSdkVersion configs["minSdkVersion"]
targetSdkVersion configs["targetSdkVersion"]
versionCode configs["versionCode"]
versionName configs["versionName"]
testInstrumentationRunner configs["testInstrumentationRunner"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '26.0.2'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':data')
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation "junit:junit:$rootProject.junitVersion"
androidTestImplementation("com.android.support.test.espresso:espresso-core:$rootProject.espressoVersion", {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'
Here is the top level build file (if needed)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.4-3'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta7'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:3.1.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
ext {
//Android
androidApplicationId = 'com.test.myapp'
minSdkVersion = 19
targetSdkVersion = 26
versionCode = 1
versionName = "1.0"
compileSdkVersion = 26
buildToolsVersion = "26.0.2"
//Libraries
supportLibraryVersion = '26.1.0'
//Testing
testInstrumentationRunner = "android.support.test.runner.AndroidJUnitRunner"
junitVersion = "4.12"
espressoVersion = "3.0.1"
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
It seems like the problem was with the google-services version. The issue resolved for me after I updated the play services version:
classpath 'com.google.gms:google-services:3.1.1'
from 3.1.0