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.
Related
I am attempting to add Firebase App Distribution via Gradle to my Android app and seeing this error: 'Plugin with id 'com.google.firebase.appdistribution' not found.'
The app can build normally if I comment out 'apply plugin: 'com.google.firebase.appdistribution''
I have made a new sample app and am just trying to get it build with the plugin 'com.google.firebase.appdistribution'. I have followed these steps to a T (https://firebase.google.com/docs/app-distribution/android/distribute-gradle) and still am seeing this error
Here is my app module build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.firebase.appdistribution'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
repositories {
google()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.core:core-ktx:1.1.0'
implementation 'com.google.firebase:firebase-appdistribution-gradle:1.1.0'
implementation 'com.google.firebase:firebase-analytics:17.2.1'
implementation 'com.google.firebase:firebase-auth:19.1.0'
implementation 'com.google.firebase:firebase-firestore:21.2.1'
}
apply plugin: 'com.google.gms.google-services' // Google Play services Gradle plugin
I am expecting it to at least build but it seems it can't even find the plugin. Did upload it incorrectly or something?
This is not a Java dependency; it reads classpath and not implementation.
You'd need to add that Gradle plugin into the root project's build.gradle:
buildscript {
repositories {
google()
}
dependencies {
classpath "com.google.firebase:firebase-appdistribution-gradle:1.1.0"
}
}
Android studio will successfully import local modules (Android project modules) but won't actually find them. If I change the same module to just a java-library, then it will work fine and find those dependencies. I'm really not sure why. The app successfully compiles with attempting to include the given module, however when I try to reference a class from the imported module, it doesn't find it. ./gradlew app:dependencies thinks it's importing it but it can't find it still. AFAIK this is the exact same setup I'ved used in various other projects but I'm not seeing any differences.
build.gradle for tasks
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.objectbox'
android {
compileSdkVersion 27
defaultConfig {
applicationId "io.danielhartman.tasks"
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 Libs.support_annotations
implementation Libs.support_appcompat_v7
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 "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation Libs.room_imp
kapt Libs.room_annotation_processor
implementation project(path: ':common', configuration:'default')
implementation Libs.recyclerview
implementation Libs.livedata
}
repositories {
mavenCentral()
}
build.gradle for app
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "io.danielhartman.lyfe"
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"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation"com.android.support:cardview-v7:27.1.1"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-vector-drawable:27.1.1'
implementation project(path: ':tasks', configuration:'default')
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 project(path: ':tasks', configuration: 'default')
}
repositories {
mavenCentral()
}
I realized I was using
apply plugin: 'com.android.application'instead ofapply plugin: 'com.android.library'.
Title, I can't add the packages needed to add google sign in
Gradle 4.4, Gradle plugin 3.1.3, Google services 4.0.1
Added Firebase dependencies
implementation 'com.google.firebase:firebase-core:16.0.1'
implementation 'com.firebaseui:firebase-ui-auth:4.0.0'
implementation 'com.google.firebase:firebase-auth:15.0.1'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
...
apply plugin: 'com.google.gms.google-services'
downloaded GooglePlayServices SDK as well. I still don't have the SignInButton (get 'SignInButton button cannot resolve')
what am I missing
There might be some other issue. I think you don't need to add apply plugin: 'com.google.gms.google-services'.
I used the same implementation 'com.google.android.gms:play-services-auth:15.0.1' version just now and I am able to get SignInButton. Below is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
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'])
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:26.+'
implementation 'com.android.support:design:26.+'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-auth:15.0.1'
testImplementation 'junit:junit:4.12'
}
Screenshot from layout xml file:
Can you confirm that you are able to build your project successfully? If not then please make sure your project is built successfully without any error and then try to add SignInButton. You will get it.
For more information, follow this official link : https://developers.google.com/identity/sign-in/android/sign-in
I recently upgraded Android Studio to 3.1 and I am tuck with version conflict problem.My Gradle version is 4.4 and Andoid plugin version is 3.0.0. I tried changing it to 3.1.1.It gets reverted back to the previous version mumber. It is getting confusing for me,so your help is needed. When syncing I get the following message in the Build.
Version Conflict:
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.4.2.
build.gradle/app
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.globemaster.samples"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.0.0'
implementation 'com.android.support:design:27.0.0'
implementation 'com.payumoney.sdkui:plug-n-play:1.2.0'
implementation 'com.google.firebase:firebase-auth:15.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
testImplementation 'junit:junit:4.12'
implementation 'com.google.firebase:firebase-core:15.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.1.0'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
implementation 'com.google.android.gms:play-services-location:15.0.0'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath 'com.google.gms:google-services:3.2.1'
// 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
}
Move this line at last
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.globemaster.samples"
minSdkVersion 16
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//
//
}
apply plugin: 'com.google.gms.google-services'
At the bottom of the (app)build.gradle script and rebuild the project.
Note:- I think that it has to do something with referencing
dependencies that have not yet been created. Something like calling a
variable before you even declare it
Pls add below code in your app build gradle.file
apply plugin: 'com.google.gms.google-services'
I hope this will work for you
Change your classpath to 3.1.1
classpath 'com.android.tools.build:gradle:3.1.1'
And apply plugin after dependencies in app gradle file
apply plugin: 'com.google.gms.google-services'
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