I am completely new to android and kotlin programming. I just started learning android since yesterday. I have successfully created a project but it doesn't show me xml editor.
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
build.gradle
buildscript {
ext.kotlin_version = '1.1.51'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any idea to solve this problem
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.1.0'
}
}
Add the above line in your app.gradle file before dependencies block & replace compile to implementation.
In Android Studio , click on Terminal and execute this command.
gradlew app:dependencies
and then search for com.android.support:support-annotations.
Then in your app level gradle file , exculude the com.android.support:support-annotations dependency from the dependency which has the older version i.e 26.1.0. To learn how to exuclude go here.
Related
I am having a strange issue. I am adding this library for Business Hour Picking.
https://github.com/bashizip/business-hours-picker
But strangely the older versions are added with no issues. But when I add the latest one it is not resolving by gradle.
I have tried:
Clean Project
Rebuilt It
Invalidate Cache & Restart
But i can't add the library.
I have also posted the issue on the github issues section.
Here is my Project Level Gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
// Android Navigation Safe Args Classpath
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Please try the newest version of the library (1.1.1):
implementation 'com.github.bashizip:business-hours-picker:1.1.1'
It has many improvements, bug fixes and Gradle dependencies have been upgraded.
PS: I'm the author of the lib.
I reinstalled my android studio and thereafter i am getting error while building gradle.
I did every change that can help in building gradle but then also it showed error as "configure build" error.
so kindly help me so that i can start my android programming.
gradle version - 4.4
android plugin version - 3.1.3`
i have changed google() to maven() but nothing happened.
//build.gradle file
// Top-level build file where you can add configuration options common to all
sub-projects/modules.
buildscript {
repositories {
google()
jcenter { url 'http://jcenter.bintray.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I just updated gradle for my android project from 2.3.3 to 3.1.3 and now it seems that my project can now longer import dependencies that come from an external source like de.hdodenhof:circleimageview and id.zelory:compressor. Only dependencies that start with 'com' or 'java' work.
I already tried to clean/rebuild the project and check invalidate chaches/restart.
Sidenote: I also upgraded my other packages to their latest versions, but I think it is a gradle problem.
Another Sidenote: the missing dependencies can also not be found in the external libraries.
Project gradle:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.google.gms:google-services:4.0.1'
}
}
allprojects {
repositories {
maven { url "https://maven.google.com" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module gradle (picture of the changes because the gradle file does not paste well in stack overflow code sample):
After updating to Android Studio 2.3 trying to build the project causes a build failure.
Execution failed for task ':app:greendao'.
org.eclipse.jdt.internal.compiler.impl.CompilerOptions.versionToJdkLevel(Ljava/lang/Object;)J
How to solve this issue?
The solution is to move
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0'
form app/build.gradle into top level build.gradle file.
Example:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.0'
}
}
My project at run time, there was a gradle version of the error, I tried a lot of ways are not resolved, we have not encountered a similar error, the following is the error log.
Error:(1, 0) Gradle DSL method not found: 'apply()' Possible
causes:The project 'xindatx1.6.0' may be using a version of the
Android Gradle plug-in that does not contain the method (e.g.
'testCompile' was added in 1.1.0). Fix plugin version and sync
projectThe project 'xindatx1.6.0' may be using a version of Gradle
that does not contain the method. Open Gradle wrapper fileThe build
file may be missing a Gradle plugin. Apply Gradle plugin
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven {
url "https://maven.google.com"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
classpath 'com.novoda:bintray-release:0.8.1'
classpath 'org.greenrobot:greendao-gradle-plugin:3.2.2' // add plugin
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url "https://jitpack.io" }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}