Gradle project sync failed. Basic functionality will not work properly - android-studio

I updated to Android Studio 1.2 and now have a two errors.
When I first open my project I get this error at the top of the screen.
"Gradle project sync failed. Basic functionality will not work properly."
In the Messages Gradle Sync I get
My gradle files are:
// 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:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
and
apply plugin: 'com.android.application'
android
{
signingConfigs {
config {
keyAlias 'ScoularAndroidKey'
keyPassword 'password'
storeFile file('C:/Users/bschmiedeler/.AndroidStudio/scoularkeystore.jks')
storePassword 'password'
}
}
name="Scoular"
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.scoular.scoular"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
}
debug{
debuggable true
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/commons-lang-2.3.jar')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.google.android.gms:play-services:6.5.87'
compile files('src/main/assets/library-1.0.10.jar')
}
By looking through Stack Overflow I have found some potential solutions.
I have tried File ==> Invalidate and Restart and removing the files that you are supposed to. I am just stuck. Any help would be greatly appreciated.

This is a confirmed bug with Android Studio 1.2:
https://code.google.com/p/android/issues/detail?id=160899
The main solution is to wait for their fix.
I have had luck re-importing the project, but I have to do it every time I open the project.

Related

Android Studio cannot resolve dependency

I use Android studio to create a blank project, but cannot compile.
below is its error:
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration':app:_debugUnitTestApkCopy'.
> Could not resolve junit:junit:4.12.
Required by:
project :app
> Could not resolve junit:junit:4.12.
> Could not get resource 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> Could not GET 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'.
> jcenter.bintray.com:443 failed to respond
I tried to use a proxy
and checked proxy settings with the failed url 'https://jcenter.bintray.com/junit/junit/4.12/junit-4.12.pom'
and it show me success
but when I compile the project, it's still the same error.
this is my gradle.properties file:
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=1080
this is project build.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.3.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
}
this is app build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.myapplication"
minSdkVersion 15
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.0-alpha7'
testCompile 'junit:junit:4.12'
}
finally, I solved my question
the proxy I use is a sockts5 proxy
the autogenerate gradle.properties file use a http proxy
after I change the gradle.properties it's worked
this is my new gradle.properties:
org.gradle.jvmargs=-Xmx1536m -DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080

Android Gradle Failed to resolve

I am getting this error in the gradle file:
Error: Failed to resolve: com.google.android.gms:play-services-measurement:10.2.4
-Install Repository and sync project
-Open File
-Show in Project Structure dialog
But I don't use the play-services-measurement in my app.
In the other hand, if I click on the link "Install Repository and sync project" nothing happens.
Any could help me with this? I have been wasting days with this issue.
This is my full gradle file:
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
compileOptions {
encoding "UTF-8"
}
lintOptions {
disable 'MissingTranslation'
abortOnError false
}
defaultConfig {
applicationId "xxx.yyy.zzz"
minSdkVersion 9
targetSdkVersion 25
versionCode 120
versionName "1.20"
multiDexEnabled true
//Enabling multi dex support due to exceeding the 65K methods dex limit imposed by Android: http://stackoverflow.com/questions/29756188/java-finished-with-non-zero-exit-value-2-android-gradle
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
applicationVariants.all { variant ->
variant.outputs.each { output ->
def formattedDate = new Date().format('yyyyMMddHHmmss')
def newName = output.outputFile.name
newName = newName.replace("app-", "MyAppName")
newName = newName.replace("-release", "-release" + formattedDate)
//noinspection GroovyAssignabilityCheck
output.outputFile = new File(output.outputFile.parent, newName)
}
}
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':simple-crop-image-lib')
compile 'com.google.firebase:firebase-core:9.6.1'
compile 'com.google.firebase:firebase-messaging:10.2.4'
compile 'com.google.android.gms:play-services:10.2.4' //8.3.0' 10.2.4' 9.0.0' 9.6.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:mediarouter-v7:25.3.1'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
//For soap:
compile files('libs/ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar')
}
apply plugin: 'com.google.gms.google-services'
Update Google Repository in Android SDK. Works for me with version 47.
From the firebase doc:
dependencies {
// ...
compile 'com.google.firebase:firebase-core:10.2.4'
compile 'com.google.firebase:firebase-messaging:10.2.4'
// Getting a "Could not find" error? Make sure you have
// the latest Google Repository in the Android SDK manager
}
For me worked to remove these lines from the "app build.gradle":
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
}
}
And add these to the "project build.gradle":
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.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
}
}

jitpack.io dependencies are not working

I cannot get jitpack.io dependencies to work with gradle. I know there are other questions but none of the suggested tips helped. The problem is, jitpack.io dependencies are not working at all. In theory it should be simple... add the mavel { url ... } and the compile declarative. But i keep getting an error that the dependency cannot be resolved.
I updated android-studio, which suggested to update and then updated gradle. Since every jitpack.io dependency is not working, it must be related to the configuration of gradle overall. Unfortunately i have no clou where to start.
I tried different repositories, so that should not be the problem. I also checked the corresponding build logs.
Can anybody help me?
This are my whole gradle files, they should be fine.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
maven { url "http://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
and
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "patrickstummer.com.bonario_internal"
minSdkVersion 19
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'])
compile 'com.android.support:appcompat-v7:24.0.0-alpha2'
compile 'com.jakewharton:butterknife:8.4.0'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
compile 'com.github.soroushjavdan:ApplicationLocker:62301ce0b4'
}
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url "https://jitpack.io" }
}
}
Add the dependency
dependencies {
compile 'com.github.User:Repo:Tag'
}

Showing error fix plugin version and sync projects in android studio

i am new in Android Studioand when i create a new project suddenly i just got an error message i.e, Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "9ba5989c7b283b0ec145cc20641f7155619d6148"
Here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "************"
minSdkVersion 16
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.1.1'
}
My build.gradle(project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
// 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 updated my Android studio 2.0 but it always showing Fix plugin version and sync project when open create a project.please anyone can tell me what i should do to rectify this problem.
Thanks in advance...
classpath 'com.android.tools.build:gradle:2.0.0-alpha2' instead of this use
classpath 'com.android.tools.build:gradle:2.2.+' this fixed the same error for me!

I can not add a dependency in Android Studio

I'm new in Android Studio and i want to add dependency to custom view (https://github.com/glomadrian/dashed-circular-progress) in my project. I downloaded *.arr file from Maven repository and imported it like a AAR module. But i can't compile my project because there are some exceptions with this custom view: ClassNotFoundException. Could someone explain me step by step how to correctly add dependencies from maven rep? or there are some problems with this DashedCircularProgress.aar? Thanks.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.ahryk94gmail.mibandsdk"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/gson-2.6.2.jar')
compile 'com.github.glomadrian:DashedCircularProgress:1.0#aar'
}
As mentioned in the project description you have to add the following code to build.gradle:
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
dependencies {
compile 'com.github.glomadrian:DashedCircularProgress:1.0#aar'
}
UPDATE:
Also you can use jitpack.io and download the dependency right from GitHub.
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.glomadrian:dashed-circular-progress:59d245a'
}

Resources