This project has been working for weeks. Yesterday, Android Studio pulled in some updates, and now gradle cannot find my play-services files. It has literally stopped building with no changes to the project - I didn't think this would happen with a gradle-based project.
gradle sync error
When I click on "Install Repository and sync project", another window opens with the message:
Ignoring unknown package filter 'extra-google-m2repository'Warning: The package filter removed all packages. There is nothing to install.
Please consider trying to update again without a package filter.
Here is my gradle file:
apply plugin: 'android-library'
repositories {
mavenCentral()
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
dependencies {
compile 'com.android.support:appcompat-v7:20.0.+'
compile 'com.android.support:support-v4:20.0.+'
compile 'com.google.android.gms:play-services-games:6.5+'
compile 'com.google.android.gms:play-services-plus:6.5+'
compile 'com.google.android.gms:play-services-appstate:6.5+'
}
android {
compileSdkVersion 20
buildToolsVersion '20'
}
Looking in my SDK manager, both "Google Repository" and "Android Support Repository" are installed.
SDK manager screen shot
It is possible that I have two different SDK's, but not sure how to tell if I do, and not sure how to remove the extra one if this is the issue.
Removing the "+" and specifying the specific version allows me to build again. I'm actually using 6.5.87, as 8.4.0 caused some other issue.
Related
I am running Android Studio 3.4.1 and I'm trying to build a bundle.
Build -> Build Bundle(s) / APK(s) -> Build Bundle(s)
And here is what I see:
When I click Update, the dialog dismisses and absolutely nothing happens. I have tried several times.
I also have this:
I am very new to Android Studio, but my simple app is complete and ready to deploy to the Google Play Store. Is there some alternate way to build a bundle? Am I missing something?
First make sure in your current plugin google() is included.
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
...
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.1'
}
}
Second - Update values in distributionURL gradle-wrapper.properties and sync
distributionUrl = https\://services.gradle.org/distributions/gradle-5.1.1-all.zip
distributionUrl path could be found at following path
I have a project loaded in Android Studio 3.0. Gradle sync works fine, and the project builds.
When I add implementation 'com.amazonaws.aws-android-sdk-mobile-client:2.6.+' to my build.gradle (Module:app) file, right next to all the other dependencies that are already part of this fine project, gradle fails to find that dependency. Many of the existing project dependencies are under com.amazonaws.aws-android-sdk-* and are being sync'ed just fine, for e.g. implementation 'com.amazonaws:aws-android-sdk-core:2.6.+' is fine.
So I double check that new project dependency actually exists, browsing http://repo.maven.apache.org/maven2/com/amazonaws/aws-android-sdk-mobile-client shows it exists, I don't see a typo.
Looking at my build.gradle (Project: myProject), I see the following
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
Yet when gradle syncs i get
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.amazonaws.aws-android-sdk-mobile-client:2.6.+:.
Could not resolve com.amazonaws.aws-android-sdk-mobile-client:2.6.+:.
Required by:
project :app
No cached version of com.amazonaws.aws-android-sdk-mobile-client:2.6.+: available for offline mode.`
There is a typo in your dependency.
Use
implementation 'com.amazonaws:aws-android-sdk-mobile-client:2.6.+'
instead of
implementation 'com.amazonaws.aws-android-sdk-mobile-client:2.6.+'
uncheck "Offline Work" in Android Studio / File / Settings / Build, Execution, Deployment / Gradle
Trying to start a new Kotlin project with Android Studio 3.0 Canary 1 displays this error. Full trace:
Error:Unable to find method
'com.android.build.gradle.internal.variant.BaseVariantData.getOutputs()Ljava/util/List;'.
Possible causes for this unexpected error include:Gradle's
dependency cache may be corrupt (this sometimes occurs after a network
connection timeout.) Re-download dependencies
and sync project (requires network)The state of a Gradle
build process (daemon) may be corrupt. Stopping all Gradle daemons may
solve this problem. Stop Gradle build
processes (requires restart)Your project may be using a
third-party plugin which is not compatible with the other plugins in
the project or the version of Gradle requested by the
project.In the case of corrupt Gradle processes, you can
also try closing the IDE and then killing all Java processes.
I've tried the first two options and the third-party plugins are left as default.
gradle-wrapper.properties
#Thu May 18 08:36:52 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.1.2-3'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
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 {
jcenter()
maven { url 'https://maven.google.com' }
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I haven't touched any of these values myself, they're left as default. Creating a non-Kotlin new project does not have this problem.
In my build.gradle changing
ext.kotlin_version = '1.1.2-3'
to
ext.kotlin_version = '1.1.2-4'
fixed this.
You can find the most recent version here.
It worked for me
Using the 8.4.0 version
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
For Java
Just remove
classpath 'me.tatarka:gradle-retrolambda:3.7.0'
downgrade butterknifeversion to 8.4.0
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
Don't forget to remove
apply plugin: 'me.tatarka.retrolambda'
from app level build gradle.
This is a known issue in Android Studio Preview 3.0:
If you see this error, it's possible you have a pre-existing version of the Kotlin plugin that is incompatible with the new Android Plugin for Gradle that's in Android Studio 3.0. The solution is to delete the old Kotlin plugin.
Open your project-level build.gradle file and locate ext.kotlin_version. It should be 1.1.2-4 (or higher). If it shows an older version, you need to delete the old Kotlin plugin so it does not obstruct the version included with Android Studio 3.0.
On Windows, it should be located at
C:\Users\user_name\AndroidStudio_version\config\plugins\Kotlin\
On Mac, look in
~/Library/Application\ Support/AndroidStudio_version/Kotlin/
In my case, the issue was caused because we were applying butterknife-gradle-plugin. Upgrading to 8.8.1 didn't fix the issue, but removing it certainly did.
The build.gradle belongs to the application, so I don't even know why we are using that plugin (I'm new to the project)
Update your kotlin version to the latest:
ext.kotlin_version = '1.1.2-4' //currently it's the latest version
Then you may face some more errors, so before syncing again, make sure that your buildToolsVersion is "26.0.2" or higher.
I recently updated Android Studio from version 2.1 to 2.2 and my previously working project has major build errors, centering around a "gradle failed to sync" message I got when opening the project for the first time in version 2.2
It seems that some update occurred to gradle when I did the Studio upgrade to version 2.2, and this update has broken my old project's references (I think). All editing/debugging/simulation features aren't usable within Android Studio when I open this project. What did I do wrong when upgrading, and more importantly how can I fix my broken project and restore full Android Studio functionality while editing this project like I had when running version 2.1.
In the image below you will notice i'm getting a message about a VCS root misconfiguration and all of my toolbar buttons (run, debug, etc) are grayed out.
What can I do to fix this?
I've included my build.gradle file below
// 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.1.3'
}
}
allprojects {
repositories {
jcenter()
}
}
Same configuration should work.
click on configure VCS(the popup in right side).And to enable Run, Debug etc options, select module(android app module)to run from dropdown option(in left of run option).
For Instant Run to work , update Gradle to 2.2.0-beta3 or higher.
I am new to Android and I am about to deal with BLE app.
So I downloaded and installed the Android Studio 0.4.6 on Windows XP w SP3, and Updated it to 0.5.4.
Then, I went to http://developer.android.com/samples/index.html and downloaded the BluetoothLeGatt.zip (http://developer.android.com/downloads/samples/BluetoothLeGatt.zip) for my project.
When I tried "Import Project" to use the BluetoothLeGatt project, it failed with the message:
Failed to refresh Gradle project 'BluetoothLeGatt'
The project is using an unsupported version of Gradle. Please use version 1.10.
Please point to a supported Gradle version in the project's Gradle settings or in the project's Gradle wrapper (if applicable.)
Fix Gradle wrapper and re-import project Gradle settings
I clicked "Fix Gradle wrapper and re-import project Gradle settings" and got the message:
Quick Fix Failed
Unable to find any references to the Android Gradle plug-in in build.gradle files. Please click the link to perform a textual search and then update the build files manually.
The file build.gradle is:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.8.+'
}
}
apply plugin: 'android'
dependencies {
// Add the support lib that is appropriate for SDK 18
compile "com.android.support:support-v13:19.0.+"
}
// The sample build uses multiple directories to
// keep boilerplate and common code separate from
// the main sample code.
List<String> dirs = [
'main', // main sample code; look here for the interesting stuff.
'common', // components that are reused by multiple samples
'template'] // boilerplate code that is generated by the sample template process
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
dirs.each { dir ->
java.srcDirs "src/${dir}/java"
res.srcDirs "src/${dir}/res"
}
}
instrumentTest.setRoot('tests')
instrumentTest.java.srcDirs = ['tests/src']
}
}
Well, I am new in Android, so I don't know how to fix it, and I don't know what documents I should go through first that will help me to solve it.
Need help badly.
In build.gradle set your classpath to 0.9.+
classpath 'com.android.tools.build:gradle:0.9.+'
Then in gradle/wrapper/gradle-wrapper.properties you will need to check your distributionUrl The error is quite miss pointing making one belive that the problem is only within the build.gradle file.
Using gradle:0.9.+ your distributionUrl in gradle-wrapper.properties should be set to: http\://services.gradle.org/distributions/gradle-1.10-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
###Correct distributionUrl###
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
Then sync gradle, clean and rebuild project and you should be good to go