I'm trying to reference SpotifyWebApi in AndroidStudio. I'm using the instructions here
https://github.com/kaaes/spotify-web-api-android/blob/master/README.md
However I get the error
Error:Failed to resolve: :spotify-web-api-android-0.1.0:
when I try to build.
How can I fix this? I have AndroidStudio 1.2.2
Here's my Module:app build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "app.com.example.android.spotifystreamerstage1"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
compile(name:'spotify-web-api-android-0.1.0', ext:'aar')
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
// Other dependencies your app might use
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
}
spotify-web-api-android is not included maven central repository. the doc of the link has wrong info. I don't know why..
Alternatively I have found this link and next codes.
repositories {
maven {
url "https://github.com/z0lope0z/raws/raw/master"
}
mavenCentral()
}
dependencies {
compile 'kaaes.spotify.webapi.android:spotify-web-api-android:0.1.0'
}
Related
I exported my Build box project and opened it on Android studio. But Unable to Build it.I'm getting this error.
Failed to resolve: appcompat-v7
Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.test.test1"
minSdkVersion 16
targetSdkVersion 26
multiDexEnabled true
ndk {
moduleName "player_shared"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
dexOptions {
javaMaxHeapSize "4g"
}
}
dependencies {
implementation 'com.google.android.gms:play-services:+'
implementation 'com.android.support:multidex:1.0.3'
implementation fileTree(dir: 'libs', include: ['*.jar'])
// More deps here //
}
anyone know how to fix this ?
Add this in dependencies:
implementation 'com.android.support:appcompat-v7:27.1.1'
Add this in project gradle
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
}
Please I am a beginner in Android development.
I just tried to run my first code in line with the tutorial I am using to learn.
I got this error:
Gradle DSL method not found: 'buildToolsVersion()'
This is my build.gradle(Project:HappyBirthday)
// 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.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
}
And this is my build.gradle(Module:app)
apply plugin: 'com.android.application'
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.android.happybirthday"
minSdkVersion 15
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'
}
You seem to be missing the android closure and your compileSdkVersion line. Change your second file to look like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.android.happybirthday"
minSdkVersion 15
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'
}
I have new clear android app. I want to add volley to my app to make HTTP request. I am developing app with Android studio using Gradle. Here is screenshot for my app:
Ass you see i am going to add volley to my app adding this line of code com.mcxiaoke.volley:library-aar:1.0.0 to build.gradle file
I tried to add Retrofit too. But it gives same type of error: Failed to resolve: bla bla bla.
So i think in my situation gradle can not sync any other library different than com.android......
And i have tried add this lines of code to my build.gradle too. but nothing is changing
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
repositories {
mavenCentral()
}
}
Please advise
Edit: After comments added build.gradle files for project and for module.
Project:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Module:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "domain.testgradle"
minSdkVersion 11
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:23.0.1'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
Volley is now published by the Android Open Source Project on jCenter:
dependencies {
compile 'com.android.volley:volley:1.0.0'
}
You can use
com.mcxiaoke.volley:library-aar:1.0.1
Or its latest version (Not aar)
compile 'com.mcxiaoke.volley:library:1.0.19'
And set
buildToolsVersion "23.0.1"
and use
'com.google.code.gson:gson:2.3'
Add this
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:+'
compile 'com.mcxiaoke.volley:library:1.0.19'
}
I found a solution in this post. But it's old and does not work for latest version.
I tried this:
apply plugin: 'android-sdk-manager'
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
Repositories {
Maven {
url 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:cardview-v7:22.2.0'
compile 'org.xwalk:xwalk_core_library:13.42.319.11'
//compile ('com.github.florent37:materialviewpager:1.0.1#aar'){
// transitive=true
//}
compile project(':materialviewpager')
}
But I got this error:
Error:A problem occurred configuring project ':sample'.
Could not resolve all dependencies for configuration ':sample:_debugCompile'.
Could not resolve org.xwalk:xwalk_core_library:13.42.319.11.
Required by:
MaterialViewPager-master:sample:unspecified
Could not parse POM https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/13.42.319.11/xwalk_core_library-13.42.319.11.pom
Already seen doctype.
I get this error during gradle build when importing a project in android studio o.8.14
Gradle DSL method not found: 'android()''
I know the error has something to do with the gradle files but I don't know the way forward or where exactly to start.
The top level build.gradle file looks like this
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
}
dependencies {
compile 'com.android.support:appcompat-v7:+'
compile 'com.android.support:support-v4:+'
compile 'com.google.android.gms:play-services:+'
}
And the module build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.shimba.android.events"
minSdkVersion 9
targetSdkVersion 20
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.android.support:appcompat-v7:19.+'
compile project(':universalImageLoaderLibrary2')
compile 'com.google.android.gms:play-services:+'
compile 'com.android.support:support-v4:20.+'
}
Where am I going wrong?