I am trying to use firebase with my App and i did all the steps listed in the official website of firebase on how to add the google-service plugin and the firebase products into both my module and project build.gradle , but i still got this list of errors :
ERROR: Gradle DSL method not found: 'implementiation()' Possible
causes:
1-The project 'FriendlyChat' may be using a version of the Android
Gradle plug-in that does not contain the method (e.g. 'testCompile'
was added in 1.1.0).
2-The project 'FriendlyChat' may be using a version of Gradle that
does not contain the method.
3-The build file may be missing a Gradle plugin.
and i referred to the possible solutions here on stackoverflow but i got the same results.
here's my project:buidl.gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// 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
}
here's my app:build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.friendlychat"
minSdkVersion 16
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementiation 'com.google.firebase:firebase-perf:19.0.4'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
api 'com.google.android.material:material:1.1.0-alpha06'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
androidTestImplementation 'androidx.test:core:1.1.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test:runner:1.2.0-alpha05'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0-alpha05'
}
It's a typo in your build.gradle. You have used implementiation instead of implementation.
Change this like below:
implementation 'com.google.firebase:firebase-perf:19.0.4'
instead of
implementiation 'com.google.firebase:firebase-perf:19.0.4'
Related
I have an One year old code, which I worked so hard on, this code uses picasso library in some places to download images and use them. Today I try to improve my code, migrate to androidx and upgrade Gradle to the latest version, but it doesn't seem to sync gradle file anymore, when I comment the implementation for picasso library, the sync goes smoothly again.
Google recommends migrating to androidx to be able to serve the latest android versions, the latest play services and jetpack libraries. What is the problem? and how it can be solved?
This is my Gradle app level file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.ramikabbani.sheikhsouk"
minSdkVersion 19
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'
// Glide
implementation 'com.github.bumptech.glide:glide:4.9.0'
implementation 'com.google.android.material:material:1.1.0'
//
}
and this is my top level project gradle file:
// 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.6.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
}
This is the old project app level gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.dalilukom.dalilukom"
minSdkVersion 19
targetSdkVersion 29
versionCode 21
versionName "1.21"
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'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.16'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.bumptech.glide:glide:3.8.0'
//implementation 'com.android.volley:volley:1.1.1'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-v4:26.1.0'
// implementation 'com.amitshekhar.android:android-networking:1.0.2'
// implementation 'com.android.support:design:26.1.0'
// implementation 'com.android.support:appcompat-v7:27.1.1'
// implementation 'com.android.support:design:27.1.1'
//implementation 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
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'
}
and this is the top level gradle file for the old project too:
// 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.6.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
}
Just migrate to androidx and get the Picasso dependency for androidx on your grade file. You should be fine
Just found a workaround.
In build.gradle (project:..) , of the project gradle file ,downgrade plugin to '7.2.1' and recompile.
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
}
and it works , seems like it unsupported on later versions.
But I think you should change the file gradle.properties( Project properties ) under android.useAndroidX=true
Put:
android.enableJetifier=true
putting whole file content of gradle.properties( Project properties )
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true
android.nonTransitiveRClass=true
I haven't used compile anywhere either in App or Project level build.gradle file. But still I am getting this error.
I went through other questions related to this on stackoverflow but most solutions suggested to replace compile with api or implementation, But since I didn't use it anywhere I can't find a fix. Please help.
App Level build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.smartseller"
minSdkVersion 18
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.google.firebase:firebase-database:17.0.0'
implementation 'com.android.support:design:28.0.0'
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:gridlayout-v7:28.0.0'
implementation 'com.google.zxing:core:3.2.1'
implementation 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
}
Project Level build.gradle
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath 'com.google.gms:google-services:3.0.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
}
Warning Code I got
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
Affected Modules: app
I am using android studio version 3.4.1
Change this in your App Level build.gradle
might be issue with this dependency
Replace this
implementation 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
With this
implementation 'com.journeyapps:zxing-android-embedded:3.6.0'
-:For Android 14+ support, downgrade zxing:core to 3.3.0 or earlier:-
implementation('com.journeyapps:zxing-android-embedded:3.6.0') { transitive = false }
implementation 'com.google.zxing:core:3.3.0'
Reference Link
Happy Learning ...
Try updating com.google.gms:google-services from 3.0.0 to 3.2.0 or any other latest version.
I can't run my project after adding the #EActivity Annotation to my class.
This is my Gradle Project:
// 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.3.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// 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
}
This is my Gradle Module:app
apply plugin: 'com.android.application'
def AAVersion = '4.2.0'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.tasks"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.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:28.0.0'
annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
implementation "org.androidannotations:androidannotations-api:$AAVersion"
}
After I added the Android Annotations in my Gradle I noticed that my AndroidMannifest didn't get automatically modified (Missing the _ in the activity), and when I add that manually it gets highlighted in red.
If I run the project normally (Without modifying the AndroidMannifest or changing the class to Annotations) it will run normally.
If I add the annotations and modify the Manifest I'll receive the error:
error: Could not find the AndroidManifest.xml file, using generation
folder
[C:\Users\Asusc\AndroidStudioProjects\Tasks\app\build\generated\source\apt\debug])
Any idea what I might be doing wrong?
In my case, adding this to build.gradle fixed it:
android {
...
defaultConfig {
...
javaCompileOptions {
annotationProcessorOptions {
arguments = ["androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
}
}
}
}
You should update to AndroidAnnotations 4.6.0 . This version has Android Gradle Plugin 3.3.+ support.
If you are using AndroidAnnotations 4.6.0 with Android Gradle Plugin 3.5.+, you can downgrade the Android Gradle Plugin version to 3.4.1 to fix.
classpath 'com.android.tools.build:gradle:3.4.1'
I've been getting this error and have tried all the steps to fix I've found online. The error says a gms/firebase library is the wrong version but there are no firebase dependancies in the app.
The error:
"All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 16.0.1, 16.0.0. Examples include com.google.android.gms:play-services-base:16.0.1 and com.google.android.gms:play-services-maps:16.0.0"
The dependency com.google.android.gms:play-services-maps:16.0.0 is not in my dependencies and yet it still says it's the wrong version compared with the play-services-maps.
I've tried changing play-services-maps to 16.0.1 but that version doesn't exist. I've also tried adding implementation 'com.google.android.gms:play-services-base:16.0.0' to the file, but it gives the same error.
My Build.gradle (App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.nameomitted"
minSdkVersion 24
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:26.1.0'
implementation 'com.google.android.gms:play-services-maps:16.0.0'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:support-v4:26.1.0'
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'
}
My Build.gradle (project)
// 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.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
}
Thanks in advance
I am trying to install the latest release Navigation in Architecture components .
i am following this document Tutorial link
When i am trying to sync it is giving error .
Could not find androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01.
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.pom
https://dl.google.com/dl/android/maven2/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.jar
https://jcenter.bintray.com/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.pom
https://jcenter.bintray.com/androidx/navigation/safe-args-gradle-plugin/1.0.0-alpha01/safe-args-gradle-plugin-1.0.0-alpha01.jar
Required by:
project :
Module Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.ard.navigationapp"
minSdkVersion 19
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 fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
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'
def nav_version = "1.0.0-alpha01"
implementation 'android.arch.navigation:navigation-fragment:$nav_version' // use -ktx for Kotlin
implementation 'android.arch.navigation:navigation-ui:$nav_version' // use -ktx for Kotlin
// optional - Test helpers
androidTestImplementation 'android.arch.navigation:navigation-testing:$nav_version' // use -ktx for Kotlin
}
apply plugin: 'androidx.navigation.safeargs'
Project 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.1.2'
classpath "androidx.navigation:safe-args-gradle-plugin:1.0.0-alph
a01"
// 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
}
That artifact does not seem to exist, based on what's in https://maven.google.com right now. Try android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01 instead. See also this issue.
Try to add
classpath "android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0-alpha01"
instead of
classpath "androidx.navigation:safe-args-gradle-plugin:1.0.0-alpha01"
If you're not concerned with type-safety of argument, you can skip the Safe args part and you will be good to go with Navigation Component.