How include androidplot module in project - android

I am trying to implement the andoridplot library in my app. I have download sample code from the github.sample is working fine. But if I am trying to import androidplot-core as a module in my project, I get this error:
Plugin with id 'com.github.dcendents.android-maven' not found.
Please suggest the appropriate answer.

Most likely you need to add the following to your buildscript section of your gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
Just a note: The preferred way to include Androidplot is as a normal compile dependency in gradle, not as a module.

Related

Cannot add Google Play Location Service as dependency to my Android Project

I tried to add the Google location Service to my Android Project by referencing the official link.
As the tutorial said I added the following line to the dependencies section in the Project Gradle file.
implementation "com.google.android.gms:play-services-location:11.8.0"
But when i resynced the project i got the following error
Error:(19, 0) Could not find method implementation() for arguments [com.google.android.gms:play-services-location:11.8.0] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
I am using Android Studio 3.0.1 and Gradle Version 4.1.
How to overcome this error?
please try this
Add in Build.gradel at app lavel
dependencies {
Implementation 'com.google.android.gms:play-services:9.6.0'
}
apply plugin: 'com.google.gms.google-services
// 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:3.0.0'
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()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I think you have forgot to add maven repository in your app gradle file. Try by doing these steps. Open the build.gradle file for your application. Make sure that the repositories section includes a maven section with the "https://maven.google.com" endpoint. For example: allprojects {repositories {jcenter()maven {url "https://maven.google.com"}}}
Avoid using + in your dependencies as it android studio will try to update dependencies every 24 hours. Also replace compile by implementation for low APK size.
Edit 1:
As you told maven repository did not worked.
Check your project settings by going to Android Studio.
Click on file
click on project structure
There will option of Project in sidebar. Tap on it.
Check for the gradle and andrpid plugin version.
Put these values
Gradle Version - 4.1
Android plugin version - 3.0.1
Android Plugin Repository - jcenter,google()
Default Library Repository - jcenter, 'https://maven.google.com'
Reply me if it works

Error:Plugin with id 'com.github.dcendents.android-maven' not found

I'm using this library in my Android app. (https://github.com/yazeed44/MultiImagePicker)
Before now, I was adding it to my project this way:
compile 'net.yazeed44.imagepicker:imagepicker:1.3.0'
The problem with importing it that way is, as far as I know, that I can't override any code because I'll lose all the changes after building the project again. (I need to change some code)
For that reason, I have downloaded the source code and I've imported the project as a module with this name: 'imagepicker'
After that, I added this line to my app build.gradle:
compile project(':imagepicker')
and this to my settings.gradle (Android Studio did it)
include ':app', ':imagepicker'
After doing that, I try to run the project and Android studio shows this error:
Gradle 'Project' project refresh failed
Error:Plugin with id 'com.github.dcendents.android-maven' not found.
Since you are using the module locally you have to add in your top-level build.gradle or in the imagepicker/build.gradle same config added in the imagepicker build.gradle project.
buildscript {
repositories {
jcenter()
}
dependencies {
//ADD THESE DEPENDENCIES
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}
}
An alternative can be modify the imagepicker/build.gradle removing the last 2 lines. But you have to test this way.
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
If you check these files you will find the
apply plugin: 'com.github.dcendents.android-maven'
In your case you don't need these files because they are useful only to uplaod in a maven repo the aar file.
I added below code in Project:gradle.build file and its resolved the problem :
allprojects {
repositories {
jcenter()
maven {
url "https://repo.commonsware.com.s3.amazonaws.com"
}
}
}
EDIT
If you still facing after adding above maven dependencies
Change url "https://repo.commonsware.com.s3.amazonaws.com" to url "https://s3.amazonaws.com/repo.commonsware.com".

Failed to apply plugin Android Studio

I am trying to import ExoPlayer library into my Android Studio project. I have tryed few times with several methods ( importing direct with GRADLE ), import as module, copy paste it, I get the same error:
Error:(15) A problem occurred evaluating project ':..:ExoPlayer:library'.
> Failed to apply plugin [id 'bintray-release']
> Plugin with id 'bintray-release' not found.
In library gradle I found the apply plugin line:
apply plugin: 'bintray-release'
After Searching the library and apply it to dependencies I still got the error:
dependencies {
compile 'com.novoda:bintray-release:0.2.10'
}
Any Ideea how can I solve this problem ?
It looks like gradle could not find this plugin in all specified repositories. ExoPlayer specifies buildscript repositories in the root project, so that's what you should do too.
In your root build.gradle make sure buildscript section contains jcenter() repository and 'andcom.novoda:bintray-release:0.2.7' classpath:
buildscript {
repositories {
...... <- whatever you have now
jcenter() <- make sure this one is there
}
dependencies {
...... <- whaterver you have now
classpath 'com.novoda:bintray-release:0.2.7' <- make sure this one is there
}
}

Gradle syncing keeps failing

I'm trying to include Android Asynchronous Http Client and Picasso into my Android project using Gradle. Here's my build.gradle file.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
allprojects {
repositories {
mavenCentral()
}
dependencies {
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.squareup.picasso:picasso:2.1.1'
}
}
When I try to sync it, I keep getting the following error.
No signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.compile() is applicable for argument types: (java.lang.String) values: [com.loopj.android:android-async-http:1.4.4]
Possible solutions: module(java.lang.Object)
I'm very new to Android so I'm clueless on how to correct this. Can anyone please help me out? I'm using Android Studio version 0.5.8 by the way.
Thank you.
Don't include dependencies in your top-level build file. Include them in module-level build files instead. If you use the Project Structure UI instead of modifying build files directly, it will set things up properly.

Missing main module in Android studio

I am trying to migrate my android app from eclipse to Android studio. (0.5.4)
The project has several dependencies. (Sherlock etc)
I exported the app to Gradle and imported it in Android studio and managed to get the project to build successfully.
It appears however that only the dependencies are built.
Adding erronous lines in the app code does not trigger compile errors.
When I view project | packages, the package for my app does not show, Only the external libraries are shown.
My root level build.gradle only contains repositories and dependencies:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
}
I tried manually adding an android section with the intent to make gradle look at the source files but I had problems adding the section:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
}
android {
compileSdkVersion 17
buildToolsVersion "19.0.2"
}
As i now get the following error
Could not find method android() for arguments xxx on root project 'zzz'.
If proceeded to add
apply plugin: 'android'
Just before the android section, but now I get
A problem occurred evaluating root project 'zzz'.
Plugin with id 'android' not found.
Can anyone shed some light as to why i cannot have an Android section at the root level.
If the problem lies somewhere else any help would also be much appreciated.
In case it is needed, here is my settings.gradle
include ':external:PullToRefresh:SmoothProgressBarLib'
include ':external:ActionBarSherlock'
include ':'
include ':external:pulltorefresh-abs'
include ':external:MyAwesomeLibrary'
include ':external:PullToRefresh:pulltorefresh'
include ':external:SherlockNavigationDrawer'
include ':external:sdk:MyAwesomeSDK'
You've included an android block inside a buildscript block in your top-level build file, but this is incorrect. Instead it should be structured like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.2'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion 17
buildToolsVersion "19.0.2"
}
dependencies {
//Your app dependencies go here
}
All this is assuming that you truly have an Android application module at your project root (meaning that at your project root directory there's a src directory that has Android sources in it). It seems to be that you're trying to set it up this way because you also have this in your settings.gradle file:
include ':'
If that's the case, then rearranging your top-level build file as indicated above should fix it.
If you don't have a module at the project root, then you should restore the top-level build file to its original condition (take out apply plugin and android), take out that include ':' line from settings.gradle, and add an include statement that points to your application module.
In your settings.gradle file, I don't see where you included your main module. You should add:
include ':mainmodule-directory'
Your project should, ideally, have two build.gradle files. One at the root level, one at the module level. In your main module, you specify that the module is an Android module by adding apply plugin: android in the module's build.gradle file. Then you specify that the entire project would need the Android plugin by using the following in the root build.gradle file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.5.+'
}
}

Categories

Resources