I'm getting the duplicate entry error for abstractHttpContent.class which is part of app engine.
I'm using google app engine backend. I also have multidex enabled, without multidex it give me an method exceeded error.
here is my app gradle file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.joseph.googlesign_in"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-auth:8.3.0'
compile project(path: ':gsiBackend', configuration: 'android-endpoints')
compile project(':gsiBackend')
}
Here is my backend gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.google.appengine:gradle-appengine-plugin:1.9.18'
}
}
repositories {
jcenter();
}
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'appengine'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
dependencies {
appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.18'
compile 'com.google.appengine:appengine-endpoints:1.9.18'
compile 'com.google.appengine:appengine-endpoints-deps:1.9.18'
compile 'javax.servlet:servlet-api:2.5'
}
appengine {
downloadSdk = true
appcfg {
oauth2 = true
}
endpoints {
getClientLibsOnBuild = true
getDiscoveryDocsOnBuild = true
}
}
The location of abstractHttpContent.class
It seems the error started after adding google play services to use google sign in.
Has anyone encountered this build error? Any advice on how to fix it?
Thanks
As we discuss, I believe Google play services 8.3 made some changes on the google signin system. You can check out here:
https://developers.google.com/android/guides/releases#november_2015_-_v83
So I suggest that you can try to use version 8.1.
The issue was with google play services.
Here is top level gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
// 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
}
Change the following
From
classpath 'com.google.gms:google-services:1.5.0-beta2'
To
classpath 'com.google.gms:google-services:1.5.0'
Also the aapt.exe was timing out and displaying an error.
Ran the appt.exe file to make sure it was running and everything seems to be working now.
Tried to run the app with mulidex disabled and it still works
The issue was with google play services.
Here is my top level gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
// 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
}
Change the following
From
classpath 'com.google.gms:google-services:1.5.0-beta2'
To
classpath 'com.google.gms:google-services:1.5.0'
Also the aapt.exe was timing out and displaying an error.
I ran the appt.exe file to make sure it was running and everything seems to be working now.
I also tried to run the app with mulidex disabled and it still works
Related
I am trying to publish my android library with jitpack. But getting buildscript {} blocks must appear before any plugins {} blocks error.
I have already referred to this question : Getting 'buildscript {} blocks must appear before any plugins {} blocks' error in jitpack but did not found any solution.
Error:
FAILURE: Build failed with an exception.
* Where:
Build file '/home/jitpack/build/build.gradle' line: 26
* What went wrong:
Could not compile build file '/home/jitpack/build/build.gradle'.
> startup failed:
build file '/home/jitpack/build/build.gradle': 26: all buildscript {} blocks must appear before any plugins {} blocks in the script
See https://docs.gradle.org/7.0.2/userguide/plugins.html#sec:plugins_block for information on the plugins {} block
# line 26, column 1.
buildscript {
^
1 error
This is what my project level gradle looks like:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.2"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
plugins {
id "com.jfrog.bintray" version "1.8.4"
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is what my app level gradle looks like:
plugins {
id 'com.android.application'
id "com.jfrog.bintray"
}
android {
compileSdk 30
defaultConfig {
applicationId "com.siddydevelops.logutil"
minSdk 23
targetSdk 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.1'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
My gradle version is 7.0.2.
I am pretty sure that this block is causing the error: (in project level gradle)
plugins {
id "com.jfrog.bintray" version "1.8.4"
}
I cant move it to app level gradle.
i have the same problem too, i just change the position inside build.gradle project like this:
buildscript {
dependencies {
classpath "com.android.tools.build:gradle:4.1.1"
}
}
plugins {
id 'com.android.application' version '7.1.0' apply false
id 'com.android.library' version '7.1.0' apply false
id 'org.jetbrains.kotlin.android' version '1.6.10' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I hope you are fine.
I have problem in android studio, hours and hours I'm trying to implement library of Loading Button or image circular progress ( such as telegram progress ), and this library one of theme, when I try to implement in android studio I get this error message:
Failed to resolve: com.github.smrtyvz:ArchedImageProgressBar:2.01
any solution or suggestion ?
this is my root build.Gradle
buildscript {
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
maven {url "https://maven.springframework.org/release"}
maven { url "https://maven.restlet.com" }
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.gms:google-services:4.3.5'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
useLibrary 'org.apache.http.legacy'
compileSdkVersion 28
defaultConfig {
applicationId "blocks.youtube.hichem.soft"
minSdkVersion 21
targetSdkVersion 28
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.4.0-alpha02'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.google.code.gson:gson:2.8.6'
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.google.firebase:firebase-database:19.7.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.android.support:design:28.0.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
implementation 'com.google.firebase:firebase-storage:19.2.2'
implementation platform('com.google.firebase:firebase-bom:26.3.0')
implementation 'com.google.firebase:firebase-database-ktx'
implementation 'com.google.firebase:firebase-storage:19.2.2'
implementation 'com.github.smrtyvz:ArchedImageProgressBar:2.01'
}
the Link of Library in github ;
https://github.com/smrtyvz/ArchedImageProgressBar
whats wrong ??
You forgot to add this in your root build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Try putting
repositories {
maven { url 'https://jitpack.io' }
}
in the root of your Gradle build file (outside of the buildscript tag).
I'm trying to add firebase cloud storage to my app. Below is the app build.gradle. But it says:
Failed to resolve: com.google.firebase:firebase-core:16.0.1.
Why? There is no firebase-core in the dependencies at all.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.louise.udacity.mydict"
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 {
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'
implementation 'com.google.firebase:firebase-storage:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
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.google.cloud:google-cloud-storage:1.31.0'
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
}
apply plugin: 'com.google.gms.google-services'
From the docs:-
Your app gradle file now has to explicitly list com.google.firebase:firebase-core as a dependency for Firebase services to work as expected.
Add:
implementation 'com.google.firebase:firebase-core:16.0.1'
and in top level gradle file use the latest version of google play services:
classpath 'com.google.gms:google-services:4.0.2'
https://firebase.google.com/support/release-notes/android
https://bintray.com/android/android-tools/com.google.gms.google-services
Note:
You need to add the google() repo in the top level gradle file, as specified in the firebase docs and also it should be before jcenter():
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
https://firebase.google.com/docs/android/setup
As #Peter Haddad mentioned above,
To fix this issue I followed Google firebase integration guidelines and did the following changes in my app/build.gradle and project/build.gradle
Follow below mentioned link if you have any doubts
https://firebase.google.com/docs/android/setup
changes in app/build.gradle
implementation 'com.google.android.gms:play-services-base:15.0.2'
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.4.0"
Changes in Project/build.gradle
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath 'com.google.gms:google-services:4.2.0'// // google-services plugin it should be latest if you are using firebase version 16.0 +
}
allprojects {
repositories {
google()// add it to top instead of bottom or somewhere in middle
mavenLocal()
mavenCentral()
maven {
url 'https://maven.google.com'
}
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
}
}
Add maven { url "https://maven.google.com" } to your root level build.gradle file
repositories {
maven { url "https://maven.google.com" }
flatDir {
dirs 'libs'
}
}
Since May 23, 2018 update, when you're using a firebase dependency, you must include the firebase-core dependency, too.
If adding it, you still having the error, try to update the gradle plugin in your gradle-wrapper.properties to 4.5 version:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5-all.zip
and resync the project.
I get the same issue and i solved it by replacing :
implementation 'com.google.firebase:firebase-core:16.0.1'
to
implementation 'com.google.firebase:firebase-core:15.0.2'
and everything solved and worked well.
What actually was missing for me and what made it work then was downloading'Google Play services' and 'Google Repository'
Go to: Settings -> Android SDK -> SDK Tools -> check/install Google Play services + repository
Hope it helps.
I was able to solve the issue by following these steps-
1.) This error occurs when you didn't connect your project to firebase.
Do that from Tools->Firebase if you are using Android studio version 2.2 or above.
2.) Make sure you have replaced the compile with implementation in dependencies in app/build.gradle
3.) Include your firebase dependency from the firebase docs. Everything should work fine now
This is rare, but there is a chance your project's gradle offline mode is enable, disable offline mode with the following steps;
In android studio, locate the file tab of the header and click
In the drop own menu, select settings
In the dialog produced, select "Build, Execution, Deploy" and then select "Gradle"
Finally uncheck the "offline work" check box and apply changes
If this doesn't work leave a comment describing your Logcat response and i'll try to help more.
In my case it was resolved by changing the compileSdkVersion and targetSdkVersion from 26 to 27
If you use Firebase in a library module, you need to apply the google play services gradle plugin to it in addition to the app(s) module(s), but also, you need to beware of version 4.2.0 (and 4.1.0) which are broken, and use version 4.0.2 instead.
Here's the issue: https://github.com/google/play-services-plugins/issues/22
if you are using
compileSdkVersion 23
in app-level gradle, and
classpath 'com.android.tools.build:gradle:2.1.0'
in project-level gradle
and you have added the
google-services.json file to your project.
you need to add just below code
maven {
url "https://maven.google.com"
}
at below of jcenter() in repositories blocks in project-level gradle file
here are my gradle files:
project-level gradle file:
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.google.gms:google-services:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and app-level gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.moslem.amazonlikeapp"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.google.firebase:firebase-core:16.0.1'
}
apply plugin: 'com.google.gms.google-services'
Just add below code and update all firebase versions that will work
implementation 'com.google.firebase:firebase-core:17.2.0'
If you receive an error stating the library cannot be found, check the Google maven repo for your library and version. I had a version suddenly disappear and make my builds fail.
https://maven.google.com/web/index.html
Go to
Settings -> Android SDK -> SDK Tools ->
and make sure you install Google Play Services
Today, I opened Android Studio, then I get this error. Yesterday, there was a no problem such that!
Error:Execution failed for task ':app:processDebugResources'.
Error: more than one library with package name 'com.google.android.gms.license'
com.google.android.gms:play-services-xxx libraries was
11.8.0
Onesignal library was
'com.onesignal:OneSignal:[3.6.2, 3.99.99]'
Then I changed them to latest version.
Now App/Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "xxx.xxx.xxx"
minSdkVersion 15
targetSdkVersion 24
versionCode 10
versionName 'x.x.x'
manifestPlaceholders = [onesignal_app_id: "xxxxx-xx-xxx",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "XXX"]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
repositories {
maven { url 'https://maven.google.com' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.mcxiaoke.volley:library:1.0.18'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.facebook.android:facebook-android-sdk:4.0.1'
compile 'com.google.android.gms:play-services-ads:12.0.0'
//compile 'com.google.android.gms:play-services-ads:11.2.2'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
//compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.android.support:cardview-v7:27.1.0'
compile 'com.android.support:recyclerview-v7:27.1.0'
compile 'com.android.support:design:27.1.0'
compile 'com.balysv:material-ripple:1.0.2'
compile "com.google.firebase:firebase-messaging:12.0.0"
compile 'com.github.hotchemi:android-rate:1.0.1'
compile 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
compile 'com.google.android.gms:play-services-analytics:12.0.0'
}
apply plugin: 'com.google.gms.google-services'
Project/Gradle:
// 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:3.1.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 {
jcenter()
}
}
But I am still getting same error that stated above. How can I solve this problem? Why did this problem occur Today when there was no problem, yesterday?
This probably because the play services version is not in the range defined for
OneSignal:[3.7.1, 3.99.99] which is (you can see it at this commit):
// Limit upper number (exclusive) to prevent untested versions
static def versionGroupOverrides = [
'com.google.android.gms': '[10.2.1, 11.7.0)',
'com.android.support': '[26.0.0, 27.1.0)'
]
So, try changing the play services version to 11.7.0.
You should try using OneSignal Gradle Plugin which helps make the OneSignal Android SDK compatible with your Android Studio project. Use OneSignal-Gradle-Plugin 0.8.0 for OneSignal:[3.7.1, 3.99.99]
project gradle
// 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:3.0.0-alpha3'
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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
App Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.arun4fms.efix"
minSdkVersion 17
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'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE-FIREBASE.txt'
exclude 'META-INF/NOTICE'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
compile 'com.chabbal:slidingdotsplash:1.0.2'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.firebase:firebase-client-android:2.5.2'
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Error:A problem occurred configuring root project 'webapp'.
Could not resolve all dependencies for configuration ':classpath'.
Could not find com.android.tools.build:gradle:3.0.0-alpha3.
Searched in the following locations:
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha3/gradle-3.0.0-alpha3.pom
file:/C:/Program Files/Android/Android Studio/gradle/m2repository/com/android/tools/build/gradle/3.0.0-alpha3/gradle-3.0.0-alpha3.jar
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha3/gradle-3.0.0-alpha3.pom
https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0-alpha3/gradle-3.0.0-alpha3.jar
Required by:
project :
As already answered here:
Google have new maven repo, so it could be the reason.
https://android-developers.googleblog.com/2017/05/android-studio-3-0-canary1.html
section Google's Maven Repository
https://developer.android.com/studio/preview/features/new-android-plugin-migration.html
https://developer.android.com/studio/build/dependencies.html#google-maven
Add Google’s Maven Repository to the buildscript repositories section to fix it like #KG87 did here.
buildscript {
repositories {
jcenter()
maven { url "https://maven.google.com" } // Add this line to fix it
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
...
}
}
As explained here:
The repositories in the buildScript block are used to fetch the
dependencies of your buildScript dependencies. These are the
dependencies that are put on the classpath of your build and that you
can refer to from your build file. For instance, extra plugins that
exist on the internet.
The repositories on the root level are used to fetch the dependencies
that your project depends on. So all the dependencies you need to
compile your project.
And here:
The buildScript block determines which plugins, task classes, and
other classes are available for use in the rest of the build script.
Without a buildScript block, you can use everything that ships with
Gradle out-of-the-box. If you additionally want to use third-party
plugins, task classes, or other classes (in the build script!), you
have to specify the corresponding dependencies in the buildScript
block.
As announced here:
The Android Gradle Plugin 3.0.0-alpha3 was also released through
maven.google.com.
So, try to fix it by adding Google’s Maven Repository.
buildscript {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Also add the repository here for other dependencies like the support libraries like this:
Make sure that the repositories section includes a maven section with
the "https://maven.google.com" endpoint. For example:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
The difference is explained here
The "buildscript" block only controls dependencies for the buildscript
process itself, not for the application code, which the top-level
"dependencies" block controls.
For instance, you could define dependencies in "buildscript/classpath"
that represent Gradle plugins used in the build process. Those plugins
would not be referenced as dependencies for the application code.
As commented here by #lugegege, this version doesn't exist in Bintray JCenter:
com.android.tools.build.gradle
latest version is 2.5.0-alpha-preview-02, there is no 3.0.0-alpha3
com.android.tools.build.gradle latest version is 2.5.0-alpha-preview-02, there is no 3.0.0-alpha3
Use this.. This may work because this worked in my case:
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
}
and put this at the end of the app-level build.gradle file (after the dependencies).
apply plugin: 'com.google.gms.google-services'
I have no clue why putting this at the end (and not at the beginning ) solves the error.
Ok… So trying to put an end to all problems you guys have faced with my solution
This is my final app level gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "your-app-name"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
}
}
repositories {
jcenter()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.1.1'
compile 'com.mcxiaoke.volley:library:1.0.6#aar'
}
apply plugin: 'com.google.gms.google-services'
and this is my final project level gradle
// 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.0.0-alpha3'
classpath 'com.google.gms:google-services:2.0.0-alpha3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Compare this with your own gradle files, and add or modify any values which are different from what I've written.
I had the same problem this morning !
As Vishal said, there is no gradle-3.0.0-alpha3..
I am sure that, since I downloaded "Android studio 3.0 Canary (Alpha3)", I was on on the same version of gradle (3.0.0 alpha3), and it worked ! (Since today).
So I've put : classpath 'com.android.tools.build:gradle:2.3.2' to compile.
EDIT : I have two versions of Android studio, When I used Android Studio 3.0, it changes gradle to gradle 3.0.0-alpha3 !
write these gradles..
compile 'com.android.support:appcompat-v7:25.0.2'
compile 'com.android.support:design:25.0.2'
classpath 'com.android.tools.build:gradle:2.2.3'