Error:(25, 13) Failed to resolve: com.google.code.gson:gson:2.3.1
Show in Project Structure dialog
build.gradle:app
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0 rc2"
defaultConfig {
applicationId "com.app.main"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile 'com.google.android.gms:play-services-base:7.8.0'
compile 'com.google.android.gms:play-services-gcm:7.8.0'
compile 'com.google.android.gms:play-services-maps:7.8.0'
compile 'com.google.android.gms:play-services-location:7.8.0'
compile project(':Uni_Image_Lod_Lib') }
builde.gradle: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.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}}
allprojects {
repositories {
jcenter()
}
}
step follows:
Android Studio Version 1.3.2
Restart computer
Invalidate caches/Restart
up dawn dependency.
but nothing to change. now what will be the solution for this.
After Some Changes
apply plugin:'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.app.main"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), proguard-rules.pro'
}
}}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.android.support:support-v4:23.0.1'
compile 'com.google.android.gms:play-services:7.8.0'
compile 'com.facebook.android:facebook-android-sdk:4.5.0'
compile project(':Uni_Image_Lod_Lib') }
and get error rebuild
Unresolved dependencies detected while building project in offline mode. Please disable offline mode and try again.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve com.google.code.gson:gson:2.3.1.
Required by:
APP:app:unspecified
No cached version of com.google.code.gson:gson:2.3.1 available for offline mode.
No cached version of com.google.code.gson:gson:2.3.1 available for offline mode.
then i have see in prefrences-> Build, Execution, deployment -> gradle.
project level setting is:
ticked use local gradle distribution
global gradle setting:
offline work is not ticked
compile 'com.google.code.gson:gson:2.3.1'
remove .1 and make it compile
'com.google.code.gson:gson:2.3'
as 2.3.1 is not stable and live yet, that's y its giving your error. also never use + while compiling as its not a best practice as per my knowledge.
You can simply do following:
buildscript {
repositories {
mavenCentral() //Add following
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
}
}
allprojects {
repositories {
mavenCentral() // Add following
jcenter()
}
}
Related
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'
I keep getting this error when I try to run my app in Android Studio
Error:(20, 0) Could not find method android() for arguments [build_cmskf0wjjh0skzgqp1j9qzll2$_run_closure2#29a3fe65] on root project 'pomppyapp' of type org.gradle.api.Project.
Open File
This is my build.gradle (Project: pomppyapp)
// 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'
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 2.3.3
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
}
dependencies {
}
Also another file there called build.gradle (Module: app) with the following:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.pomppyapp.com"
minSdkVersion 15
targetSdkVersion 23
versionCode 12
versionName '1.6'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable false
jniDebuggable false
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
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:11.0.4'
compile 'com.pkmmte.view:circularimageview:1.1'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-messaging:9.0.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.5.0'
compile 'com.android.tools.build:gradle:2.3.0'
}
apply plugin: 'com.google.gms.google-services'
Any help would be grateful, thanks in advance.
I think, this section in your top gradle build file is wrong:
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
}
It should stay only in project gradle.build file (in this case for module :app)
You should remove these following lines from project level build.gradle because there is no android gradle plugin applied in it.
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
}
dependencies {
}
It should be only in the module level gradle files in which android gradle plugin has been applied. :app in this case, in which android application gradle plugin has been applied (apply plugin: 'com.android.application')
I tried to add the following library as a dependency in my android project:
compile 'com.thehayro:infiniteviewpager:0.4'
which gives me the following gradle error when I build:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.google.android:support-v4:r13.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.pom
https://jcenter.bintray.com/com/google/android/support-v4/r13/support-v4-r13.jar
https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.pom
https://repo1.maven.org/maven2/com/google/android/support-v4/r13/support-v4-r13.jar
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/android/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.pom
file:/C:/Users/Henrykvdb/AppData/Local/Android/android-sdk/extras/google/m2repository/com/google/android/support-v4/r13/support-v4-r13.jar
Required by:
xkcdexplain:app:unspecified
xkcdexplain:app:unspecified > com.thehayro:infiniteviewpager:0.4
I tried manually adding the android support library and installing it with the android sdk manager but neither of those things worked.
I also read somewhere that I could try to find a download for the library and manually add it but there must be a more elegant way then that.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.henrykvdb.xkcdexplain"
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.4.0'
compile 'com.android.support:design:23.4.0'
compile 'org.jsoup:jsoup:1.10.1'
compile 'com.google.code.gson:gson:2.7'
compile 'com.thehayro:infiniteviewpager:0.4'
}
global/top-level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In my Android application, I want to add Uber facility to users so that I looked the following library. So that I added the compile 'com.uber.sdk:rides-android:0.1.0' in my main module's (Main application) build.gradle file. It gives me following error when sync the gradele
Failed to resolve: com.uber.sdk:rides-android:0.1.0
I have some other libraries referenced to the application.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.+'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.qapp"
minSdkVersion 14
targetSdkVersion 21
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile project(':facebookSDK')
compile project(':payPalDemo1')
compile project(':uberLibrary')
compile project(':bSLibrary')
compile project(':pullToRefresh')
compile project(':androidmapsutils')
compile 'com.android.support:support-v4:21.0.3'
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:multidex:1.0.0'
compile files('libs/android-async-http-1.4.6.jar')
compile files('libs/cardio.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile files('libs/UserFormValidation.jar')
}
Please help me to resolve this exception.
Try to add this in your gradle file
repositories{
maven { url "https://jitpack.io" }
}
In the portion of your build.gradle file that you have included you only have the mavenCentral() repository specified within the buildScript block. In order to make that repository accessible outside of that context you should include a block such as the following to the root level of your build.gradle:
repositories {
mavenCentral()
}
In addition, you have not actually included the line compile 'com.uber.sdk:rides-android:0.1.0' in the file copied in your question.
Ultimately, your build.gradle should include the following:
repositories {
mavenCentral()
}
dependencies {
compile 'com.uber.sdk:rides-android:0.1.0'
}
this SDK is designed to work with Android SDK 16. so minSdkVersion should be 16 or greater
I have downloaded me friends android project. When I open it with android studio it starts to sync gradle. However it gives to me invalid argument error.
My build.gradle file:
buildscript {
repositories {
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'crashlytics'
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
jcenter()
maven { url 'http://download.crashlytics.com/maven' }
maven { url 'http://audiobox.keytwo.net' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "kz.itsolutions.businformator"
minSdkVersion 19
targetSdkVersion 23
versionCode 20150105
versionName "1.95"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
}
}
dexOptions {
javaMaxHeapSize "4g"
jumboMode = true
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0#aar'
compile 'com.viewpagerindicator:library:2.4.1#aar'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.j256.ormlite:ormlite-core:4.48'
compile 'com.j256.ormlite:ormlite-android:4.48'
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'org.osmdroid:osmdroid-android:4.2'
compile 'org.slf4j:slf4j-simple:1.6.1'
compile 'com.parse.bolts:bolts-android:1.2.0'
compile files('libs/Parse-*.jar')
compile 'com.android.support:support-v4: 22.1.1'
}
I think the main problen is the compileSdkVersion, buildToolsVersion, midsdkVersion and targetSdkVersion. I have installed all avilable sdk versions and changed these numbers, stil does not work.
I think this project uses outdated gradle version which had different argument for something.
What needed to change to make project able to build?
Stack trace of my gradle is:
Gradle 'bus_informator' project refresh failed
Error:Error:Invalid argument
I have tried to find similar questions, but I haven't found.
I have run gradlew assemble --info and it gave me that kind of error:
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.crashlytics.sdk.android:crashlytics:1.7.0.
Searched in the following locations:
http://dl.bintray.com/populov/maven/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
http://dl.bintray.com/populov/maven/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
https://jcenter.bintray.com/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
https://maven.fabric.io/public/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
https://maven.fabric.io/public/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
http://audiobox.keytwo.net/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
http://audiobox.keytwo.net/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/android/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.pom
file:/D:/My path/Mobi/adt-bundle-windows-x86_64-20130917/adt-bundle-windows-x86_64-20130917/sdk/extras/google/m2repository/com/crashlytics/sdk/android/crashlytics/1.7.0/crashlytics-1.7.0.jar
Required by:
bus_informator:app:unspecified
I fixed this problem by changing this
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('libs/*.jar')
to this
compile fileTree(dir: 'libs', include: ['*.jar'])