I'm trying to re-install Android Studio 2.2 in my formatted computer. I tried installing 2.3 updated version but I got these same errors. So I tried installing 2.2 . When I open a project with an empty activity, Gradle sync fails showing errors in the Message section, as shown in the image. The code in build.gradle (module:app) is given as: `
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.heenamehta.myapplication"
minSdkVersion 15
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.3.1'
testCompile 'junit:junit:4.12'
}
`
The code in build.gradle (module: project is given as:)
// 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'
// 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
}
How can I solve this problem?Messages section Image
Try this :
In Android Studio go to File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle
Uncheck the 'Offline work' under 'Global Gradle settings'
Connect the internet and sync.
Update android gradle plugin to latest version
dependencies {
classpath 'com.android.tools.build:gradle:2.3.2'
}
Related
This question already has answers here:
Error:(1, 0) Plugin with id 'com.android.application' not found
(25 answers)
Closed 5 years ago.
I tried File -> Invalidate caches\Restart, that didn't help me.
Log:
16:05 Gradle sync started
16:05 Gradle sync failed: Plugin with id 'com.android.application' not found.
Consult IDE log for more details (Help | Show Log) (34s 987ms)
build.gradle application
apply plugin: 'com.android.application'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 27
buildToolsVersion "27.0.1"
defaultConfig {
applicationId "ru.startandroid.androidlessons"
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.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
First, any project creates by Android Studio has two separated build.gradle files. That shouldn't cause any problems, for Gradle itself, but Android Studio might not be expecting that.
It's probably a sign that you're continuing to use the new SDK and features, but neglecting to upgrade your build tools along with it. E.g com.android.tools.build:gradle:2.1.2
You should upgrade that Gradle plugin to the latest version
https://developer.android.com/studio/releases/gradle-plugin.html
And upgrade Gradle itself, via the Gradle wrapper or install it externally to Android Studio
your build.graddle in project level should look like below
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
jcenter()
}
}
and gradle-wrapper.properties distributionUrl should be like:
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
when i use recycleview this error found
Error:(34, 12) Failed to resolve: com.android.support:recycleview-v7:26.0.0
Install Repository and sync projectShow in FileShow in Project Structure dialog
compile'com.android.support:recycleview-v7:26.0.0' and compile'com.android.support:recycleview-v7:26.0.0-alpha1' both i try but they all can't success. who can help me
this is gralde file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.example.exploapplication"
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.constraint:constraint-layout:1.0.1'
testCompile 'junit:junit:4.12'
compile'com.squareup.okhttp3:okhttp:3.4.1'
compile'com.google.code.gson:gson:2.7'
compile'com.android.support:design:26.0.0-alpha1'
compile'de.hdodenhof:circleimageview:2.1.0'
compile'com.android.support:cardview-v7:26.0.0-alpha1'
compile'com.android.support:recycleview-v7:26.0.0'
}
other 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.3.3'
// 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
}
In your maven block:
give space between url & "https://maven.google.com"
It should look like: url "https://maven.google.com"
Next,
Go to Android SDK from Android Stuido
Click Show Package Details on bottom right corner
Click Latest version of Android SDK Build-Tools, Android SDK Platform-Tools & Android SDK Tools (Look at attached screenshot)
Install Android Support Repository & Google Repository if you haven't
replace compile 'com.android.support:appcompat-v7:26.+'
with compile 'com.android.support:appcompat-v7:26.1.0'
Replace compile'com.android.support:design:26.0.0-alpha1'
with compile'com.android.support:design:26.1.0'
Replace compile'com.android.support:cardview-v7:26.0.0-alpha1'
with compile'com.android.support:cardview-v7:26.1.0'
Replace compile'com.android.support:recycleview-v7:26.0.0'
with compile'com.android.support:recycleview-v7:26.1.0'
When I try to sync the gradle file I keep on getting this error
Error:Execution failed for task ':app:processDebugGoogleServices'.
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.0.0.
Before posting this question I have visited here, because the error was similar to that of mine and according to the accepted answer I removed apply plugin: 'com.google.gms.google-services' and tried to sync it again and the build was successfull, but when I tried to run the app on my device it threw an error
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForDebug'.
I have tried all the answers from this link and even tried to change play service service version 11.0.0 to 11.0.1, but none of them works.
Here is my build.gradle(module) file :
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "com.example.hp.passwordStorage"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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.3.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.google.firebase:firebase-admin:5.2.0'
compile 'com.android.support:design:25.3.1'
testCompile 'junit:junit:4.12'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8#aar') {
transitive = true;
}
}
Here is my build.gradle(app) file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath 'com.google.gms:google-services:3.1.0'
classpath 'io.fabric.tools:gradle: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
}
Can anyone please help me?
Thank you :)
Go to File -> Project Structure
Select 'Project Settings'
Select 'Dependencies' Tab
Click '+' and select '1.Library Dependencies'
Search for : com.google.android.gms:play-services
Select the latest version and click 'OK'
Make sure that you have configured both your root-level Gradle file and module Gradle file (usually the app/build.gradle). Check this guide which can help you on how to integrate the Firebase libraries into your project. Also, the cause of this crash is likely to be the version of Google Play Service installed on the testing device. Make sure that you have the latest Google Play Services version installed on the testing device.
I was trying to create a demo project based on Google Map, for this I was using MapsActivity provided by android studio. Everything is fine excluding the Google Play services. Android studio is failed to resolve play-services and throwing an error-
Error:(27, 13) Failed to resolve: com.google.android.gms:play-services:9.4.0
Install Repository and sync project
Show in File
Show in Project Structure dialog
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.2'
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 24
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.mymapapplication"
minSdkVersion 15
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 {
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:24.2.1'
compile 'com.google.android.gms:play-services:9.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
I have the updated sdk tools Google Play services v-33 and Google Repository v-36.
I tried many things to handle it, but still facing the same problem.
Resolved the issue, it was a bug on the repository link.
"Install Google Repository" failed.
Failed packages:
- Google Repository (extras;google;m2repository)
Now the new link- https://dl.google.com/android/repository/google_m2repository_gms_v7_rc28_wear_2a3.zip(at this time) working fine, I updated my google repository and google play-services and its work like a charm.
I am setting up an Android server project for pushing notification using this documentation from Firebase website. At first, I have set up the project at Firebase console and added the JSON file & Google services plugin.
But while syncing the project after adding
compile 'com.google.firebase:firebase-server-sdk:3.0.1', there is the error:
Version: 3.0.1 is lower than the minimum version (9.0.0) required for google-services plugin.
My app build.gradle is-
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "ton.com.serverandroid"
minSdkVersion 15
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 {
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:24.2.1'
compile 'com.google.firebase:firebase-server-sdk:3.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
My project build.gradle is
// 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.0'
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
}
I have tried to use google-services version 2.1.0 but it wasn't working either with the error:
Conflict with dependency 'com.google.code.findbugs:jsr305'. Resolved versions for app (1.3.9) and test app (2.0.1) differ.
But I can't go farther in that case.
I answer a similar question today, you can see the correct dependences here enter link description here, this ones are most important to import other dependencies in android client. Then for server sdk you need to add this one in app.gradle:
compile 'com.google.firebase:firebase-server-sdk:[3.0.0,)'
For use FirebaseCloudMessaging you need other one in app.gradle:
compile 'com.google.firebase:firebase-messaging:9.0.0'
Tell us if you wan compile now, greetings!