Setting up firebase on Android studio - android

I am trying to setup firebase on my android studio.I am using a 2.2.3 version.So this is my code in app.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.parth.carpool"
minSdkVersion 22
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-a`enter code here`nnotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.google.firebase:firebase-core:16.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is the error that I am receiving.
Error:(27, 13) Failed to resolve: com.google.firebase:firebase-core:16.0.1
This is my project.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:4.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
To correct this error I installed google play services, google repository, SDK platform,SDK platform tools etc. after I saw some of the posts on stackoverflow. Does anybody have a solution?

First you need to upgrade android studio to the newest version:
If you're not using Android Studio 3.1 to develop your app, you will need to upgrade in order to get the correct version checking behavior within the IDE.
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Then you need to use the following top level gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Android Studio provides Awesome tool called Firebase Assistant, it handles any thing you need to setup firebase in you'r project
from Tools->Firebase
just pick which product you want and it'll do all the work for you

Make sure you are connected to a good network
Goto >file -> other settings -> Under build, execution, and deployment
-> you will see Gradle. uncheck the checkbox offline work. Then rebuild your project.
buildscript {
repositories {
// add google here
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:4.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Did you try on this link
In your root build.gradle file add the repo:
maven { url "https://maven.google.com" }

It depends upon you how you want to setup you can try both explicit way and implicit way of setting up firebase .the easiest one is implicit one which is given in android studio

Related

Android Studio project sync FAILED

I attempted to import a project that Udacity's android course provided, but there were some issues. In the build.grade(app module) I changed compile toimplementation and testCompile to testImplementation. The project synced successfully, but when I executed the project on the emulator it gave me the following errors.
Could not find com.android.tools.build:aapt2:3.3.1-5013011.
Searched in the following locations:
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
- https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
Required by:
project :app
I think the required libraries needed to build cannot be found, but I don't know how to solve this. I googled the problem, but I can't find a solution.
My build.gradle file is this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
defaultConfig {
applicationId "com.example.android.miwok"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
api 'com.android.support:appcompat-v7:23.3.0'
api 'com.android.support:support-v4:23.3.0'
api 'com.android.support:design:23.3.0'
}
build.grade(project) is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Beginning with Android Studio 3.2, the source for AAPT2 (Android Asset Packaging Tool 2) is Google's Maven repository.
To use AAPT2, make sure that you have a google() dependency in your build.gradle file.
allprojects {
repositories {
google()
jcenter()
}
}
Check the official documentation.
The AAPT2 (Android Asset Packaging Tool) is a build tool that Android Studio and Android Gradle Plugin.
Android Gradle Plugin 3.0.0 and higher enable AAPT2 by default.
With Android Studio 3.2 to use AAPT2, make sure that you have a google() dependency in your build.gradle:
buildscript {
repositories {
google() // here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
} allprojects {
repositories {
google() // and here
jcenter()
}

Kotlin compile "ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher." but no kotlin_version in build.gradle?

I tried cloning and building this project, https://github.com/mitrejcevski/ui-testing, but upon opening it in Android Studio, I get the following build error:
ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher.
The following dependencies do not satisfy the required version:
root project 'ui-testing' -> org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.21
Affected Modules: app
However, when I click the 'app' hyperlink I am led to the module-level build.gradle file, which reads
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
applicationId "nl.jovmit"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
mock {
flavorDimensions "default"
}
prod {
flavorDimensions "default"
}
}
android.variantFilter { variant ->
if (variant.buildType.name == 'release' && variant.getFlavors().get(0).name == 'mock') {
variant.setIgnore(true)
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
testImplementation 'junit:junit:4.12'
}
Unlike the accepted answer of ERROR: The Android Gradle plugin supports only Kotlin Gradle plugin version 1.3.0 and higher, I don't see any ext.kotlin_version anywhere in the Gradle file.
I do see this warning, though, that kotlin-stdlib-jre7 is deprecated:
However, I tried changing this but still get the same error. I've also tried adding the line
implementation 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.21'
to dependencies (as seen in the screenshot above), but that also didn't prevent the error.
Any idea how to fix this? I suspect that the outdated Kotlin version is a 'sub-dependency' of one of the dependencies here, but haven't been able to figure out which one.
Define your ext.kotlin_version
Your project level build.gradle should look like this.
buildscript {
ext.kotlin_version = '1.2.51'
ext.android_plugin_version = '3.2.1'
repositories {
google()
jcenter()
}
dependencies {
classpath "com.android.tools.build:gradle:$android_plugin_version"
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
}
}
Change
org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version
instead of
org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version
Go to Tools > SDK Manager > Kotlin
Install new plugin version
Make sure your project level build.gradle looks as the one below
buildscript {
ext.kotlin_version = '1.3.10' //put the version you just updated to
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
I faced this problem too and I fixed it by doing the following:
In project level build.gradle, I have ext.kotlin_version = '1.3.10'
buildscript {
ext.kotlin_version = '1.3.10'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
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
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
ext {
roomVersion = '1.0.0'
archLifecycleVersion = '1.1.0'
}
Then in app level build.gradle, I updated my dependencies to have this:
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
I built, and everything worked fine again.
Go to External Libraries / Flutter Plugins / ui_testing / android / build.gradle and changed ext.kotlin_version to LATEST_VERSION.
2022 Solution for "Your project requires a newer version of the Kotlin Gradle plugin"
In order to build a Kotlin project with Gradle, you should apply the Kotlin Gradle plugin to your project and configure the dependencies.
In your root Project then Android/build.gradle
buildscript {
ext.kotlin_version = '1.5.31'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath 'com.google.gms:google-services:4.3.10'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.31'
}
}
//$kotlin_version removed it to 1.5.31
allprojects {
repositories {
google()
mavenCentral()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Just go to your project level build file
and change the following
buildscript {
ext {
kotlin_version = '1.3.10'
support_version = '28.0.0-rc02'
room_version = '1.1.1'
arch_comp_version = '1.1.1'
}
}
Just update kotlin version to 1.3.10 or higher.This would fix it.
I'm facing this issue while using watermelondb.
I have resolved this issue by doing this
npm install react-native-screens#3.13.1
buildscript{ ext {
kotlinVersion = "1.5.20" //add this line in build.gradle file } }
In react-native you need to use ext.kotlinVersion and NOT ext.kotlin_version.
Because all the dependancies try to get rootProject.ext.kotlinVersion for this reason if it is not found then they fallback to default. And for this reason you get the error of different Kotlin versions being used.
Change your kotlin dependency to:
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.4.21"
update your project level build.gradle
ext.kotlin_version = 'your_current_version' to ext.kotlin_version = '1.6.10'
You can access last version => https://kotlinlang.org/docs/gradle.html#targeting-the-jvm
Make Sure you've added ext.kotlin_version = '1.6.0' and classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" to Project/build.gradle and also enable multiDexEnabled true in app/build.gradle
defaultConfig {
multiDexEnabled true
}
buildscript {
ext.kotlin_version = '1.6.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
google()
jcenter()
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Could not find support-media-compat.aar

Trying Firebase to an android gradle app. As soon as I add the firebase dependency I get the following build error.
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find support-media-compat.aar (com.android.support:support-media-compat:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-media-compat/26.1.0/support-media-compat-26.1.0.aar
> Could not find support-core-utils.aar (com.android.support:support-core-utils:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-core-utils/26.1.0/support-core-utils-26.1.0.aar
> Could not find support-compat.aar (com.android.support:support-compat:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar
> Could not find support-compat.aar (com.android.support:support-compat:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar
It looks like it's only searching jcenter. But every reference of jcenter has other repos listed to search.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.2.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com'
}
}
}
app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "io.nme.samples.displayingabitmap"
minSdkVersion 16
targetSdkVersion 28
versionCode 181
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
api 'com.android.support:appcompat-v7:24.2.1'
api 'com.android.support:support-v4:24.2.1'
testImplementation 'junit:junit:4.12'
dependencies {
api project(':extension-api')
api project(':haxe-firebase')
}
implementation 'com.google.firebase:firebase-core:16.0.4'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
What am I missing here?
I came across the same issue about locating libraries. However by adjusting the repositories order, this issue has been resolved.
repositories {
google()
jcenter()
// others
}
It seems that a maven site hosted by google is what we're looking for in the first place.
BTW, maven { url 'https://maven.google.com'} is used for Gradle version lower than 4.1 and google() is the newer form of that. See also this doc.
api 'com.android.support:appcompat-v7:24.2.1'
api 'com.android.support:support-v4:24.2.1'
That's your problem right there. Even without Firebase, this should've been causing issues. You're targeting and building with API 28, but your support dependencies are at API 24. Change them to use 28.0.0.
Also check your extension-api and haxe-firebase projects and make sure they're using the latest compile and SDK versions, as well as build tools version and support library versions.
You have to Replace 26.1.0 and use support library of version 28.0.0
use below
buildscript {
ext.kotlin_version = '1.2.20'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'2.3.3
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
allprojects {
repositories
{
maven { url "https://dl.google.com/dl/android/maven2/" }
maven { url "http://jcenter.bintray.com/" }
maven { url 'https://plugins.gradle.org/m2/'}
maven { url "https://maven.google.com" }
maven { url 'https://jitpack.io' }
mavenCentral()
flatDir {
dirs 'libs'
}
}
}

Gradle Project Sync Failed, Kotlin

I am using a beta Kotlin and Android-Studio channel. After update to the latest version i got some gradle sync error.
Below are the log i copied from Event Log:
Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39.
Searched in the following locations:
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
Required by:
project :
below is the build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.0-rc-39'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
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
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
below is the app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.udebest.myapplication"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
postprocessing {
removeUnusedCode false
removeUnusedResources false
obfuscate false
optimizeCode false
proguardFile 'proguard-rules.pro'
}
}
}
}
dependencies {
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.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'
}
Please, anyone has an idea about this? I don't really know how can I solve this? I could not find any solutions out there.
Change your repositories in buildscript and allprojects into:
{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
This works for me.
First, I updated Kotlin plugin thru tool, Kotlin, configure kotlin plugin update.
After, in App directory, in build.Gradle file search:
repositories {
// You need to add the following repository to download the
// new plugin.
google()
}
I add a new repository
maven { url 'C:/Program Files/Android/Android Studio/gradle/m2repository/'}
this is the path thru my local directory where the resources are. After this try again to sync
Change and try
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
to
classpath 'com.android.tools.build:gradle:3.0.0'
It may be due to the alpha release of gradle.
Use below version of kotlin in build.gradle(Project)
kotlin_version = '1.1.4-3'
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Declare dependency of kotlin in build.gradle(Module) as below
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
check your Kotlin version in build.gradle.
I got the same issue when the version was 1.1.0 which was added by default.
changed to recent version 1.3.21 then it is working fine.
This solution has worked for me for React Native(0.63) after installing react-native-image-picker by Ray Eldath, from above comment
//in android.build.gradle
{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-
dev/'
}
}
First, close Android studio, delete the .gradle folder, and then open Android Studio again, probably as an administrator
This will make it sync from the start, and solve the issue.
This issue was resolved for one of my peers.
Uninstall the Kotlin plugin (Preferences > Plugins > Kotlin > Uninstall) and use the version that comes with the IDE .

android : cannot build project after upgrading Android Studio to 2.3

So, happily updated my Android Studio from stable version 2.2 to canary channel 2.3.
But, unfortunately, it has serious bug. Project is not able to build.
I tried opening my previous projects and also tried creating new sample application, I got same below error:
Gradle 'MyApplication' project refresh failed
Error:A problem occurred configuring project ':app'.
build.gradle(project):
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0-alpha1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle(app):
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.chint.myapplication"
minSdkVersion 16
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.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
compile 'com.android.support:design:25.0.0'
testCompile 'junit:junit:4.12'
}
Am I the only one with this issue ?
So, be careful while this dialog appears:
Choose "Remind me later" and NOT "Update"
Stay with the build version you already have.
Incase, you pressed Update, so just rollback your Android Gradle Plugin classpath in build.gradle(project) to below one:
classpath 'com.android.tools.build:gradle:2.2.2'
This worked for me.
You should update your Android Studio gradle manually.
1° Step:
Follow this path and get your gradle version
C:\Users\[USER_NAME]\.gradle\wrapper\dists
Here you will get "gradle-X.X" (X- is version) in my case it was "gradle-3.3-all"
2° Step:
Go to the following link :
https://services.gradle.org/distributions/
Download your respective version zip file and just past it in the last folder with long random name.
C:\Users\[USER_NAME]\.gradle\wrapper\dists\gradle-x.x\55gk2rcmfc6p2dg9u9ohc31212 HERE
Now open the Android studio, I hope this will work.
I fought a similar issue and resolved it with the addition of 2 characters...
And after updating the gradle-wrapper.properties to target 3.2.1 everything was great for me
distributionUrl=https\://services.gradle.org/distributions/gradle-3.2.1-all.zip
If you import external libraries apply changes for "allprojects"
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Categories

Resources