Error:Execution failed for task ':app:javaPreCompileDebug' - java

android
{
compileSdkVersion 27
defaultConfig
{
applicationId "downloader.video.full.videodownloader"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.1"
useLibrary 'org.apache.http.legacy'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes
{
release
{
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-
rules.pro'
}
}
}
dependencies
{
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.2'
implementation 'com.io.tools.android.ramiloif.folderchooser:folderchooser-
dialog:1.0.6'
implementation 'com.google.android.gms:play-services-plus:10.0.1'
implementation 'com.google.android.gms:play-services-ads:10.0.1'
implementation 'com.android.support:design:27.1.1'
implementation files('libs/json-20140107.jar')
implementation 'com.squareup.okio:okio:1.14.1'
implementation 'com.squareup.picasso:picasso:2.71828'
compile 'com.google.android.gms:play-services-analytics:10.0.1'
}
I get this error when I build my code:
Error:Execution failed for task ':app:javaPreCompileDebug'.
> Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor. Please add them to the annotationProcessor configuration.
- lombok-1.16.14.jar (org.projectlombok:lombok:1.16.14)
Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior. Note that this option is deprecated and will be removed in the future.
See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.
This is my project 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:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}

It tells you what to do...
> Annotation processors must be explicitly declared now. The following dependencies on the compile classpath are found to contain annotation processor.
> Please add them to the annotationProcessor configuration.
- lombok-1.16.14.jar (org.projectlombok:lombok:1.16.14)
Like so
dependencies {
// Other dependencies
compileOnly "org.projectlombok:lombok:1.18.4"
annotationProcessor 'org.projectlombok:lombok:1.18.4'
}
[See Lombok documentation](https://projectlombok.org/setup/android)
Also, I suggest you delete `libs/json-20140107.jar` and replace it with
compile 'org.json:json:20140107'
Although, Android already has a JSON parser, so not clear why you need this at all

Just Add Following Lines into your Module:app gradle file
dependencies {
compileOnly "org.projectlombok:lombok:1.18.4"
annotationProcessor 'org.projectlombok:lombok:1.18.4'
}

Related

Android Studio Failed to resolve: com.android.support:appcompat-v7.28.0.0

I am getting this error, Failed to resolve: com.android.support:appcompat-v7.28.0.0 I have been looking on here and tried changing it to other variations of that line but so far no luck, why do I keep getting this error?
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 15
targetSdkVersion 28
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.28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-auth:11.6.0'
implementation 'com.google.firebase:firebase-core:16.0.3'
implementation 'com.google.firebase:firebase-database:16.0.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
apply plugin: 'com.google.gms.google-services'
The issue is with the appcompat-v7 dependency that you have added to the build.gradle.
Change implementation 'com.android.support:appcompat-v7.28.0.0' to implementation 'com.android.support:appcompat-v7:28.0.0'
Notice the : between appcompat-v7 and 28.0.0 that separates the artifact name and the version.
If we don't consider the typo in :
implementation 'com.android.support:appcompat-v7.28.0.0'
Change it to:
implementation 'com.android.support:appcompat-v7:28.0.0'
Then, you probably should use the latest version for the Firebase dependencies to avoid those Please fix the version errors:
implementation 'com.google.firebase:firebase-auth:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.4'
implementation 'com.google.firebase:firebase-database:16.0.3'
Then rebuild the project. Also, remember to use latest gradle to avoid couldn't found such dependency or etc.
Inside build.gradle of the project (inside your project root directory):
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// replace it with the 3.2.0 version
...
classpath 'com.google.gms:google-services:4.1.0' // update this too
}

Receive " Failed to resolve: support-core-utils " when I add Room Library to my project

I have an existing application that uses SQLiteOpenHelper for communicating between the database and app but I decided to migrate to Room. I try every way to add Room component but all of them return to me the same error I make a new project and implement that Room library and worked! but in this project that has SQLiteOpenHelper I gave error .when I add Room Library Code ,I receive this error:
Failed to resolve: support-core-utils
and my build.gradle(module) that I add Room components:
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.yasin.taksmssender"
minSdkVersion 15
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
// used by Room, to test migrations
javaCompileOptions {
annotationProcessorOptions {
arguments = ["room.schemaLocation":
"$projectDir/schemas".toString()]
}
}
sourceSets {
androidTest.assets.srcDirs +=
files("$projectDir/schemas".toString())
}
}
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:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
implementation 'com.android.support:support-v4:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.squareup.okhttp3:okhttp:3.7.0'
implementation 'com.github.pchmn:MaterialChipsInput:1.0.8'
implementation 'com.github.PhilJay:MPAndroidChart:v2.2.4'
implementation 'pub.devrel:easypermissions:1.1.3'
// Room components
implementation "android.arch.persistence.room:runtime:$rootProject.roomVersion"
annotationProcessor "android.arch.persistence.room:compiler:$rootProject.roomVersion"
androidTestImplementation "android.arch.persistence.room:testing:$rootProject.roomVersion"
}
and build.gradle(project):
// 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:3.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
roomVersion = '1.1.1'
archLifecycleVersion = '1.1.1'
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Reason probably is that Room does not yet support support-core-utils 27.1.1, but 26.1.0.
https://mvnrepository.com/artifact/android.arch.persistence.room/runtime/1.1.1
solved this issue by changing
implementation ('android.arch.persistence.room:runtime:$rootProject.roomVersion',{
exclude group: 'com.android.support', module: 'support-core-utils'
})

Gradle sync failed: All firebase libraries must be either above or below 14.0.0

I've been going at this for a while now, and it's driving me insane. I've looked through a few existing Stack Overflow questions, but nothing has worked. I keep getting this error whenever I add the last line, which I need for my AdMob ad units. People seem to solve this issue by changing the version number for this line to 15.0.0, but, as you can see, I've already done this. Please help, if you can. Also, this isn't even the first time I've worked with ad units.
Build.gradle (App level)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "com.coincalc.anduril.sharetale"
minSdkVersion 17
targetSdkVersion 26
versionCode 2
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
lintOptions {
abortOnError false
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support:support-vector-drawable:26.1.0'
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
implementation 'com.android.support:support-v4:26.1.0'
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.google.firebase:firebase-core:12.0.1'
implementation 'com.google.android.gms:play-services-ads:15.0.0'
}
apply plugin: 'com.google.gms.google-services'
Build.gradle (Project level)
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com"
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Update the following classpath dependency in your top-level build.gradle:
classpath 'com.google.gms:google-services:4.0.1'
Only newer versions of this plugin understand that the new Firebase dependencies no longer all have to be at the same version.
Read this for more information.
Upgrade your firebase dependencies to latest version, by changing your dependencies to this:
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com. google.firebase:firebase-core:16.0.1'
And in your project level Gradle file, increment your Google services plugin to 4.0.0
Change this:
implementation 'com.google.firebase:firebase-database:12.0.1'
implementation 'com.google.firebase:firebase-auth:12.0.1'
compile 'com.google.firebase:firebase-core:12.0.1'
into this:
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.2'
implementation 'com.google.firebase:firebase-core:16.0.1'
Check this for more info:
https://firebase.google.com/support/release-notes/android

java.lang.NoSuchMethodError: No static method zzb(ZLjava/lang/Object;)V in class Lcom/google/android/gms/common/internal/zzaa; or its super classes

I've looked at Firebase documentation, then searched all github issues and also all stack overflow posts but still I'm getting this error again and again. I've been stuck for hours, please have a look. It says-
java.lang.NoSuchMethodError: No static method zzb(ZLjava/lang/Object;)V in class Lcom/google/android/gms/common/internal/zzaa; or its super classes (declaration of 'com.google.android.gms.common.internal.zzaa' appears in /data/app/com.masquerade.priyanshu.topcoder-2/split_lib_dependencies_apk.apk)
According to other stack overflow posts when i try to change firebase core and database version, i get another bunch of errors saying incompatible version.
This is build.gradle( Module: app)
apply plugin: 'com.android.application'
repositories {
mavenLocal()
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.masquerade.priyanshu.topcoder"
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'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design: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.google.firebase:firebase-core:11.6.0'
compile 'com.android.support:design:26.1.0'
compile 'com.google.firebase:firebase-database:11.6.0'
compile 'com.firebaseui:firebase-ui-storage:1.0.0'
// Displaying images
compile 'com.github.bumptech.glide:glide:3.6.1'
compile 'com.android.support:cardview-v7:21.+'
}
apply plugin: 'com.google.gms.google-services'
This is build.gradle( Project:app ) -
// 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:3.0.0'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenLocal()
maven {
url 'https://maven.fabric.io/public'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
EDIT -
Also I'm getting this warning on compile 'com.google.firebase:firebase-core:11.6.0'
The warning is -
All gms/firebase libraries must use the exact same version specification (mixing versions can lead to runtime crashes). Found versions 11.6.0, 11.4.2. Examples include com.google.android.gms:play-services-basement:11.6.0 and com.google.firebase:firebase-storage:11.4.
To solve this, please the change the following line of code from your build.gradle( Project:app ) file:
url 'https://maven.fabric.io/public'
with
url "https://maven.google.com" // Google's Maven repository
Change also this line of code:
compile 'com.firebaseui:firebase-ui-storage:1.0.0'
with
compile 'com.firebaseui:firebase-ui-storage:3.1.0'
Change also this lines of code:
compile 'com.google.firebase:firebase-core:11.6.0'
compile 'com.google.firebase:firebase-database:11.6.0'
with
compile 'com.google.firebase:firebase-core:11.4.2'
compile 'com.google.firebase:firebase-database:11.4.2'
Because Firebase/Play Services Version 11.4.2works with FirebaseUI Version 3.1.0 as seen here.
Also set multiDexEnabled to true in default config.

Getting error "package lombok doesn't exist" with Android Studio 3 RC2

I am getting the following error when trying to compile the project:
error: package lombok does not exist
And others stating that all the annotations from it can't be found.
I don't see errors in code before compiling and I didn't have this error while I was using Android Studio 3 RC1.
Here are my gradle scripts:
Project level:
// 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:3.0.0-rc2'
// 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
}
App module level:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
applicationId "com.mk.forum"
minSdkVersion 25
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
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 project (':util')
compile project (':forum_core')
compileOnly 'org.projectlombok:lombok:1.16.18'
annotationProcessor 'org.projectlombok:lombok:1.16.18'
compile group: 'com.github.javafaker', name: 'javafaker', version: '0.13'
}
I've got modules too, but I think it isn't important.
I hope it is because of compileOnly annotation. Here is the doc:
blog.gradle.org/introducing-compile-only-dependencies
Dependencies required at compile time but never required at runtime, such as source-only annotations or annotation processors;
Dependencies required at compile time but required at runtime only when using certain features, a.k.a. optional dependencies;
Dependencies whose API is required at compile time but whose implementation is to be provided by a consuming library, application
or runtime environment.
It might be related to jdk9. I know that the combination of IntelliJ, lombok 1.16.18 and jdk9 currently doesn't work. But that does not explain your error message. We expect that we can release 1.16.20 within a few days (maybe tonight) that addresses this problem.
Disclosure: I am a lombok developer.

Categories