Android Studio Compile Issue with plugin - android

Folks,
I am trying to use
com.github.ksoichiro:android-observablescrollview:1.5.1
and I had several problems which prompted me to add:
apply plugin: 'com.android.application'
repositories {
mavenCentral()
}
to my Project's build.gradle file, now when I try to sync my project I get the following message:
Error:Cause: java.io.FileNotFoundException: D:\Backup 2015\Development\AndroidStudioProjects\IKAG\src\main\AndroidManifest.xml (The system cannot find the path specified)
This is my whole build.gradle file:
buildscript {
repositories {
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
}
}
apply plugin: 'com.android.application'
//
repositories {
mavenCentral()
}
android {
compileSdkVersion 20
buildToolsVersion '21.1.2'
}
dependencies {
// Other dependencies are omitted
compile 'com.github.ksoichiro:android-observablescrollview:1.5.1'
}
allprojects {
repositories {
jcenter()
}
}

Related

ERROR: Could not find com.android.tools.build:gradle:3.1.4.Required by: com.jakewharton:butterknife-gradle-plugin:10.1.0

While integrating WorkManager in my Application, I updated my app settings as follows:
androidMinSdkVersion = 15
androidTargetSdkVersion = 28
androidCompileSdkVersion = 28
androidBuildToolsVersion = "28.0.0"
Due to version upgrade to 28 I had to update gradle too.
gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
Project.gradle
buildscript {
repositories {
// Gradle 4.1 and higher include support for Google's Maven repo using
// the google() method. And you need to include this repo to download
// Android Gradle plugin 3.0.0 or higher.
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.3.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "http://dl.bintray.com/populov/maven" }
maven { url "https://jitpack.io" }
maven { url "https://maven.google.com" }
mavenCentral()
jcenter()
gradlePluginPortal()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Due to all these changes(mainly WorkManger), I had to (was forced to) upgrade the butterknife library version to 9.0.0 at least.
So I updated it as follows in my app.gradle file
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0'
}
}
But whenever I try to clean-build I keep getting following error in logcat.
ERROR: Could not find com.android.tools.build:gradle:3.1.4.
Searched in the following locations:
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.pom
- https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/3.1.4/gradle-3.1.4.jar
Required by:
project :_btn_payment > com.jakewharton:butterknife-gradle-plugin:10.1.0
Any help is appreciated.
You should move your classpath 'com.jakewharton:butterknife-gradle-plugin:10.1.0' to Project.gradle
butterknife 10.x only supports AndroidX-enabled builds.
You will changed to version 9.0.0
From gradle gradle plugin 3.0 apt has deprecated,delete classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
library build.gradle
apply plugin: 'com.android.library'
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.jakewharton.butterknife'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
classpath 'com.jakewharton:butterknife-gradle-plugin:9.0.0'
}
}

android method not found in gradle

I have and android project named global flow and I after opening with android studio 2.2.3 on a debian linux I watch this error:
Error:(22, 0) Could not find method android() for arguments [build_5ijv6qsqmd3lnd1fe6nzaworu$_run_closure3#1c8251f] on root project 'GlobalFlow' of type org.gradle.api.Project.
Open File
When I try the solution in this forum could not find method android I don't know where to find all the android modules.
I update the build.gradle file in home/alex/GlobalFlow but I am not sure if is this one or the other one in home/alex/GlobalFlow/app. But I understand that the root project's build gradle is in the first path named.
My build.gradel is:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// 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
}
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
dependencies {
compile files('app/libs/junit-4-12-JavaDoc.jar')
}
apply plugin: 'maven'
Where are all android modules?
Thanks.
This is the project/build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
It contains build script instructions. And optionally closures applied to all modules.
The following line allows you to apply com.android.application plugin:
classpath 'com.android.tools.build:gradle:2.2.3'
Also read the NOTE carefully.
This is the project/module/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
dependencies {
// We're in GlobalFlow/app now, adjust the relative path!
compile files('libs/junit-4-12-JavaDoc.jar')
}
apply plugin: 'maven'
When you apply plugin: 'com.android.application' you can use the android { ... } closure to setup Android app build process. Notice they're both in the module build.gradle.
If you were building an Adnroid library you'd apply plugin: 'com.android.library' which also provides you with android { ... } closure.
This is the recommended and default structure as of January 2017.
You can't use the android block in the top level file.
You have to add it in the home/alex/GlobalFlow/app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
dependencies {
//.....
}

gradle where exactly to put "apply plugin"?

i'm trying to add Google analytics inside of the my app using this tutorial:
https://developers.google.com/analytics/devguides/collection/android/v4/
But i stucked on the problem, where to exactly put the line:
apply plugin: 'com.google.gms.google-services'
So my build.gradle top level file is looking like this:
// 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'
classpath 'com.google.gms:google-services:1.3.0-beta1'
apply plugin: 'com.google.gms.google-services'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
But this is wrong. Where to put apply plugin exactly please?
Thanks for any help.
In andriod studio you have this kind of structure:
root
build.gradle
app
build.gradle
In the top-level build.gradle you have:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
classpath 'com.google.gms:google-services:1.3.0-beta1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
In your app/build.gradle
apply plugin: 'com.google.gms.google-services'
//...
dependencies{
//.....
compile 'com.google.android.gms:play-services-analytics:7.3.0'
}
Should be inside of the object
allprojects
on top of the app build.grade
like this:
apply plugin: 'com.android.application'
apply plugin: 'com.android.databinding'

Appdynamics implementation

I'm trying to add Appdynamics into my application, I'm doing those steps: https://docs.appdynamics.com/display/PRO40/Instrument+an+Android+Application#InstrumentanAndroidApplication-ToaddtheAppDynamicsAndroidagentrepositorytoyourproject but after all I have error:
Error:(15, 13) Failed to resolve: com.appdynamics:appdynamics-runtime:1.0
This is how my build.gradle (for all project) looks like:
buildscript {
configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
repositories {
maven { url uri("adeum-maven-repo") }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3', 'com.appdynamics:appdynamics-gradle-plugin:2.0'
}
}
allprojects {
repositories {
mavenCentral()
}
}
and build.gradle (from app module):
apply plugin: 'adeum'
repositories {
flatDir {
dirs 'lib'
}
maven {
url uri('adeum-maven-repo')
}
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:1.0'
and adeum-maven-repo paste into project. Any idea what am I doing wrong?
That error means that gradle is unable to resolve the dependency on com.appdynamics:appdynamics-runtime. The easiest way to fix this problem is to use the AppDynamics libraries from maven central rather than the adeum-maven-repo directory. You can do that by editing your top level gradle file to look like this:
buildscript {
configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.2.3'
classpath 'com.appdynamics:appdynamics-gradle-plugin:4.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
Then your project-level gradle file would look like:
apply plugin: 'adeum'
repositories {
flatDir {
dirs 'lib'
}
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:4.+'
}
Note that I have removed the references to adeum-maven-repo, and changed the version numbers on the AppDynamics artifacts to refer to them as they exist in maven central. Once you've done this, you no longer need adeum-maven-repo in your project, since gradle is now downloading these dependencies automatically.

How you build a project using gradle?

My build.gradle is given below.i have found this error.
Error:(15) A problem occurred evaluating root project 'smartwisher'.
> Could not find method android() for arguments [build_3rvo44ss7197kfip29gkh81rb6$_run_closure2#1d7a1869] on root project 'smartwisher'.
This is build.gradle which i have in my android studio.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
android {
compileSdkVersion 19
buildToolsVersion '20.0.0'
defaultConfig {}
productFlavors {
}
}
dependencies {
}
You can't use the top level build.gradle to specify android configuration.
You have to move the android block in your module/build.gradle file.
Your folders.
root
module
build.gradle
build.gradle
settings.gradle
In your top-level file:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.12.+'
}
}
allprojects {
repositories {
mavenCentral()
}
}
In your module/build.gradle:
apply plugin: 'android'
android {
}
dependencies {
}
Your file is not easy to read here, you should put it in a code block.
For what I saw you are missing at least one line :
apply plugin: 'android'
You need to specify pluging applying in build.gradle:
apply plugin: 'android'

Categories

Resources