I am trying to add a styled progress bar from https://android-arsenal.com/details/1/1375
There it says:
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.akexorcist:Android-RoundCornerProgressBar:1.0.0'
}
Well I did that...
build.gradle (Project)
buildscript {
repositories {
jcenter()
maven {
url "https://jitpack.io"
}
}
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()
}
}
build.gradle (Module):
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.chaz.simsirl"
minSdkVersion 15
targetSdkVersion 21
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:21.0.3'
compile 'com.github.akexorcist:Android-RoundCornerProgressBar:1.0.0'
}
Then in messages it says:
Error:A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:_debugCompile'.
Could not find com.akexorcist:Android-RoundCornerProgressBar:1.0.0.
Searched in the following locations:
https://jcenter.bintray.com/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom
https://jcenter.bintray.com/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/android/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/android/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/google/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.pom
file:/C:/Users/pc/AppData/Local/Android/sdk/extras/google/m2repository/com/akexorcist/Android-RoundCornerProgressBar/1.0.0/Android-RoundCornerProgressBar-1.0.0.jar
Required by:
SimsIRL:app:unspecified
You would need to add the jitpack repository in a different place:
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
Then it works
In your first snippet it was added under buildscript and it should be removed from there.
Try to replace your dependency with this:
compile 'com.akexorcist:RoundCornerProgressBar:1.0.0'
This package is available in jCenter.
Then you can remove this:
maven {
url "https://jitpack.io"
}
Reference: https://github.com/akexorcist/Android-RoundCornerProgressBar#download
Related
I am implementing FCM into my android project using Cordova
When I build my project I am getting error "Could not find method implementation() for arguments [com.google.firebase:firebase-core:16.0.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
"
Here is my build.gradle file code inside app directory
apply plugin: 'com.android.application'
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://maven.google.com"
}
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
implementation 'com.google.firebase:firebase-core:16.0.0' // Error generating line
}
}
You should write your repositories and dependencies in sequence manner which is suggested by Firebase.
Your build.gradle of project lavel should look like this, path of the file is just inside the project.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven {
url 'Fabric URL'
}
}
dependencies {
classpath 'com.google.gms:google-services:3.3.1'
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "JIT PACK URL"
}
maven {
url 'MAVEN URL'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And after that your app level build.gradle should look like this, path of the file is inside the app. C:\Users\ABC\DEF\Project Name\app\build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
flavorDimensions "versionCode"
defaultConfig {
applicationId "App Package Name as "com.companyName.appName""
minSdkVersion 19
targetSdkVersion 27
multiDexEnabled true
versionCode 15
versionName "1.0.12"
}
buildTypes {
release {
minifyEnabled false
debuggable false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
// firebase push notifications
implementation 'com.google.firebase:firebase-messaging:15.0.2'
implementation 'com.google.firebase:firebase-core:15.0.2'
implementation 'com.firebase:firebase-jobdispatcher-with-gcm-dep:0.5.2'
// firebase remote config
implementation 'com.google.firebase:firebase-config:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
If this not help for you you then try to change all the version of firebase and firebase remote config to latest version.
Because sometimes different version may cause problem.
This question already has answers here:
Error:(6, 0) Gradle DSL method not found: 'google()'
(11 answers)
Closed 5 years ago.
I'm trying to add an external library to my existing project. I created a libs folder and added my MaterialDrawer library in the root directory. Here is my settings.gradle file:
include ':app'
include 'libs:MaterialDrawer'
But gradle sync is failed and getting following error:
Error:Gradle DSL method not found: 'google()'
I couldn't find any solution in SO regarding my problem. Anyone would be kind enough to help?
Here is the build.gradle (Project):
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://maven.google.com" }
}
}
Here is the build.gradle (app):
android {
compileSdkVersion 25
buildToolsVersion '25.0.0'
defaultConfig {
applicationId "com.myapp"
minSdkVersion 15
targetSdkVersion 25
versionCode 38
versionName "2.1.8"
generatedDensities = []
}
dexOptions {
javaMaxHeapSize "4g"
}
aaptOptions {
additionalParameters "--no-version-vectors"
}
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
tasks.whenTaskAdded { task ->
if (task.name.equals("lint")) {
task.enabled = false
}
}
repositories {
mavenCentral()
maven { url "https://jitpack.io"}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(":libs:MaterialDrawer")
}
apply plugin: 'com.google.gms.google-services'
Method google() was added in Gradle 4.0
You should use maven { url 'https://maven.google.com' } on old versions
Also remove repositories section from your app build.gradle (you may merge it with root build.gradle)
Read how to add library to build.gradle here
compile('com.mikepenz:materialdrawer:5.9.5#aar') {
transitive = true
}
I researched similar questions but none of the answers solved my problem. When I try to build the starter code for a coding assignment I get the following error:
Error: Cause: Peer not authenticated
My gradle files are the following:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.2'
classpath 'com.google.gms:google-services:1.4.0-beta3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.sam_chordas.stockhawk"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven { url "https://jitpack.io" }
}
dependencies {
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.squareup.okhttp:okhttp:2.5.0'
apt 'net.simonvt.schematic:schematic-compiler:0.6.3'
compile 'net.simonvt.schematic:schematic:0.6.3'
compile 'com.melnykov:floatingactionbutton:1.2.0'
compile 'com.android.support:design:23.1.1'
compile('com.github.afollestad.material-dialogs:core:0.8.5.7#aar') {
transitive = true
}
}
I didn't manage any of those files as I don't have gradle experience yet.
Could you help me to figure out what went wrong?
Thank you very much.
P.S.:
The log files give me this error:
2016-03-23 13:01:29,664 [3912009] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/home/madelenko/Desktop/Stock-Hawk master'
org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'https://services.gradle.org/distributions/gradle-2.4-all.zip'.
Followed by a gigantic traceback.
Android Studio is giving this error while compiling the project. I have searched and found that this may happen because of
android
Block in top of the build.gradle.But in my build.gradle it may be not the problem.
here is my gradle files.
build.gradle
// 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.1.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 19
}
dependencies {
}
app.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 20
buildToolsVersion "20.0.0"
defaultConfig {
applicationId "com.ptrprograms.chromecast"
minSdkVersion 14
targetSdkVersion 20
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:20.0.0'
compile 'com.android.support:mediarouter-v7:19.0.+'
compile 'com.google.android.gms:play-services:6.1.11'
}
You're using Gradle domain-specific language (DSL) defined in the Android plugin before applying that plugin.
Remove the
android {
compileSdkVersion 19
}
in your top-level build.gradle. You already have compileSdkVersion 20 in your app build.gradle file where it actually matters.
now its showing "Error:(16, 0) Gradle DSL method not found: 'runProguard()'
runProguard was renamed to minifyEnabled in the Android Gradle plugin some time ago. You should rename it in your build script as well.
Not Solved:
I'm using gradle-experimental for doing NDK stuff.
Error:(13, 0) Dexcount plugin requires the Android plugin to be configured
MY Top level build.gradle file:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle-experimental:0.4.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Using Android Studio 0.4.6
I've got the following gradle.build file:
apply plugin: 'android'
buildscript {
repositories {
mavenCentral()
mavenLocal()
}
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
defaultConfig {
minSdkVersion 14
targetSdkVersion 19
versionCode 1
versionName "1.0"
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile 'com.my.products.aproduct:aproduct.sdk.java:1.0.1-SNAPSHOT'
compile fileTree(dir: 'libs', include: ['*.jar'])
}
The jar is not found when building the project:
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.my.products.aproduct:aproduct.sdk.java:1.0.1-SNAPSHOT.
Required by:
sva.frontend.android.jpurse:app:unspecified
Although I can find the jar and pom file in my local repository (~/.m2) folder. I've checked the maven settings of android studio and they've added a local repository pointing to ~/.m2/repositories
I've also tried adding mavenLocal() and even a hardcoded path to the repository in my gradle file.
I have no clues anymore on what might be wrong ?
You are putting mavenLocal() in the wrong place.
buildscript {
repositories {
mavenCentral()
}
dependencies {
//use your version
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
mavenLocal()
}
Also I suggest you updating your AS version to the last release (0.5.7)