Could not resolve all dependencies for configuration ':sample:_debugCompile' - android-studio

I know this was asked a few times but the solutions did not really help. I want to import the 'sample' project from https://github.com/zsoltk/overpasser into android studio and I get the following error:
A problem occurred configuring project ':sample'.
> Could not resolve all dependencies for configuration ':sample:_debugCompile'.
> Could not find com.android.support:multidex:1.0.1.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/multidex/1.0.1/multidex-1.0.1.pom
https://jcenter.bintray.com/com/android/support/multidex/1.0.1/multidex-1.0.1.jar
Required by:
overpasser3:sample:unspecified
> Could not find com.android.support:appcompat-v7:23.4.0.
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.4.0/appcompat-v7-23.4.0.jar
Required by:
overpasser3:sample:unspecified
> Could not find com.google.android.gms:play-services-location:9.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-location/9.2.1/play-services-location-9.2.1.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-location/9.2.1/play-services-location-9.2.1.jar
Required by:
overpasser3:sample:unspecified
> Could not find com.google.android.gms:play-services-maps:9.2.1.
Searched in the following locations:
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/9.2.1/play-services-maps-9.2.1.pom
https://jcenter.bintray.com/com/google/android/gms/play-services-maps/9.2.1/play-services-maps-9.2.1.jar
Required by:
overpasser3:sample:unspecified
Possible solution:
- Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
The web links android studio gives me here are redirecting me into another link which is total empty beside this:
{
"errors" : [ {
"status" : 404,
"message" : "Could not find resource"
} ]
}
The build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:2.1.2"
classpath "com.neenbedankt.gradle.plugins:android-apt:1.8"
classpath 'com.jakewharton.hugo:hugo-plugin:1.2.1'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
apply plugin: 'com.jakewharton.hugo'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "hu.supercluster.overpasser"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
signingConfigs {
debug {
storeFile file("overpasser-sample.jks")
storePassword "sample"
keyAlias "sample"
keyPassword "sample"
}
}
buildTypes {
debug {
}
}
}
dependencies {
apt "org.androidannotations:androidannotations:3.3.2"
compile "org.androidannotations:androidannotations-api:3.3.2"
// ---------
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-location:9.2.1'
compile 'com.google.android.gms:play-services-maps:9.2.1'
// ---------
compile project(':library')
compile project(':library-retrofit-adapter')
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'hu.supercluster.overpasser'
}
}

Try this
repositories {
mavenCentral()
jcenter()
google()
}

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
}
}

Failed to resolve Junit:Junit:12

I am getting following error when I tried to run my first app in android studio
Error:A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugUnitTestCompile'.
> Could not resolve junit:junit:4.12.
Required by:
Hellow_World:app:unspecified
> 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
Following is my Gradle.script(Module)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.example.administrator.hellow_world"
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.3.0'
}
Following is my Gradle.script(Hellow_World)
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
}
Can somebody help me fixing this mess?
Please follow the below mentioned path:
Right click on your application/project ->
open module settings->
Go to "Dependencies" tab ->
you'll find "junit:junit:4.12" ->
select it and right click and choose remove option -> ok
Now again try to build your application.
Remove the below line in your code
testCompile 'junit:junit:4.12'
then compile it .

Plugin with id 'crashlytics' not found issue with Android studio latest plugin

For the following gradle build configuration, I am facing Error:(11, 0) Plugin with id 'crashlytics' not found error.
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
apply plugin: 'hugo'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {
applicationId "com.wiznsystems.android"
minSdkVersion 15
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 files('libs/smartconfiglib.jar')
// You must install or update the Support Repository through the SDK manager to use this dependency.
compile 'com.crashlytics.android:crashlytics:1.+'
compile 'com.android.support:support-v4:19.+'
compile 'com.google.android.gms:play-services:4.2.42'
compile 'com.jakewharton.hugo:hugo-runtime:1.1.0'
compile 'com.squareup.retrofit:retrofit:1.+'
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.jakewharton:butterknife:5.+'
compile 'de.greenrobot:eventbus:2.2.1'
compile 'fr.avianey:facebook-android-api:+#aar'
compile 'com.squareup.picasso:picasso:2.+'
compile 'de.keyboardsurfer.android.widget:crouton:1.8.4'
compile project(':apptentiveandroidsdk')
}
Am I doing something wrong? or Is there any workaround for making it build?
I had the same issue. What I ended up doing was putting the order of the commands inline with what Crashlytics provided. I had something similar to yours and it didn't work. Once it changed it to the exact order of there docs it worked. Here is what mine looks like now. Hope this helps.
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.android.support:support-v4:19.0.+'
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.joanzapata.android:android-iconify:1.0.6'
compile 'com.github.hotchemi:android-rate:0.3.1'
compile 'com.loopj.android:android-async-http:1.4.5'
compile 'com.github.satyan:sugar:1.3'
compile 'com.crashlytics.android:crashlytics:1.+'
}
android {
compileSdkVersion 19
buildToolsVersion "20"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
Try informing the classpath dependency:
buildscript {
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
After battling with this error for hours, I ended up deleting the ".gradle" folder on my home directory, and the issue vanished! So, if you are getting this issue, try deleting the .gradle folder first, then rebuild your project.

Android Studio 0.5.3 cannot resolve Android classes

I've recently updated to Android Studio 0.5.3 and then to 0.5.4. From version 0.5.3 it cannot resolve Android classes. Compile is OK but IDE autocomplete is broken and big part of sources is now marked as error. Looks like this:
Root build.gradle:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Project's build.gradle:
buildscript {
repositories {
mavenCentral()
maven { url 'http://download.crashlytics.com/maven' }
}
dependencies {
classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+'
}
}
apply plugin: 'android'
apply plugin: 'crashlytics'
repositories {
maven { url 'http://download.crashlytics.com/maven' }
}
android {
compileSdkVersion 14
buildToolsVersion '19.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 14
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.squareup.okhttp:okhttp:1.3.0'
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.android.support:appcompat-v7:+'
compile 'com.squareup.picasso:picasso:2.2.0'
compile 'com.google.android.gms:play-services:4.0.30'
compile 'com.crashlytics.android:crashlytics:1.+'
}
I don't think it is a gradle issue, as build completes successfully. What can be incorrect? Or how can I fix this?
Fixed the issue by specifying following line in project's iml:
<orderEntry type="jdk" jdkName="Android API 14 Platform" jdkType="Android SDK" />
instead of:
<orderEntry type="jdk" jdkName="Maven Android 4.0 Platform" jdkType="Android SDK" />
Sometimes it reverts back. It's a bit annoying but better than having red sources and no code assist.

Resources