Could not find support-media-compat.aar - android

Trying Firebase to an android gradle app. As soon as I add the firebase dependency I get the following build error.
FAILURE: Build failed with an exception.
* What went wrong:
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find support-media-compat.aar (com.android.support:support-media-compat:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-media-compat/26.1.0/support-media-compat-26.1.0.aar
> Could not find support-core-utils.aar (com.android.support:support-core-utils:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-core-utils/26.1.0/support-core-utils-26.1.0.aar
> Could not find support-compat.aar (com.android.support:support-compat:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar
> Could not find support-compat.aar (com.android.support:support-compat:26.1.0).
Searched in the following locations:
https://jcenter.bintray.com/com/android/support/support-compat/26.1.0/support-compat-26.1.0.aar
It looks like it's only searching jcenter. But every reference of jcenter has other repos listed to search.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:3.2.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.2.0' // google-services plugin
}
}
allprojects {
repositories {
jcenter()
google()
maven {
url 'https://maven.google.com'
}
}
}
app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
defaultConfig {
applicationId "io.nme.samples.displayingabitmap"
minSdkVersion 16
targetSdkVersion 28
versionCode 181
versionName "1.0.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
api 'com.android.support:appcompat-v7:24.2.1'
api 'com.android.support:support-v4:24.2.1'
testImplementation 'junit:junit:4.12'
dependencies {
api project(':extension-api')
api project(':haxe-firebase')
}
implementation 'com.google.firebase:firebase-core:16.0.4'
}
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
What am I missing here?

I came across the same issue about locating libraries. However by adjusting the repositories order, this issue has been resolved.
repositories {
google()
jcenter()
// others
}
It seems that a maven site hosted by google is what we're looking for in the first place.
BTW, maven { url 'https://maven.google.com'} is used for Gradle version lower than 4.1 and google() is the newer form of that. See also this doc.

api 'com.android.support:appcompat-v7:24.2.1'
api 'com.android.support:support-v4:24.2.1'
That's your problem right there. Even without Firebase, this should've been causing issues. You're targeting and building with API 28, but your support dependencies are at API 24. Change them to use 28.0.0.
Also check your extension-api and haxe-firebase projects and make sure they're using the latest compile and SDK versions, as well as build tools version and support library versions.

You have to Replace 26.1.0 and use support library of version 28.0.0

use below
buildscript {
ext.kotlin_version = '1.2.20'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'2.3.3
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
}
}
allprojects {
repositories
{
maven { url "https://dl.google.com/dl/android/maven2/" }
maven { url "http://jcenter.bintray.com/" }
maven { url 'https://plugins.gradle.org/m2/'}
maven { url "https://maven.google.com" }
maven { url 'https://jitpack.io' }
mavenCentral()
flatDir {
dirs 'libs'
}
}
}

Related

Android Studio project sync FAILED

I attempted to import a project that Udacity's android course provided, but there were some issues. In the build.grade(app module) I changed compile toimplementation and testCompile to testImplementation. The project synced successfully, but when I executed the project on the emulator it gave me the following errors.
Could not find com.android.tools.build:aapt2:3.3.1-5013011.
Searched in the following locations:
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/google/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- file:/C:/Users/root/AppData/Local/Android/Sdk/extras/android/m2repository/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
- https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011.pom
- https://jcenter.bintray.com/com/android/tools/build/aapt2/3.3.1-5013011/aapt2-3.3.1-5013011-windows.jar
Required by:
project :app
I think the required libraries needed to build cannot be found, but I don't know how to solve this. I googled the problem, but I can't find a solution.
My build.gradle file is this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
defaultConfig {
applicationId "com.example.android.miwok"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
testImplementation 'junit:junit:4.12'
api 'com.android.support:appcompat-v7:23.3.0'
api 'com.android.support:support-v4:23.3.0'
api 'com.android.support:design:23.3.0'
}
build.grade(project) is:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.1'
// 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
}
Beginning with Android Studio 3.2, the source for AAPT2 (Android Asset Packaging Tool 2) is Google's Maven repository.
To use AAPT2, make sure that you have a google() dependency in your build.gradle file.
allprojects {
repositories {
google()
jcenter()
}
}
Check the official documentation.
The AAPT2 (Android Asset Packaging Tool) is a build tool that Android Studio and Android Gradle Plugin.
Android Gradle Plugin 3.0.0 and higher enable AAPT2 by default.
With Android Studio 3.2 to use AAPT2, make sure that you have a google() dependency in your build.gradle:
buildscript {
repositories {
google() // here
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
}
} allprojects {
repositories {
google() // and here
jcenter()
}

Could not resolve com.android.support:appcompat-v7:28.0.0

There are many different questions about this, but the problems there are about using v7.28.0, v7.28.+, v7.28.0.0-rc02 But when I sync my project I get this error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could
not resolve com.android.support:appcompat-v7:28.0.0.
I've checked Support library setup and followed it's instructions but it didn't help.
This is my module app
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.mobaleghan.nasimnoor"
manifestPlaceholders = [
onesignal_app_id: 'b1ced87b-48d1-4857-a68b-9c287aa4003f',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
minSdkVersion 16
targetSdkVersion 28
versionCode 8
versionName "1.6.3"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-annotations:27.1.1'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.onesignal:OneSignal:3.10.3'
}
and project gradle:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
The android studio internet connection is fine as I've tested in settings and I don't know where else to look.
I even created a new project in AS 3.2.1 But I get same error.
I don't know why this happens every time I update AS!
I'm sure other answers are good and working. but mine got solved by set proxy to Freedom of Developers.
This solution is for Persians like me who suffer from strict limitations for Iranians by google.
Now my app gradle look like this:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven { url 'https://maven.google.com' }
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.mobaleghan.nasimnoor"
manifestPlaceholders = [
onesignal_app_id: 'b1ced87b-48d1-4857-a68b-9c287aa4003f',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
minSdkVersion 16
targetSdkVersion 28
versionCode 9
versionName "1.6.4"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
debuggable true
}
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:preference-v7:28.0.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'com.onesignal:OneSignal:3.10.3'
}
Those repositories are there based on OneSignal documentations.
And top level build:
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
}
And everything is working fine.
Android project has 2 gradle files: one stored in project scope and one stored in application scope. (noted that one project can have many applications inside, but you usually have one). So you only need to swap defined repository url in those 2 gradle files.
Step 1: Remove these lines of code in your build.gradle (app)
repositories {
maven { url 'https://maven.google.com' }
}
Step 2: Add this to your build.gradle (project)
allprojects {
repositories {
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
mavenCentral()
}
}
One thing you have to aware that 28.0.0 is the last stable version of android.support. So you might want to downgrade version or migrate everything to androidX.
The stable release of 28.0.0 will be the final feature release packaged as android.support. All subsequent feature releases will only be made available as androidx-packaged artifacts.
Check out this link and welcome to the new era of androidX.
Try the following:
1) Uncheck offline work from build tools:
File -> Other Settings -> Default Settings -> Build, Execution, Deployment -> Build Tools->Gradle->Uncheck Offline work option.
2) If above doesn't work then go to your project's build gradle and add the following under repositories:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
merge this part from the module's build.gradle into the root project's build.gradle:
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
}
}
repositories {
maven { url 'https://maven.google.com' }
}
only keep these lines in the module's build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
android {
...
}
the root project's build.gradle should look about like this then:
buildscript {
repositories {
google()
jcenter()
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:0.12.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
You can still use version 28.0.0 but it seems its time to migrate to Android X!
According to Support Library Documentation:
Note: With the release of Android 9.0 (API level 28) there is a new
version of the support library called AndroidX which is part of
Jetpack. The AndroidX library contains the existing support library
and also includes the latest Jetpack components.
You can continue to use the support library. Historical artifacts
(those versioned 27 and earlier, and packaged as android.support.*)
will remain available on Google Maven. However, all new library
development will occur in the AndroidX library.
We recommend using the AndroidX libraries in all new projects. You
should also consider migrating existing projects to AndroidX as well.

Setting up firebase on Android studio

I am trying to setup firebase on my android studio.I am using a 2.2.3 version.So this is my code in app.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.parth.carpool"
minSdkVersion 22
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'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-a`enter code here`nnotations'
})
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.google.firebase:firebase-core:16.0.1'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is the error that I am receiving.
Error:(27, 13) Failed to resolve: com.google.firebase:firebase-core:16.0.1
This is my project.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.2.3'
classpath 'com.google.gms:google-services:4.0.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
}
To correct this error I installed google play services, google repository, SDK platform,SDK platform tools etc. after I saw some of the posts on stackoverflow. Does anybody have a solution?
First you need to upgrade android studio to the newest version:
If you're not using Android Studio 3.1 to develop your app, you will need to upgrade in order to get the correct version checking behavior within the IDE.
https://android-developers.googleblog.com/2018/05/announcing-new-sdk-versioning.html
Then you need to use the following top level gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Android Studio provides Awesome tool called Firebase Assistant, it handles any thing you need to setup firebase in you'r project
from Tools->Firebase
just pick which product you want and it'll do all the work for you
Make sure you are connected to a good network
Goto >file -> other settings -> Under build, execution, and deployment
-> you will see Gradle. uncheck the checkbox offline work. Then rebuild your project.
buildscript {
repositories {
// add google here
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'com.google.gms:google-services:4.0.0'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Did you try on this link
In your root build.gradle file add the repo:
maven { url "https://maven.google.com" }
It depends upon you how you want to setup you can try both explicit way and implicit way of setting up firebase .the easiest one is implicit one which is given in android studio

Gradle Project Sync Failed, Kotlin

I am using a beta Kotlin and Android-Studio channel. After update to the latest version i got some gradle sync error.
Below are the log i copied from Event Log:
Error:Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.0-rc-39.
Searched in the following locations:
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
file:/home/yourpc/Android/android/gradle/m2repository/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.pom
https://jcenter.bintray.com/org/jetbrains/kotlin/kotlin-gradle-plugin/1.2.0-rc-39/kotlin-gradle-plugin-1.2.0-rc-39.jar
Required by:
project :
below is the build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.0-rc-39'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
below is the app build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.udebest.myapplication"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
postprocessing {
removeUnusedCode false
removeUnusedResources false
obfuscate false
optimizeCode false
proguardFile 'proguard-rules.pro'
}
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
}
Please, anyone has an idea about this? I don't really know how can I solve this? I could not find any solutions out there.
Change your repositories in buildscript and allprojects into:
{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-dev/'
}
}
This works for me.
First, I updated Kotlin plugin thru tool, Kotlin, configure kotlin plugin update.
After, in App directory, in build.Gradle file search:
repositories {
// You need to add the following repository to download the
// new plugin.
google()
}
I add a new repository
maven { url 'C:/Program Files/Android/Android Studio/gradle/m2repository/'}
this is the path thru my local directory where the resources are. After this try again to sync
Change and try
classpath 'com.android.tools.build:gradle:3.1.0-alpha04'
to
classpath 'com.android.tools.build:gradle:3.0.0'
It may be due to the alpha release of gradle.
Use below version of kotlin in build.gradle(Project)
kotlin_version = '1.1.4-3'
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Declare dependency of kotlin in build.gradle(Module) as below
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
check your Kotlin version in build.gradle.
I got the same issue when the version was 1.1.0 which was added by default.
changed to recent version 1.3.21 then it is working fine.
This solution has worked for me for React Native(0.63) after installing react-native-image-picker by Ray Eldath, from above comment
//in android.build.gradle
{
google()
jcenter()
mavenCentral()
maven {
url 'https://dl.bintray.com/kotlin/kotlin-
dev/'
}
}
First, close Android studio, delete the .gradle folder, and then open Android Studio again, probably as an administrator
This will make it sync from the start, and solve the issue.
This issue was resolved for one of my peers.
Uninstall the Kotlin plugin (Preferences > Plugins > Kotlin > Uninstall) and use the version that comes with the IDE .

Can't import project to android studio

I'm trying to use this library
I've added
compile 'net.rdrei.android.dirchooser:library:2.0#aar'
to dependecies.
My top level build file
// 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.8.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
And it gives me error "failed to refresh gradle project" with reference to the project, that I'm trying to import.
This library is not on Central Maven as aar.
Check here:
http://search.maven.org/#search%7Cga%7C1%7Cnet.rdrei.android.dirchooser
it is an apklib format.
I've checked the snapshots repo, and here you can find this library.
https://oss.sonatype.org/content/repositories/snapshots/net/rdrei/android/dirchooser/library/
To use the snap repo you have to change your script:
repositories {
mavenCentral()
maven {
url "https://oss.sonatype.org/content/repositories/snapshots"
}
}
Then add you depencency, for example
compile 'net.rdrei.android.dirchooser:library:2.1-SNAPSHOT'
The answer provided by #unify #GabrieleMariotti and #AndyJoiner is correct. However it confused be since we have two gradle files - a project level gradle and a inner gradle (where you write your dependencies). The solution is to add the code suggested by #AndyJoiner inside your inner gradle.
Since I was confused as to where to add the code, which took me an hour to figure out, I don't want it to happen to others. So, I am posting my both gradle files.
Project Level Gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Inner Gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.itcse.materialdesignsearchviewlikegoogleplay"
minSdkVersion 15
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
// Add the code for repositories here
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'http://guardian.github.com/maven/repo-releases' }
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:21.0.3'
// Add the dependencies here
compile 'com.quinny898.library.persistentsearch:library:1.0.0-SNAPSHOT#aar'
}
Hope this help others in future.
This worked for me:
repositories {
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
You can find the repository here
https://oss.sonatype.org/#nexus-search;quick~dirchooser
After trying the answer by Gabriele and a bit more digging, this worked for me
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url 'http://guardian.github.com/maven/repo-releases' }
}
dependencies {
compile 'net.rdrei.android.dirchooser:library:2.2-SNAPSHOT#aar'
}

Categories

Resources