Gradle failed to refresh Android Studio - android

Ive been installing and re-installing AndroidStudio since i keep getting the error
> Gradle 'android' project refresh failed:
> Open quote is expected for attribute "{1}" associated with an element type "language".
All of my group members can open up the project without receiving this error except me.I am in dire need of help,i just want to finish my group project for the semester.Thank you for your help.
settings.gradle
include ':app'
build.gradle in the app folder
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion "19.0.1"
defaultConfig {
minSdkVersion 16
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.google.android.gms:play-services:4.3.23'
compile 'com.android.support:support-v4:18.0.0'
files('libs/json-simple-1.1.1.jar')
compile files('libs/json-simple-1.1.1.jar')
}
build.gradle in the gradle folder
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.7.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Update:did another re-intstall of Android Studio and now its giving me this error.
Failed to refresh Gradle project 'android'
Out of memory: Java heap space. Configure Gradle memory settings using '-Xmx' JVM option (e.g. '-Xmx2048m'.)
Please fix the project's Gradle settings.
Gradle settings

You might have typed closed quote (“) instead of open quote("). Change the quotes at start and end of attribute.

Related

Android studio gradle upgrade fails (http://schemas.android.com/apk/res/android URI not registered)

I have a complicated multi-project Android build. Recently upgraded to Android Studio 3.0.1 successfully. But attempting a corresponding upgrade to Android Plugin for Gradle 3.0.1 (And gradle version 4.1) breaks my project build.
There are a cascade of failure messages, but the primary ones seems to be that the http://schemas.android.com/apk/res/android is not a registered URI.
The project consists of a main project and three included subprojects. I did find a section reporting known problems with multi project builds in the Andriod Gradle Plugin upgrade documentation, but none of their recomendations resolved the issue.
Any help or advice would be much appreciated
Top level config files
build.gradle
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
}
}
allprojects {
repositories {
jcenter()
}
}
ext {
versionName = '1.9.15-26'
versionCode = 10915260
}
settings.gradle
include ':cadpage', ':cadpage-parsers', ':cadpage-private'
Cadpage subproject / build.gradle
apply plugin: 'com.android.application'
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
android {
compileSdkVersion 23
buildToolsVersion '25.0.0'
defaultConfig {
applicationId 'net.anei.cadpage'
versionName project.versionName
versionCode project.versionCode
minSdkVersion 9
targetSdkVersion 23
}
dexOptions {
jumboMode = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
}
}
dependencies {
compile project(":cadpage-parsers")
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services-gcm:10.0.1'
}
cadpage-parsers subproject / build.gradle
apply plugin: 'java'
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
}
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
jar {
manifest {
attributes('Implementation-Title': 'Cadpage Parsing Library',
'Implementation-Version': project.versionName,
'Main-Class' : 'net.anei.cadpage.parsers.Parser')
}
}
As it turns out, the actual problem was a misplaced item in my AndroidManifest.xml file. This is a documented issue with the upgrade. What threw me off was the IDE reporting extraneous errors about the "http://schemas.android.com/apk/res/android" URI not being registered.
While the gradle console log did, in fact, identify the correct error. The IDE popped up the intermediate manifest file where the error occured. And syntax highlighting in that file started by complaining about the unregistered URI. I had been focusing on resolving what turned out to be a spurious error report.

Android Studio Gradle is not building third party libraries

I am using Android Studio 1.3.1 in Windows and same in Ubuntu.
In Ubuntu, everything is perfect.
But in Windows, when I compile third party libraries, the build fails and says:
Can not find resource
The build.gradle of my module is :
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "app.android.parking"
minSdkVersion 15
targetSdkVersion 22
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:22.2.1'
compile 'com.android.support:design:22.2.0'
compile 'com.android.support:support-v4:22.2.0'
compile 'cn.pedant.sweetalert:library:1.3'
}
the error is coming in the last line. And it is coming for every third party library,not only for this one.
When I open same project in Ubuntu, the build is successful.
The build.gradle of my project 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:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
The exact error is:
Error:A problem occurred configuring project ':parking'.
Could not resolve all dependencies for configuration ':parking:_debugCompile'.
Could not resolve cn.pedant.sweetalert:library:1.3.
Required by:
parking:parking:unspecified
Could not resolve cn.pedant.sweetalert:library:1.3.
Could not get resource 'https://jcenter.bintray.com/cn/pedant/sweetalert/library/1.3/library-1.3.pom'.
Could not GET 'https://jcenter.bintray.com/cn/pedant/sweetalert/library/1.3/library-1.3.pom'.
jcenter.bintray.com
I tried invalidating cache and restart, It did not work. It is compiling everything except those third party libraries.

Error:Artifact 'support-v4.jar (com.android.support:support-v4:21.0.3)' not found. Android studio 1.0.2

I did a new install of Android Studio 1.0.2. Getting the following error when opening my first existing android project:
Gradle 'MyApplication' project refresh failed
Error:Artifact 'support-v4.jar (com.android.support:support-v4:21.0.3)' not found.
Searched in the following locations: file:/C:/Users/Ntokozo/AppData/Local/Android/sdk/extras/android/m2repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
And if I navigate to that searched location I found two jar files which are: support-v4-21.0.3-sources.jar and support-v4-21.0.3-javadoc.jar
Here is my build.gradle file:
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()
}
}
Gradle file under App folder:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.ntokozo.myapplication"
minSdkVersion 15
targetSdkVersion 21
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:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
}
Thank you in advance, please bare in mind in responses that I'm a novice and I might not know advanced features.
After re-installing windows OS and a new Android Studio setup the problem disappeared. I don't know what was the problem at first.

debug: file not found in Android 1.0

Today I updated to Android Studio v 1.0 and I'm getting the following error when trying to compile whatever project.
....\app\build\intermediates\classes\debug: file not found
The thing is that before updating it I had no problems. Here is the code I'm actually trying to compile.
build.grade
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "razvitrance.testnavdrawerplz"
minSdkVersion 16
targetSdkVersion 20
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:support-v13:21.0.3'
}
build.gradle (for the 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:1.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
And the activity code is a simple Navigation Drawer.
Thank you for helping.
This is the erorr i'm getting.
http://gyazo.com/bdf375a160b1662ce4eb0d4e9aed8f30
Check this and this answers.
Generally, you will need to delete your grandle file and let Android Studio generate the one it thinks that it is correct, as it is being mentioned in the given posts. Happened to me too when i upgrated to newer version and that solved my problem.
It seems that Android Studio does not recognize non-alphanumeric symbols in path (cyrillic, for example). I had the same problem, and it was solved with creating project in another folder not containing cyrillic symbols in its path. In your case it may be '#' synmbol that makes a trouble

Gradle doesn't find dependency - Android Studio

Gradle no longer finds dependencies declared in the build.gradle. Everything was working fine and today when I open Android Studio I get an error :
Error:Failed to find: com.readystatesoftware.systembartint:systembartint:1.0.3
The library referenced is SystemBarTint. I had the library work previously using the same build.gradle file but now it no longer works.
My app/build.gradle looks like this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 19
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.example.adnan.systembartintdemo"
minSdkVersion 19
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.readystatesoftware.systembartint:systembartint:1.0.3'
}
My root/build.gradle looks like this :
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
Any ideas what I am doing wrong here? Thanks !
Edit : Tried importing a project which I work on daily at my work, it fails to find any dependencies in that project either. Tried re installing Android Studio, still the same error
Ok finally got this fixed.The problem was weird, for some reason it was trying to pick up a local offline copy of the dependency, I went to Settings -> Compiler -> Gradle -> Enabled offline Work and disabled it again. Save and Apply changes.
And now it works !

Categories

Resources