I'm trying to get into developing using android studio, so I recently tried to run a simple login-activity app on it. Basically, what I did was just run the setup for a new android studio project, and selected loginactivity as my default screen. I configured the emulator and hit sync gradle, but it gave me the following response:
image
I downloaded the repository that was required and tried to sync the gradle again, but it again asked exactly the same thing! Please help!
my gradle file for the app:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion "27.0.3"
defaultConfig {
applicationId "com.fyp.fingerpay"
minSdkVersion 23
targetSdkVersion 27
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.google.android.gms:play-services:10.2.6'
compile 'com.android.support:appcompat-v7:27.+'
}
I think you have forgot to add maven repository in your app gradle file.
Try by doing these steps.
Open the build.gradle file for your application.
Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example:
allprojects {repositories {jcenter()maven {url "https://maven.google.com"}}}
Avoid using + in your dependencies as it android studio will try to update dependencies every 24 hours.
Also replace compile by implementation for low APK size.
Related
Upgraded to:
Android Studio 3.0 Canary 2
com.android.tools.build:gradle:3.0.0-alpha2
I have a multi-module project (main app + sub modules)
Inclusion inside the main app:
dependencies {
implementation project(path: ':testlib', configuration: 'default')
}
The testlib is defined as a simple android library project and works normally when included with gradle 2.3.0 and via compile project(path: ':testlib')
I get the following gradle error message:
Could not resolve all dependencies for configuration ':app:devDebug_signedCompileClasspath'.
Selected configuration 'default' on 'project :testlib'
but it can't be used as a project dependency because
it isn't intended for consumption by other components.
What does "isn't intended for consumption by other components" mean in this context? The module is defined as an android library.
Here is the build.gradle of the testlib:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 16
targetSdkVersion 25
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'])
}
What am I missing?
I also got this error. Android Studio 3.0 Canary 4 just came out. I updated to it, which also updates gradle to 4.0rc1.
The problem went away on it's own.
alter your Top-level build file (aka root gradle)
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
still not working?
update dist-url (inside gradle-wrapper.properties)
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-rc-1-all.zip
I am building a golf score card app with android studio and last night before I shut down my laptop it was building fine, however, this morning when I run Android studio I got the error "Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "aed79d567e57792ed352e708d2b7ca891ff897c6"" and my app structure has also altered and there is no longer a manifest folder.....image of app structure``
Below is my gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.biko.golfstroke"
minSdkVersion 8
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'
}
Please help if you can this is so frustrating!
PLZ update your gradle plugin version in the rooter gradle file as following:
classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
check the newest version of android gradle plugin in here
I think the android studio should fix this version problem by himself, it`s a bad experience for changing it manually.
I changed my class path to: classpath 'com.android.tools.build:gradle:2.0.0-alpha6'
and then followed this post:change distribution url
and it was solved....
Thanks for all the help!
After update with the latest Android support library 23.1 i get this error
Failed to resolve: com.android.support:support-v4:23.0.0
I tried all combination of 23.+ and 23.1.0 and 23.1.+ etc. How to make it run properly?
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ua.g.tfinder"
minSdkVersion 14
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.+'
compile 'com.android.support:support-v4:23.+'
compile 'com.android.support:recyclerview-v7:23.0.+'
compile 'com.android.support:cardview-v7:23.0.+'
compile 'com.android.support:design:23.0.+'
compile 'com.google.android.gms:play-services:7.5.+'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
}
The support libraries are now available through Google's Maven repository.
Step 1: Open the build.gradle file of your project.
Step 2: Make sure that the repositories section includes a maven section with the "https://maven.google.com" url in it.
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
I ran into the same problem today. Although the SDK Manager marked a few libraries as installed, investigating the location of the files showed me the correct folder structure, without any files in them.
For example, checking out the location of 23.1.0 appcompat-v7 on my Mac:
.../sdk/extras/android/m2repository/com/android/support/appcompat-v7
turned out to be an empty folder.
I suspect the update I ran minutes before went wrong somehow.
What solved it for me:
in Android Studio, open Appearance and Behaviour -> System Settings -> SDK Manager
under tab "SDK Tools" un-check the libraries causing problems
click "apply" to uninstall them
re-check the same libraries
click "apply" to reinstall them
close SDK Manager and run Gradle sync / build
Had to add "Android Support Repository" from SDK Manager.
As you already have v7 dependency added in your gradle file no need to add dependency for v4 because it is already included in v7 library.
gradle file should looks like this
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "ua.guru.lvivflatfinder"
minSdkVersion 14
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
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.1.0'
compile 'com.android.support:recyclerview-v7:23.1.0'
compile 'com.android.support:cardview-v7:23.1.0'
compile 'com.google.android.gms:play-services:8.1.0'
}
.......
(build.gradle (MOdule.app)
implementation 'com.android.support:cardview-v7:28.0.0-rc01'
In my case, opening SDK manager and installing Local Maven Repository for Support Libraries fixed my issue.
Go to File -> Project Structure then select Dependencies tab and remove com.android.support:support-v4:23.0.0
It worked for me
Gradle sync / build
implementation 'com.android.support:cardview-v7:28.0.0-rc01'
ready and go!
I got a similar problem, was trying to change versions and so on. Did not work for me. Only after I changed the version and restarted Studio it started to work. Probably gradle doesn't sync that normaly while you don't restart Studio.
I got this error when I tried to build the app while being OFFLINE. After connecting to the internet it worked :-)
he support libraries are now available through Google's Maven repository.
Step 1: Open the build.gradle file of your project and add the following dependencies.
allprojects {
repositories {
jcenter()
mavenLocal()
mavenCentral()
jcenter()
google()
}
So I feel like I've exhausted all options to try and get this to work and is driving me f***** crazy.
I'm trying to implement the adobe creative SDK. I have followed this tutorial very attentively but it's still not working.
All I get when clicking sync with grade etc is the following error:
Error:(41, 13) Failed to resolve: com.adobe.creativesdk:image:4.0.0
Show in File<br>Show in Project Structure dialog
Here's my build.grade file:
apply plugin: 'com.android.application'
apply plugin: 'maven'
repositories {
mavenCentral()
jcenter()
maven {
url "${project.rootDir}/creativesdk-repo" //ADD THE CORRECT LOCATION OF THE CREATIVESDK LIBRARY FILES
}
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "editor.test"
minSdkVersion 14
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META- INF/NOTICE.txt'
exclude 'META-INF/LICENSE.txt'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.adobe.creativesdk:image:4.0.0'
}
If anyone can help, it will save my sanity.
Also, I've looked at the following questions and they didn't work either:
Trying to make an Android Studio Application with Adobe Creative SDK Image Editing, cannot get libraries compiled in gradle
Android Studio Error when adding Adobe Creative SDK
I ran into the same problem. The documentation is wrong.
The line should be:
maven {
url "${project.rootDir}/creativesdk-repo/release"
}
The newest Android SDK is no longer downloadable. Instead, you need to change the URL to:
url 'https://repo.adobe.com/nexus/content/repositories/releases/'
Check Adobe documentation for more details.
I want to use this library in a project in Android Studio, so as mentioned in read me, I created new project in the Android Studio and added dependencies in build.gradle file inside the app folder as:
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.mycompany.swipe_instagram"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.lorentzos.swipecards:library:1.0.8#aar'
}
Then when I sync I started getting this error as:
I have Searched on the google and stack overflow but can't find any appropriate solution.
I used your "build.gradle" file and it is working fine for me (both with and without "aar"). Could be something wrong with the cache. Try "File -> Invalidate Caches / Restart"). Another way to generate more error message detail is to try building the module from the command line and getting verbose output
gradle -info compileDebugSources
You'll get lots of output which should give you a hint as to what's going wrong