I am trying to add this dependency https://github.com/hoang8f/android-flat-button in to my android studio project and I am getting
Error:(26, 13) Failed to resolve: info.hoang8f:fbutton:1.0.5
I am able to add google play services dependency easily without any problems.
Below is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'info.hoang8f:fbutton:1.0.5'
}
Solutions tried:- 1.)Gradle is working in online mode not offline.
2.)Cleaned and builded/rebuilded the project.
3.) Changed to
repositories {
mavenCentral()
}
in my root gradle file
4.) Tools->android->Sync Project with gradle files
Still no luck in making it work.
P.S.:- Not that it effects the questions, I faced the same problem while trying to add parse sdk via gradle, so I added the jar file independently.
add
repositories {
mavenCentral()
}
include android tag
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.planner"
minSdkVersion 15
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
mavenCentral()
}}
Please try this. Add fbutton-1.0.5.aar file into your lib folder.
repositories {
flatDir {
dirs 'libs'
}
}
Add aar file into dependencies.
dependencies {
compile(name:'ARFile', ext:'aar')
}
Did you noticed how looks like build.gradle of a demo project?
https://github.com/hoang8f/android-flat-button/blob/master/demo/build.gradle
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 9
targetSdkVersion 19
versionCode 2
versionName "1.1"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
} }
dependencies {
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.larswerkman:HoloColorPicker:1.4'
compile fileTree(dir: 'libs', include: ['*.jar']) // compile project(':library')
compile 'info.hoang8f:fbutton:1.0.5'
}
Check if you're not missing something in your Gradle file or you put something wrong
EDIT: I've put whole your build.gradle file into my new project and it's work fine.
If rebuilding not help, create a new clean project and put this build.gradle. Tell me is it works with new project.
EDIT2:
In your project you have two build.gradle change the second one to
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.google.gms:google-services:1.5.0-beta2'
}
}
allprojects {
repositories {
jcenter()
}
}
I had the same problem.
Invalidate cache and restart your android studio. Then sync gradle.
I cloned the project and used "demo" module to test the lib. The lib that you needed was downloaded successfully and this is expected, because it exists in the maven repo
The only point I noticed - probably you may have problems with gradle, because there's runProguard command, that is not used in gradle no more.
So you may just delete it or change to minifyEnabled false.
After doing this, demo project assembles successfully
Related
I am trying to import pd-for-android into my project as a gradle dependancy as per the instructions on pd-for-android's githubpage (i.e. make sure jcenter() is in the top level repositories in build.gradle, then add compile 'org.puredata.android:pd-core:1.0.1' to your dependancies in the app build.gradle)
I followed these instructions but I cannot see the library downloading into my external libraries. Is there something else i need to do in order to get this working?
here's my gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "21.1.2"
defaultConfig {
...
minSdkVersion 19
targetSdkVersion 21
versionCode 1
versionName "1.0"
ndk {
...
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.2.1'
compile 'io.reactivex:rxjava:+'
compile 'io.reactivex:rxandroid:+'
compile 'org.puredata.android:pd-core:1.0.1'
}
Check if It's inside app\build\intermediates\exploded-aar\
If you have there the library, you shouldn't have any problem to use it.
Does it show up correctly as dependency when you click File->Project Structure and then on the dependencies tab in Android Studio?
if not, have you tried to add it there via the "+" Button?
I am developing an app using SQLiteAssetsHelper in Android studio and I have seen two build.gradle files. one is in the app folder and second is in folder, in my (project's name) folder the build.gradle file contains folowing
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
but i saw most examples with mavenCentral() in repositories .. what should I have to do in this build.gradle file??..
second build.gradle file in app folder contains the following..
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.appxone.practicesqliteassetshelper"
minSdkVersion 8
targetSdkVersion 22
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:22.0.0'
}
in github they said to use
compile `com.readystatesoftware.sqliteasset:sqliteassethelper:+`
in dependecies and to use add jar file of sqliteassetshelper in lib folder..
but im totally confuse in which build.gradle , which dependencies i have to add this compile com.readystatesoftware.sqliteasset:sqliteassetshelper:+ statement.. and do i change the jcenter() into mavenCentral()..
i have used SQLiteOpenHelper class but this give only bunch of codes..and stackflow give me suggestion to use SQLiteAssetsHelper ..please help me
I make an assets/databases/myDB.db as well but now what should i do next..
You need to add
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
into your module build.gradle file (usually it's called "app"), not in the top-level build file. So your module build.gradle should look like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.appxone.practicesqliteassetshelper"
minSdkVersion 8
targetSdkVersion 22
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:22.0.0'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
}
EDIT:
Also, you should change buildToolsVersion "21.1.2" to buildToolsVersion "22.0.1", but I'd suggest you to use buildToolsVersion "23.0.1" along with targetSdkVersion 23 and com.android.support:appcompat-v7:23.0.1 to support latest Android version.
There are two gradle files. 1st is build.gradle (Project Foo) and the other is build.gradle (Module : App). Do not dare edit the 1st one.
Add it here:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.0.0'
}
make changes to app:gradle file
Replace your from:
buildToolsVersion "21.1.2"
To this:
buildToolsVersion "22.0.1"
I am having trouble in importing and using the volley library in the android studio 1.3.0 project. I have followed tutorials online to import the volley from git into the project directory.
Now, I am having trouble in making it work with the project. I am unable to build it using instructions online.
Error it generates is:
Error:(23, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'Hrup' may be using a version of Gradle that does not contain the method.
Gradle settingsThe build file may be missing a Gradle plugin.
Apply Gradle plugin
I have included files like, build.gradle for all folder, and settings.gradle
Build.gradle (volley)
// NOTE: The only changes that belong in this file are the definitions
// of tool versions (gradle plugin, compile SDK, build tools), so that
// Volley can be built via gradle as a standalone project.
//
// Any other changes to the build config belong in rules.gradle, which
// is used by projects that depend on Volley but define their own
// tools versions across all dependencies to ensure a consistent build.
//
// Most users should just add this line to settings.gradle:
// include(":volley")
//
// If you have a more complicated Gradle setup you can choose to use
// this instead:
// include(":volley")
// project(':volley').buildFileName = 'rules.gradle'
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
compile project (':volley')
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion = '22.0.1'
}
apply from: 'rules.gradle'
dependencies {
}
Build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bali.hrup"
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.1'
}
Build.gradle(Hrup{my project name})
// 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:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Settings.gradle
include ':app'
include ':volley'
Just a Small Change, Edit the file build.gradle(app), not the build.gradle(volley)
Just add a single line
compile project (':volley')
Final file(build.gradle(app)) will look like:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bali.hrup"
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.1'
compile project (':volley')
}
I am quite new into Android World. I have added SMACK 4.1.0 for developing XMPP connectivity. While trying to build app, got below errors consistently. Tried googling but no fruitful results. Kindly provide your help.
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not resolve de.measite.minidns:minidns:[0.1,0.2).
Required by:bind:app:unspecified > org.igniterealtime.smack:smack-android:4.1.0 > org.igniterealtime.smack:smack-resolver-minidns:4.1.0
Failed to list versions for de.measite.minidns:minidns.
Unable to load Maven meta-data from https://jcenter.bintray.com/de/measite/minidns/minidns/maven-metadata.xml.
Could not GET 'https://jcenter.bintray.com/de/measite/minidns/minidns/maven-metadata.xml'.
peer not authenticated
Build.Gradle(Project:bind) file is :-
// Top-level build file where you can add configuration options common to
all sub-projects/modules.
buildscript {
repositories {
maven {
url 'https://oss.sonatype.org/content/repositories/snapshots'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
Build.Gradle(Module:app) file is :-
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "com.example.sukeshsaxena.bind"
minSdkVersion 8
targetSdkVersion 22
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:22.2.0'
//Smak config for XMPP over TCP
compile "org.igniterealtime.smack:smack-android:4.1.0"
compile "org.igniterealtime.smack:smack-tcp:4.1.0"
}
Let me know if anything else is required.
Newest version of
de.measite.minidns:minidns is 0.1.7
org.igniterealtime.smack:smack-resolver-minidns is 4.1.3.
Try to use
de.measite.minidns:minidns:0.1.7
org.igniterealtime.smack:smack-resolver-minidns:4.1.3
in your gradle file.
Android Studio cannot find the necessary YouTube classes in my application. I'm recycling some code of a previous project. In the previous project I just imported the jar file provided by google. But I want to learn a better way using gradle. I've used gradle before with success. Its awesome when it works. I've been able to add dependencies using gradle before. But for some reason I can't get a google lib to download or activate or whatever it needs to do so that my IDE can find all these missing youtube symbols. I've done the usual syncing with gradle and rebuilding and cleaning and all that but it hasn't helped.
Here is my build.gradle file:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "dayspringwesleyan.org.dayspringwesleyanchurch"
minSdkVersion 10
targetSdkVersion 22
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:22.2.0'
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.google.apis:google-api-services-youtube:v3-rev141-1.20.0'
compile 'com.koushikdutta.ion:ion:2.1.6'
}