Add library to AndroidStudio project: Configuration with name 'default' not found - android

I got a project from a client which I'm supposed to fix. The developer of the app just bailed out and now it's up to me to fix it.
Problem is, that he probably developed with eclipse, while I'm using AndroidStudio. So it wasn't build with gradle. But I managed to import the project and fix it so far, that I can sync gradle.
But he seemed to use an external library, this one: https://github.com/InQBarna/TableFixHeaders
I copied the content of the library folder into my project folder /libraries/tablefixheaders/.
I added include 'libraries:tablefixheaders' to my settings.grade and added compile project('libraries:tablefixheaders') to my dependencies in build.grade.
But if I want to rebuild the project now, I get Error:Configuration with name 'default' not found.. Does the external library have to have a build.gradle? If so, how does it look like? I tried several things but nothing worked for me.

Maybe it's a bit late :)
but I build a wrapper for InqBarna's library ready to use with gradle on this way:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
dependencies {
compile "com.github.miguelbcr:TableFixHeaders-Wrapper:0.1.1"
}

Related

Error:(44, 13) Failed to resolve: org.achartengine:achartengine:1.2.0 [duplicate]

I have to create an application that makes extensive use of charts.
Reading the web I chose achartengine that seems to have everything I need.
I downloaded the jar file, I plugged in the libs folder, I selected "add to library" and I lunch the gradlew clean.
Result in the sources where I do the import of org.achartengine.xxxx I always returned the error that fails to resolve symbols .
Do you have suggestions?
Thank you
Andrea
I am able to use this library in my Android Studio project, this topic explains how to add AChartEngine repo to your project.
What I did:
Added following to project-wide build.gradle (one from the project root):
allprojects {
repositories {
...
maven {
url "https://repository-achartengine.forge.cloudbees.com/snapshot/"
}
}
}
For every module that uses the library, add this to its build.gradle (you may put this to the top-level build.gradle if it should be included in all modules):
dependencies {
...
compile group: 'org.achartengine', name: 'achartengine', version: '1.2.0'
}
Now I can use the library in the project, I see the classes in code assist popups and build runs as succeeds.
It seems like the new version (1.2.0) is not available for download anymore in the http://www.achartengine.org/ site. and that's why the gradle/maven method doesn't work (or the snapshot file was removed).
I succeeded using and adding it to my project by downloading the jar file from here:
https://github.com/ddanny/achartengine/files/460139/achartengine-1.2.0.zip

Error while trying to build library locally and binding to project: Error:Configuration with name 'default' not found

I have been trying to link the local copy of Android Beacon Library on my computer with my project on Android Studio and I have tried several methods described in this thread How do I add a library project to the Android Studio?
No matter what method I use, I keep getting the error stated in the title. Some threads on Stack Overflow suggest that this is due to submodules within the library and that it could be fixed with "git submodule update --init" but that didn't do anything for me.
As I've said, I tried different methods for adding the library but just for reference, the latest method I did was to add the library to the app/libs/ folder and make the following changes in the code:
settings.gradle: include ':app',':libs:AndroidBeaconLibrary'
build.gradle: added compile project(":libs:AndroidBeaconLibrary") to dependancies.
Ok so I've solved the problem. The issue was that it should have been ':app:libs:AndroidBeaconLibrary' instead of ':libs:AndroidBeaconLibrary' in both gradle files.
This fixed the error but a new one came up:
Error:Cannot cast object '23.0.0' with class 'com.android.repository.Revision' to class 'com.android.sdklib.repository.FullRevision'
I fixed this using this answer https://stackoverflow.com/a/33889117/3001845
I added the lines in the build.gradle file of the library itself under 'buildscript'
The section now looks like this:
buildscript {
repositories {
jcenter()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.github.JakeWharton:sdk-manager-plugin:220bf7a88a7072df3ed16dc8466fb144f2817070'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3'
}
}

How to make it possible to add my Library on GitHub to Android Gradle Files?

I have a project hosted on GitHub at https://github.com/BoardiesITSolutions/NavigationDrawerManager.
I've seen some projects on GitHub state adding it to their gradle file in Android Studio to the dependencies section but this doesn't seem to be working for me.
I have tried compile: 'com.github.boardiesitsolutions.NavigationDrawerManager:+' but it keeps saying it can't find it, I've also tried replacing the + with the version number but no luck, Android Studio keeps saying it can't find it. I've added the repository MavenCentral as well.
Is there something I need to do from GitHub to make it accessible for Gradle?
I don't see it on maven.
You can use this website to use non-mavenized libraries with Gradle.
Just add maven { url "https://jitpack.io" } to repositories section of build.gradle and use compile 'com.github.BoardiesITSolutions:NavigationDrawerManager:0b14c84445' in dependencies.

How to import a .aar file into Android Studio 1.1.0 and use it in my code

I have read a lot answers related to this topic, but none of them have worked to solve my problem, so need help with this:
I need to import a .aar file into a project created with Android Studio 1.1.0, I have imported it using the "New Module" option and actually I don't receive any error, I can build the application and run it, but when I try to use a class from this .aar file Android Studio doesn´t find the reference to it, let's say it can´t recognize the package that I want to include in my code.
You are maybe thinking that I must add the dependency, I have already done that, It seems to not work.
So someone could tell me which is the correct way to import and use a .aar file in Android Studio 1.1.0
To import an .aar library:
Go to File>New>New Module
Select "Import .JAR/.AAR Package" and click next.
Enter the path to the .aar file and click finish.
Go to File>Project Structure (Ctrl+Shift+Alt+S).
Under "Modules," in left menu, select "app."
Go to "Dependencies" tab.
Click the green "+" in the upper right corner.
Select "Module Dependency"
Select the new module from the list.
After reading a lot of answers on Stackoverflow, I found the solution for my problem, I want you to know which were the steps I followed in order to reproduce it:
Add a .aar file in my libs folder.
Use "New Module" option under File menu.
Import the .aar file.
Build gradle and compile the project.
When I tried to use the new module in my app, It didn't recognize any class inside the new module.
The problem is related to the version of Gradle, I was using 1.1.0 and there is a bug in this version, so my suggestion is to change the version to 1.0.1, there is an Issue already open in order to fix this problem https://code.google.com/p/android/issues/detail?id=162634
You should change the version in the build.gradle file located in the root of your project.
buildscript {
repositories {
jcenter()
}
dependencies {
//classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'com.android.tools.build:gradle:1.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
You can find additional information about this problem here https://groups.google.com/forum/#!topic/adt-dev/1Ho_c8dALQQ
I guess in version 1.2.0 this problem will be solved.
I follow steps in both answers but finally I need to add this line to my build.gradle:
allprojects {
repositories {
mavenCentral()
flatDir { dirs 'aars'} // this line
}
}
Use the gradle dependency
compile 'com.facebook.android:facebook-android-sdk:4.8.0'

Android Crashlytics plugin not installing library

When using the Crashlytics plugin in intellij I follow these steps.
Click plugin on toolbar.
Select App
Allow crashlytics to update AndroidManifest.xml as well has my first Activity.
Click "Next"
Try to build the App as the plugin instructs.
Then when i try to build i get this:
package com.crashlytics.android does not exist
I look in my dependencies and library and the jar is nowhere to be found.
What am I missing that would cause the library to not be loaded?
I solved this by following the maven instructions here https://crashlytics.com/downloads/maven and then just grabbing the jar from my .m2 and putting it in my libs folder. (This particular project was started as a maven project, then Maven was discarded and it has not yet been migrated to Gradle, so we're kind of in no-man's land). Anyway, I now have the jar.
The following configuration should work for Gradle-based projects:
buildscript {
repositories {
maven { url "http://download.crashlytics.com/maven" }
}
dependencies {
classpath "com.crashlytics.tools.gradle:crashlytics-gradle:1.+"
}
}
apply plugin: "crashlytics"
repositories {
maven { url "http://download.crashlytics.com/maven" }
}
dependencies {
compile "com.crashlytics.android:crashlytics:1.1.+"
}
Taken from https://crashlytics.com/downloads/gradle
After the automated setup from android studio, I was missing this line:
compile 'com.crashlytics.android:crashlytics:1.1.+'

Categories

Resources