lombok fails when compile with Gradle 4.5 in Android Studio 3.1.2 - android-studio

I want to use lombok in my Android Studio project.
My current build.gradle project file looks like this:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app build.gradle file looks like this:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "app.getter.android"
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'
}
customDebugType {
debuggable true
}
}
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.16.20'
annotationProcessor 'org.projectlombok:lombok:1.16.20'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design: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'
}
I've already installed Lombok Plugin in my Android Studio 3.1.2 and all seems correct. All the lombok tools are available tu use it. The content assist shows all lombok dependencies and there isn't compilation errors in my workspace. However when I try to run a test, Gradle compiles my code and it can't find the lombok generated code like getters/setters or val variables are not transformed to my Java type so it seems that annotationProcessor is not invoked before the compilation or the generated code by the annotationProcessor isn't in the classpath when gradle makes the compilation.
I've tried to use gradle-lombok-plugin but nothing works for me. What I'm doing wrong?

Related

Android Studio GridLayout not working. Shows completely grey into Design View

I hope someone can help me with this :S
I am working on Android Studio 3.6.2 and Gradle version is 5.6.4.
I just tried to drag and drop a GridLayout into a ConstraintLayout. But for some reason the GridLayout shows completely grey.
I read in my research that could be something related with the Gradle files. I read I need:
1) implementation 'androidx.gridlayout:gridlayout:1.0.0'
2)
repositories {
google()
}
I have these two included in my Gradle files. So, am I missing something somewhere?
I upload a reference image and some code. Thanks in advance ;)
Design View
build.gradle (Project: AndroidSample)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
defaultConfig {
applicationId "com.aretius.androidsample"
minSdkVersion 26
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.core:core-ktx:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
}
build.gradle (Module: app)
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.2'
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
}
Well, I finally solved my problem reinstalling Android Studio with the latest version of it :)

failed linking references - android studio

I'm getting the following error in my android studio project build
failed linking references,
error: resource id/edit_query (aka package:id/edit_query) not found.Message{kind=ERROR, text=error: resource id/edit_query (aka
package:id/edit_query) not found.,
sources=[C:\gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\3482cd36ff1fc3489bd4ff1aeced93ab\res\values\values.xml:2689:5-2691:13],
original message=, tool name=Optional.of(AAPT)}
my project build.gradle file:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.3'
classpath 'com.google.gms:google-services:4.0.1'
// 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
}
my module build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.weprcl.lathikashetty.weparcel"
minSdkVersion 16
targetSdkVersion 28
vectorDrawables.useSupportLibrary = true
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.crashlytics.sdk.android:crashlytics:2.9.7'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.google.android.gms:play-services-ads:17.1.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'org.parceler:parceler-api:1.1.11'
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.lifecycle:extensions:1.1.1"
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
annotationProcessor 'org.parceler:parceler:1.1.11'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:preference-v7:28.0.0'
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'
}
I tried every answer in the same issue questions but without benefit so any help will be appreciated
Thanks in advance
**

Android studio APK buil error transformClassesWithJarMergingForDebug

I'm trying to build APK, but there is an error when I try to make it.
Error:Execution failed for task ':app:transformClassesWithJarMergingForDebug'.
com.android.build.api.transform.TransformException: java.util.zip.ZipException: duplicate entry: com/google/android/gms/gcm/PendingCallback.class
Following is my build.gradle(Module:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "jordan.personicle"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile files('libs/ajt-2.9.jar', 'libs/javaml-0.1.7.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:design:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.google.android.gms:play-services:11.0.1'
compile 'com.google.firebase:firebase-database:10.2.1'
compile 'com.google.firebase:firebase-core:10.0.1'
compile 'com.google.firebase:firebase-messaging:10.0.1'
compile 'com.firebase:firebase-jobdispatcher:0.6.0'
compile 'org.jsoup:jsoup:1.7.3'
compile 'com.android.support:multidex:1.0.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
This is my build.gradle (Project)
// 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:2.3.3'
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 there is no duplication for gcm. What is the problem?
Thanks,
Make sure you use the same version in all your google play services libs:
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.google.firebase:firebase-database:11.0.4'
compile 'com.google.firebase:firebase-core:11.0.4'
compile 'com.google.firebase:firebase-messaging:11.0.4'
See https://stackoverflow.com/a/42610163/1370087

Showing error fix plugin version and sync projects in android studio

i am new in Android Studioand when i create a new project suddenly i just got an error message i.e, Error:(1, 0) Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to "9ba5989c7b283b0ec145cc20641f7155619d6148"
Here is my build.gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "************"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
}
My build.gradle(project)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha2'
// 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 have updated my Android studio 2.0 but it always showing Fix plugin version and sync project when open create a project.please anyone can tell me what i should do to rectify this problem.
Thanks in advance...
classpath 'com.android.tools.build:gradle:2.0.0-alpha2' instead of this use
classpath 'com.android.tools.build:gradle:2.2.+' this fixed the same error for me!

I can not add a dependency in Android Studio

I'm new in Android Studio and i want to add dependency to custom view (https://github.com/glomadrian/dashed-circular-progress) in my project. I downloaded *.arr file from Maven repository and imported it like a AAR module. But i can't compile my project because there are some exceptions with this custom view: ClassNotFoundException. Could someone explain me step by step how to correctly add dependencies from maven rep? or there are some problems with this DashedCircularProgress.aar? Thanks.
build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.ahryk94gmail.mibandsdk"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/gson-2.6.2.jar')
compile 'com.github.glomadrian:DashedCircularProgress:1.0#aar'
}
As mentioned in the project description you have to add the following code to build.gradle:
repositories {
maven {
url "http://dl.bintray.com/glomadrian/maven"
}
}
dependencies {
compile 'com.github.glomadrian:DashedCircularProgress:1.0#aar'
}
UPDATE:
Also you can use jitpack.io and download the dependency right from GitHub.
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.glomadrian:dashed-circular-progress:59d245a'
}

Resources