Don't working this library from GitHub in Android Studio
My build.gradle(:project):
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.mymaterialdialogs"
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.0.1'
compile('com.afollestad.material-dialogs:core:0.8.4.2#aar') {
transitive = true
}
}
And My build.gradle(:app):
buildscript {
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Show this Error:
Error:(26, 13) Failed to resolve:
com.afollestad.material-dialogs:core:0.8.4.2 Show in
File(openFile:.../app/build.gradle)Show in Project Structure
dialog(open.dependency.in.project.structure)
Do the following steps:
1.In your build.gradle(:project) Add the following before dependencies
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.0.1'
compile('com.afollestad.material-dialogs:core:0.8.4.2#aar') {
transitive = true
}
}
2.In your build.gradle(:app): replace
maven { url "https://jitpack.io" } with jcenter()
3.Sync project
Hope this helps.
Related
Unable to resolve dependency for ':app#release/compileClasspat': could not resolve com.nineoldandroidlibs:library:2.4.0 I am trying to import fancy button and pie chart libraries but i am getting the error mention above. I tried everything but nothing works. Following is my gradle file of project
buildscript {
repositories {
google()
// maven { url "https://maven.google.com"}
maven {
url 'https://maven.google.com'
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url 'https://maven.google.com'
}
google()
// maven { url "https://maven.google.com"}
//maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Following is my Gradle Project file
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.example.hamzanaeem.gasapplication"
minSdkVersion 16
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 {
implementation fileTree(dir: 'libs', include: ['*.jar'])
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'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.github.blackfizz:eazegraph:1.2.2#aar'
compile 'com.github.medyo:fancybuttons:1.8.4'
}
Please help I`ve already tried all of the solution from stackoverflow too.
Thanks
My gradle sync fails because of this error:
I don't know exactly what is wrong with my gradle configuration (It must be something with maven import). Here are the files:
build.gradle (Top level)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
maven { url 'https://repo.spring.io/libs-milestone' }
flatDir {
dirs 'libs'
}
}
}
build.gradle (app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.confidential.packageid"
minSdkVersion 16
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res-img']
}
}
}
repositories {
mavenCentral()
maven { url "https://repo.spring.io/release" }
maven { url "https://repo.spring.io/milestone" }
maven { url "https://repo.spring.io/snapshot" }
maven { url 'https://repo.spring.io/libs-milestone' }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile(name:'sdk-release', ext:'aar')
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:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.android.gms:play-services:10.2.1'
compile 'com.android.support:support-v4:25.3.1'
...
testCompile 'junit:junit:4.12'
...
compile 'com.noveogroup.android:androidlogger:1.3.6'
compile 'com.github.ybq:Android-SpinKit:1.0.5'
}
apply plugin: 'com.google.gms.google-services'
Which part of my gradle files is wrong?
Well, this exists... https://jcenter.bintray.com/com/noveogroup/android/android-logger/1.3.6/
(You're missing a dash. android-logger)
And maybe follow directions here? https://github.com/ybq/Android-SpinKit#gradle-dependency
For example,
allprojects {
jcenter()
// mavenCentral()
repositories {
maven { url "https://jitpack.io" }
...
}
Remember: jcenter() is a superset of mavenCentral()
Android buildscript repositories: jcenter VS mavencentral
Then, regading other things
// compile 'com.android.support:appcompat-v7:25.3.1' // not needed
compile 'com.android.support:design:25.3.1'
compile 'com.google.firebase:firebase-core:10.2.1' // Should really use 'database' or 'messaging' instead
compile 'com.google.android.gms:play-services:10.2.1' // Should be split
// compile 'com.android.support:support-v4:25.3.1' // not needed
Refer to "Selectively compiling APIs into your executable" https://developers.google.com/android/guides/setup
I have Crashlytics working in my App.
I've added an Android Module to my App named 'engine-module' which has it's own Gradle dependencies.
I don't know how to import the Crashlytics dependency correctly and I just get the following error:
Error:(31, 13) Failed to resolve:
com.crashlytics.sdk.android:crashlytics:2.6.5
What I want to achieve is being able to access 'Crashlytics' from a Class within the 'engine-module' for example:
Crashlytics.setUserName("temp user name");
Is this possible? If so, how can it be achieved?
Project: build.gradle
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects {
apply from: '../jacoco.gradle'
}
App/build.gradle
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.neenbedankt.android-apt'
/**
* Default values for configuration options
*/
def suffixDefault = ""
def versionCodeDefault = 1
def versionNameDefault = "developerBuilt"
/**
* Android-specific configuration
*/
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.flowmellow.projectx
minSdkVersion 16
targetSdkVersion 25
versionCode project.getProperties().get('versionCode') ? project.getProperties().get('versionCode').toInteger() : versionCodeDefault
versionName project.getProperties().get('versionName') ? project.getProperties().get('versionName') : versionNameDefault
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
debug {
// Configurable options
applicationIdSuffix project.getProperties().get('appIdSuffix', suffixDefault) + ".debug"
// Common options
testCoverageEnabled true
}
release {
// Configurable options
applicationIdSuffix project.getProperties().get('appIdSuffix', suffixDefault)
// Common options
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
/**
* Dependencies
*/
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:design:25.0.0'
//Dependency injection
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.1'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.robolectric:robolectric:3.1.2'
testCompile 'org.hamcrest:hamcrest-library:1.1'
compile 'com.android.support.constraint:constraint-layout:+'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
compile project(path: ':engine-module')
}
Module: engine-module/build.gradle
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
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'])
compile 'com.android.support:support-annotations:25.0.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.robolectric:robolectric:3.1.2'
compile 'com.crashlytics.sdk.android:crashlytics:2.6.5'
}
SOLVED:
Project: build.gradle
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
classpath 'io.fabric.tools:gradle:1.+'
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
subprojects {
apply from: '../jacoco.gradle'
}
Module: engine-module/build.gradle
apply plugin: 'com.android.library'
apply plugin: 'io.fabric'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
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'])
compile 'com.android.support:support-annotations:25.0.0'
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.robolectric:robolectric:3.1.2'
compile('com.crashlytics.sdk.android:crashlytics:2.6.5#aar') {
transitive = true;
}
}
You did not define any repositories for the engine-module module, this means it cannot resolve the associated dependencies.
Generally people define repositories for their entire project by adding the following code to the root build.gradle
subprojects {
repositories {
// Add repositories here
}
}
This makes these repositories available for all subprojects.
I am following some instructions, and I get this error.
Error:Could not find com.google.gms:google-services:3.0.0. Searched in the following locations: file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom file:/Applications/Android Studio.app/Contents/gradle/m2repository/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar https://maven.fabric.io/public/com/google/gms/google-services/3.0.0/google-services-3.0.0.pom https://maven.fabric.io/public/com/google/gms/google-services/3.0.0/google-services-3.0.0.jar
Required by panic_android:app:unspecified
My gradle is:
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'com.google.gms.google-services'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.google.gms:google-services:3.0.0'
classpath 'io.fabric.tools:gradle:1.+'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.netvariant.panic"
minSdkVersion 15
multiDexEnabled true
targetSdkVersion 21
versionCode 2
versionName "1.1"
}
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.2.0'
compile 'com.android.support:design:23.2.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile('com.twitter.sdk.android:twitter:1.13.1#aar') {
transitive = true;
}
compile 'com.skyfishjy.ripplebackground:library:1.0.1'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.android.support:multidex:1.0.1'
}
You seem to be missing jCenter()
repositories {
jCenter()
maven { url 'https://maven.fabric.io/public' }
}
I am trying to add a PinnedSectionListView from android arsenal.
the way to add say:
Add the specific repository to your build file:
repositories {
maven {
url "https://jitpack.io"
}
}
Add the dependency in your build file (do not forget to specify the correct qualifier, usually 'aar'):
dependencies {
compile 'com.github.beworker:pinned-section-listview:v1.0'
}
so i did that (build.gradle (Project)):
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
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()
maven {
url "https://jitpack.io"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
build.gradle (Module): apply plugin: 'com.android.application'
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.jonathandg.listviewsections"
minSdkVersion 16
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.0'
compile 'com.beworker:pinned-section-listview:v1.0#aar'
//compile 'com.beworker:pinned-section-listview:v1.0'
}
then the android studio message is
Error:(25, 13) Failed to resolve: com.beworker:pinned-section-listview:v1.0
The repositoty is in: https://android-arsenal.com/details/1/264
Try below Gragle dependency line
compile 'com.github.beworker:pinned-section-listview:1.1'