I try to use FireBase in my App but I get several Gradle error messages:
First, look at my build gradle (module app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.example.user.finalchat"
minSdkVersion 22
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'
})
implementation 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.firebase:firebase-core:12.0.1'
compile 'com.firebaseui:firebase-ui-database:3.3.0'
compile 'com.android.support:design:26.0.0'
compile 'com.google.firebase:firebase-auth:12.0.1'
compile 'com.firebaseui:firebase-ui:3.3.0'
implementation 'com.firebaseui:firebase-ui-auth:3.3.0'
testCompile 'junit:junit:4.12'
}
When I sync my project, it throws me this error message:
Error:(27, 0) Gradle DSL method not found: 'implementation()' Possible
causes:The project 'Finalchat' 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).
The project 'Finalchat' may be using a version of Gradle that does not contain the method.
The build file may be missing a Gradle plugin
Edit: I read some questions regarding this problem, but my problem was not solved.
update build-tools via SDK Manager, then update your build.gradle to use the most recent buildToolsVersion (27.0.3 (stable), 28.0.0 (preview) atm).
Also replace all compile with implementation, the IDE will give you a warning. Also you may need to update your dependencies.
Do not downgrade, as this will break some day later.
Related
After updating Android Studio to Version 3.1.2 I'm getting an error in my app's build.gradle:
All com.android.support libraries must use the exact same version specification (...). Found versions 28.0.0-alpha1, 26.1.0. Examples include com.android.support:asynclayoutinflater:28.0.0-alpha1 and com.android.support:animated-vector-drawable:26.1.0
This is my gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "org.hopto.****.musicplayer"
minSdkVersion 23
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.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.cleveroad:audiowidget:0.9.0'
compile 'com.google.android.gms:play-services-ads:10.2.0'
compile 'com.android.support:recyclerview-v7:+'
testCompile 'junit:junit:4.12'
}
I've tried solving this by adding the following lines:
compile 'com.android.support:asynclayoutinflater:25.0.0'
compile 'com.android.support:animated-vector-drawable:25.0.0'
I've also tried this with different version, eg 25.2.0 and 25+, but none of this worked.
You are using the following support libraries:
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:recyclerview-v7:+' //error here
As you can see, your recyclerview library is using '+' which is the latest version available, that is 28.0.0-alpha1 or 26.1.0 (stable). For the rest you are using 25.2.0, thus the error with the version mismatch.
The solution is to either change recyclerview version to 25.2.0 or everything to 26.1.0 (including the recyclerview).
Side note: you should avoid using '+' in version numbers as you may come up with unexpected behavior when your libraries update.
In Android Studio,
I'm getting an error about building my app.
Error:Failed to find Build Tools revision 26.1.0
Install Build Tools 26.1.0 and sync project
This results in a blue install link, but when I click it I get an error telling me that, "Package Unavailable" and that "Packages are unavailable."
Here's what my build.gradle looks like
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
lintOptions {
abortOnError false
}
defaultConfig {
applicationId "com.example.leoconnelly.connexus"
minSdkVersion 23
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
buildToolsVersion '26.1.0'
}
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.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
implementation 'com.android.support:design:26.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
//Helpshift
// use version 26.1.0 instead of 26.0.2
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:recyclerview-v7:26.1.0'
implementation 'com.android.support:cardview-v7:26.1.0'
implementation('com.helpshift:android-helpshift-en-aar:6.4.2') {
exclude group: 'com.android.support'
exclude module: 'design'
exclude module: 'recyclerview'
exclude module: 'cardview-v7'
}
}
How do I resolve this issue? I've tried messing wth my SDK manager already. All the solutions I've found insofar do not work.
EDIT: I tried installing 26.0.1 on an a brand new project and I had the same issue.
You just have to move to SDK Platform 8.0.
It won't change things for you regarding target and min api, and the apps will still work on older Android version.
Just download this file and extract it.
https://dl.google.com/android/repository/build-tools_r26.0.2-windows.zip
copy all files from [android-8.1.0] and move them into
C:\Users\user\AppData\Local\Android\Sdk\build-tools\26.0.1
After I update the android studio to version 3.0.1, when I open my project. I have get some error and I can't see the design page but if I run the app. I have no issue.
First this error:
Warning:The specified Android SDK Build Tools version (23.0.3) is
ignored, as it is below the minimum supported version (26.0.2) for
Android Gradle Plugin 3.0.1. Android SDK Build Tools 26.0.2 will be
used. To suppress this warning, remove "buildToolsVersion '23.0.3'"
from your build.gradle file, as each version of the Android Gradle
Plugin now has a default version of the build tools.
The second error:
Failed to load AppCompat ActionBar with unknown error.
This is my build.gradle(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "ir.hosseinyha.kardoon"
minSdkVersion 16
targetSdkVersion 23
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:23.0.3'
compile 'com.github.bumptech.glide:glide:3.7.0'
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
}
Tanks for help
You should upgrade all your com.android.support dependencies to minimum supported versions (26.0.2+).
Also change tarcompileSdkVersion, buildToolsVersion, targetSdkVersion to actual values (26+ but better to support latest - 28). Note that dependencies should have same version as buildTools and targetSdk.
Codes of build.gradle(Module.app)
After,creating my project it was showing incompatible version.So,Found in internet to modify my gradle file but after modifying gradle file and changing compile sdk from 26 to 27 it's showing install the missing file .
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.2"
defaultConfig {
applicationId "com.example.thelost.fisp_beta10"
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'
})
compile 'com.android.support:appcompat-v7:27.+'
compile 'com.android.support:recyclerview-v7:27.+'
compile 'com.android.support:design:27.+'
compile 'com.android.support:cardview-v7:27.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
Error: Showing in my project
Click on the error if any, it will automatically download.
From the docs
You should always keep your Build Tools component updated by
downloading the latest version using the Android SDK Manager. If
you're using Android plugin for Gradle 3.0.0 or higher, your project
automatically uses a default version of the build tools that the
plugin specifies. To use a different version of the build tools,
specify it using buildToolsVersion in your module's build.gradle,
The latest buildToolsVersion is 27.0.1
So change
buildToolsVersion "27.0.2"
to
buildToolsVersion "27.0.1"
and sync your project.
try this in app level gradle
repositories {
maven {
url "https://maven.google.com"
}
}
This was working before I added firebaseui dependency. Now I'm getting this: log
Its red lining compile 'com.android.support:appcompat-v7:26.+' and when I hover over it, it says "all libraries must be exact same specification version". That version was what was there when the project was created.
app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.android.adarak"
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 {
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:26.+'
compile 'com.android.support:support-v4:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.firebase:firebase-auth:10.0.1'
//compile 'com.firebaseui:firebase-ui-auth:2.3.0'
compile 'com.firebaseui:firebase-ui:2.3.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
The firebaseui internally has a dependency on a specific version of Android support library. The firebase ui configuration contains 26.0.1 as the required support library version.
However your gradle file has a dependency on 26.+ which tells gradle to use the latest in the 26.x.x series and this could be different from 26.0.1. You can solve the issue by using the specific version required by firebase-ui (26.0.1)
Change the gradle file as shown below,
compile 'com.android.support:appcompat-v7:26.0.1'
compile 'com.android.support:support-v4:26.0.1'