Can't import androidx.datastore.dataStore (trying to recreate Google Codelab Example) - kotlin

Problem:
I'm trying to recreate this codelab tutorial project https://developer.android.com/codelabs/android-proto-datastore, but Android Studio can't import androidx.datastore.dataStore
Steps:
create new Kotlin project with an empty Acivity
modify gradle file
Switch to Android Studio's Project view
create a folder named proto inside of app/src/main
create and modify file user_prefs.proto inside of app/src/main/proto
Build -> Clean Project -> rebuild project
Create a serializer class called UserPreferencesSerializer
Trying to add the following Code to the empty MainActivity.kt
private const val DATA_STORE_FILE_NAME = "user_prefs.pb"
private val Context.userPreferencesStore: DataStore
by dataStore(
fileName = DATA_STORE_FILE_NAME,
serializer = UserPreferencesSerializer )
After this step Android Studio marks dataStore and shows the warning "Unresolved reference: dataStore" I'm also unable to import androidx.datastore.dataStore, but I can't find a missing import in my gradle file. Please, can someone tell me how I can resolve this problem?
Code:
build.gradle
plugins {
id 'com.android.application'
id 'kotlin-android'
id "com.google.protobuf" version "0.8.12"
}
android {
compileSdkVersion 30
buildToolsVersion "30.0.2"
defaultConfig {
applicationId "com.example.test"
minSdkVersion 28
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation "androidx.datastore:datastore-core:1.0.0-alpha08"
implementation "com.google.protobuf:protobuf-javalite:3.11.0"
}
protobuf {
protoc {
artifact = "com.google.protobuf:protoc:3.10.0"
}
// Generates the java Protobuf-lite code for the Protobufs in this project. See
// https://github.com/google/protobuf-gradle-plugin#customizing-protobuf-compilation
// for more information.
generateProtoTasks {
all().each { task ->
task.builtins {
java {
option 'lite'
}
}
}
}
}
user_prefs.proto
syntax = "proto3";
option java_package = "com.example.test";
option java_multiple_files = true;
message UserPreferences {
// filter for showing / hiding completed tasks
bool show_completed = 1;
}
UserPreferencesSerializer
package com.example.test
import androidx.datastore.core.CorruptionException
import androidx.datastore.core.Serializer
import com.google.protobuf.InvalidProtocolBufferException
import java.io.InputStream
import java.io.OutputStream
object UserPreferencesSerializer : Serializer<UserPreferences> {
override val defaultValue: UserPreferences = UserPreferences.getDefaultInstance()
override suspend fun readFrom(input: InputStream): UserPreferences {
try {
return UserPreferences.parseFrom(input)
} catch (exception: InvalidProtocolBufferException) {
throw CorruptionException("Cannot read proto.", exception)
}
}
override suspend fun writeTo(t: UserPreferences, output: OutputStream) = t.writeTo(output)
}
MainActivity.kt
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.datastore.core.DataStore
private const val DATA_STORE_FILE_NAME = "user_prefs.pb"
private val Context.userPreferencesStore: DataStore<UserPreferences> by dataStore(
fileName = DATA_STORE_FILE_NAME,
serializer = UserPreferencesSerializer
)
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}

I also had this problem while working on a project.
I found that I was using datastore-core and needed datastore-preferences. So I changed my dependency declaration from:
implementation 'androidx.datastore:datastore-core:1.0.0-alpha08'
to:
implementation 'androidx.datastore:datastore-preferences:1.0.0'
Possibly there was a breaking change between alpha08 and the 1.0.0 release.

The dataStore delegate is part of the androidx.datastore:datastore library.
Add the dependency to your modudle's build.gradle file. Replace $dataStoreVersion with the version of data store which you use, e.g. 1.0.0:
implementation "androidx.datastore:datastore:$dataStoreVersion"
You can find the available versions here in Google's Maven repository.
After adding this dependency, you can use by dataStore by adding the following import to your class:
import androidx.datastore.dataStore

In Android documentation:
val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "settings")
This line should be at the top of your code.
See DataStore documenation

After a lot of searching, The problem is simple. Make sure Gradle is not in offline mode.
Also, ensure that you use this dependency.
implementation "androidx.datastore:datastore-preferences:$dataStoreVersion"

Related

I'm trying to get stock prices from Yahoo Finance API, getting an java.io.FileNotFoundException

I'm trying to get stock prices from Yahoo Finance,
but I'm getting an error. This was the code I wrote before, and it worked well before, but after a long time, it doesn't work, returning the following error code.
java.io.FileNotFoundException while trying to execute YahooFinance.get operation
I found a question similar to my problem, and I tried to update Java according to the comments to correct the Java version,but the problem was not resolved.
When I click the URL given with the error code, it seems to get the data from Yahoo Finance, but it doesn't work programmatically.
package com.jym.yftest
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import com.jym.yftest.databinding.ActivityMainBinding
import yahoofinance.YahooFinance
class MainActivity : AppCompatActivity() {
private val vBinding by lazy { ActivityMainBinding.inflate(layoutInflater)}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(vBinding.root)
vBinding.testBtn.setOnClickListener {
Thread(Runnable {
try{
val stock = YahooFinance.get("APL")
Log.d("test", stock.toString())
}catch(err:Exception){
Log.d("test", err.toString())
}
this#MainActivity.runOnUiThread(java.lang.Runnable {
})
}).start()
}
}
}
build.gradle(module)
plugins {
id 'com.android.application'
id 'kotlin-android'
}
android {
compileSdk 33
defaultConfig {
applicationId "com.jym.yftest"
minSdk 22
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8'
buildFeatures{
viewBinding true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}
build.gradle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

cannot find class symbol error in android studio

i am trying to reference a kotlin class in a fragment class in java and it results to error saying that it cannot find the symbol of the kotlin class.
fragment class
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootview = inflater.inflate(R.layout.fragment_flashcards, container, false);
go = (ImageButton) rootview.findViewById(R.id.goBtn);
//Instructions audio
instruct = (ImageButton) rootview.findViewById(R.id.soundBtn);
MediaPlayer.create(getActivity(), R.raw.instructions);
//Click go button to explore flashcards
go.setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View view) {
startActivity(new Intent(getActivity(), Flashcards1.class));
}
});
return rootview;
}
}
this is where the error is
startActivity(new Intent(getActivity(), Flashcards1.class));
build.gradle app
plugins {
id 'com.android.application'
id 'com.google.gms.google-services'
}
android {
compileSdk 33
defaultConfig {
applicationId "com.example.salitongue_updated"
minSdk 27
targetSdk 33
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
buildFeatures {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.firebase:firebase-database:20.0.5'
implementation 'com.google.firebase:firebase-firestore:24.2.2'
implementation 'com.google.firebase:firebase-auth:21.0.7'
implementation 'androidx.navigation:navigation-fragment:2.5.1'
implementation 'androidx.navigation:navigation-ui:2.5.1'
implementation "androidx.fragment:fragment-ktx:1.6.0-alpha02"
//testImplementation 'junit:junit:4.13.2'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
build.gradle
buildscript {
dependencies {
classpath 'com.google.gms:google-services:4.3.13'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
}
}// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I think your problem is that you don't have Kotlin set up for your app module. You have the plugin dependency added to your main build.gradle, but you're not applying the plugin in the app module build.gradle. You also don't have the kotlin-stdlib dependency added to that module. Have a look at the example setup here (you have to scroll down a bit to the code snippets).
I don't know a lot about Gradle and the ways to configure your build files, so it's possible you've got it set up a different way and it's fine - but you should be able to see Kotlin class files from Java without doing anything special:
Kotlin code can be easily called from Java. For example, instances of a Kotlin class can be seamlessly created and operated in Java methods.
So it seems like maybe it's just not set up, and that's why it's not working for you. If Kotlin's working in the IDE (like popping up in code completion) but not when you try to build it, that sounds like the IDE plugin is set up fine, but not the stuff in your project. I don't know for sure, but hopefully it'll help!

Parameter 0 of constructor in '' required a bean of type '' that could not be found

I am creating a spring boot application, and using doma for O/R mapper.
I could not start application because repositoryimpl can not find dao class , but i can see them in the build/classes . so build is successful but the application fail to start.
How can I fix it?
Package
Build class
dao class
package com.event.app.backend.infrastructure.dao
import com.event.app.backend.infrastructure.table.EventsTableRecord
import org.seasar.doma.Dao
import org.seasar.doma.Select
import org.seasar.doma.Update
import org.seasar.doma.boot.ConfigAutowireable
#ConfigAutowireable
#Dao
interface EventDao {
#Select
fun getEvents():List<EventsTableRecord>
#Select
fun getEventById(eventId:String):EventsTableRecord
#Update(sqlFile = true)
fun updateTicketCnt(eventId:String,bookTicketCnt:Int):Int
#Update(sqlFile = true)
fun subtractTicketCnt(eventId:String,subtractCount:Int):Int
}
impl class
#Repository
class EventRepositoryImpl(
private val eventDao: EventDao,
private val userDao: UserDao,
) : EventRepository {
/**
* get Events
*/
override fun getEvents(): List<Event> {
// return convertToEvent(eventDao.getEvents())
return listOf(Event(
name = "event1",
description = "description1",
date = LocalDate.now(),
availableTickets = 1
))
}
-omit the details-
build.gradle
buildscript{
repositories{
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.10")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.6.2")
}
}
plugins{
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
}
apply plugin: "java"
apply plugin: "kotlin"
repositories {
mavenCentral()
}
// テンポラリディレクトリのパスを定義する
ext.domaResourcesDir = "${buildDir}/tmp/doma-resources"
// domaが注釈処理で参照するリソースをテンポラリディレクトリに抽出
task extractDomaResources(type: Copy) {
dependsOn processResources
from processResources.destinationDir
include 'doma.compile.config'
include 'META-INF/**/*.sql'
include 'META-INF/**/*.script'
into domaResourcesDir
}
// テンポラリディレクトリ内のリソースをcompileJavaタスクの出力先ディレクトリにコピーする
task copyDomaResources(type: Copy, dependsOn: extractDomaResources) {
dependsOn extractDomaResources
from domaResourcesDir
into compileJava.destinationDir
}
compileJava {
// 上述のタスクに依存させる
dependsOn copyDomaResources
// テンポラリディレクトリをcompileJavaタスクの入力ディレクトリに設定する
inputs.dir domaResourcesDir
options.encoding = 'UTF-8'
}
compileTestJava {
options.encoding = 'UTF-8'
// テストの実行時は注釈処理を無効にする
options.compilerArgs = ['-proc:none']
}
dependencies {
// spring starter web
implementation ("org.springframework.boot:spring-boot-starter-web")
// doma sprig boot starter
implementation ("org.seasar.doma.boot:doma-spring-boot-starter:1.5.0")
// domaの注釈処理を実行することを示す
annotationProcessor 'org.seasar.doma:doma:2.29.0'
// domaへの依存を示す
implementation 'org.seasar.doma:doma:2.29.0'
}
repositories {
mavenCentral()
}
dependencyManagement{
imports{
mavenBom "org.springframework.boot:spring-boot-dependencies:2.6.2"
}
}
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
kotlinOptions {
jvmTarget = '11'
}
}
added UserDao.kt
package com.event.app.backend.infrastructure.dao
import com.event.app.backend.infrastructure.table.UsersTicketsTableRecord
import org.seasar.doma.Dao
import org.seasar.doma.Insert
import org.seasar.doma.Select
import org.seasar.doma.boot.ConfigAutowireable
#ConfigAutowireable
#Dao
interface UserDao {
#Insert
fun insertUsersTickets(usersTicketsTableRecord: UsersTicketsTableRecord):Result<UsersTicketsTableRecord>
#Select
fun getTicketCntByEventUserId(eventId:String,userId:String):Int
}
You'd need to use kapt instead of annotationProcessor in build.gradle when you use Doma with Kotlin.
The code generated by kapt can be found under build/generated/source/kapt.
The following sample repository may be helpful.
https://github.com/domaframework/kotlin-sample
In the case of Spring Boot, you'd need to define the Dao's in a BeanConfig. I guess it's something similiar in this case.
import org.jdbi.v3.core.Jdbi;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import se.xxx.dao.*;
#Configuration
public class BeanConfig {
#Bean
public SwingPositionDao swingPositionDao(#Qualifier("jdbi.manager") Jdbi jdbi) {
return jdbi.onDemand(SwingPositionDao.class);
}
}

How to get a FragmentManager for DialogFragment in Kotlin using Androidx?

I am following a tutorial where the instructor is using the Android support library v7. In my app I am using the androidx version (as suggested on the Android Developer website). When I type the lines of code as instructed, Android Studio puts a strikethrough over part of the code where I try to obtain a FragmentManager and says: "getter for fragmentManager: FragmentManager! is deprecated. Deprecated in Java." I have searched so many posts where people were having similar issues but the solutions provided don't apply to my case. Some users were having mismatched support library versions and others didn't have the proper dependencies in the gradle file. As far as I can tell those issues don't apply here.
According to the androidx documentation for FragmentManager, it states, "Your activity must derive from FragmentActivity to use this. From such an activity, you can acquire the FragmentManager by calling FragmentActivity#getSupportFragmentManager." However, I am not using an Activity, the code is inside an inner class that extends the RecylcerView.ViewHolder class which is nested inside a class extending RecyclerView.Adapter. Is my only choice to use the android support library v7?
RecyclerView Adapter Class:
import android.app.Activity
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.squareup.picasso.Picasso
import kotlinx.android.synthetic.main.e_product_row.view.*
import androidx.fragment.app.DialogFragment // greyed out as "unused import directive"
import androidx.fragment.app.FragmentManager // greyed out as "unused import directive"
class EProductAdapter(var context: Context, var arrayList : ArrayList<EProduct>) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val productView = LayoutInflater.from(context).inflate(R.layout.e_product_row, parent, false)
return ProductViewHolder(productView)
}
override fun getItemCount(): Int {
return arrayList.size
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
// downcast holder to ProductViewHolder
(holder as ProductViewHolder).initializeRowComponents(arrayList.get(position).id,
arrayList[position].name,
arrayList[position].price,
arrayList[position].picture)
}
inner class ProductViewHolder(productView: View) : RecyclerView.ViewHolder(productView) {
fun initializeRowComponents(id: Int, name: String, price: Int, pictureName: String) {
itemView.txt_id.text = id.toString()
itemView.txt_name.text = name
itemView.txt_price.text = price.toString()
var pictureUrl = "http://192.168.0.21/OnlineStoreApp/osimages/$pictureName"
pictureUrl = pictureUrl.replace(" ", "%20")
Picasso.get().load(pictureUrl).into(itemView.img_product)
// initialize add item imageView
itemView.img_add_item.setOnClickListener {
var amountFragment = AmountFragment()
var fragmentManager = (itemView.context as Activity).fragmentManager // fragmentManager strikethrough text
amountFragment.show(fragmentManager, "TAG") // show function cannot be called with arguments supplied and won't compile
}
}
}
}
DialogFragment class:
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.DialogFragment
class AmountFragment : DialogFragment() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle? ): View? {
return inflater.inflate(R.layout.fragment_amount, container, false)
}
}
build.gradle(Module: app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.bryontaylor.onlinestoreapp"
minSdkVersion 24
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.1.0'
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.volley:volley:1.1.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'androidx.fragment:fragment:1.2.4'
implementation 'androidx.fragment:fragment-ktx:1.2.4'
}
According to the androidx documentation for FragmentManager, it
states, "Your activity must derive from FragmentActivity to use this.
From such an activity, you can acquire the FragmentManager by calling
FragmentActivity#getSupportFragmentManager." However, I am not using
an Activity
Yes you are:
var fragmentManager = (itemView.context as Activity).fragmentManager
The only problem is that you're casting to the root Activity type and using the deprecated getFragmentManager(). You need to do exactly as the docs state: use FragmentActivity and getSupportFragmentManager():
var fragmentManager = (itemView.context as FragmentActivity).supportFragmentManager
Your show() call will then work because you're passing in the correct fragment manager type.
Hope that helps!

Kotlin Annotation Processor not working? What am I missing?

Recently I've been trying to make a annotation processor through Kotlin but I can't seem to get it to work. Everything compiles and I don't get any errors but when I check the contents of my jar file I don't see the resource I'm trying to create.
I've tried everything for hours and I'm really stuck so just looking for help :/ I do have one random class annotated to see if it would work but no luck.
The annotation class
#Retention(AnnotationRetention.RUNTIME)
#Target(AnnotationTarget.CLASS)
annotation class TestAnnotation
The processor class
#AutoService(TestAnnotation::class)
class TestAnnotationProcessor : AbstractProcessor() {
override fun process(annotations: MutableSet<out TypeElement>, environment: RoundEnvironment): Boolean {
this.processingEnv.filer.createResource(StandardLocation.CLASS_OUTPUT, "", "test.txt")
return true
}
override fun getSupportedSourceVersion() = SourceVersion.RELEASE_8
override fun getSupportedAnnotationTypes() = setOf(TestAnnotation::class.java.canonicalName)
}
My build.gradle.kts
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
java
kotlin("jvm") version "1.3.50"
kotlin("kapt") version "1.3.50"
id("com.github.johnrengelman.shadow") version "5.1.0"
}
group = "com.example.test"
version = "1.0"
repositories {
mavenCentral()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.1")
implementation("com.google.auto.service:auto-service:1.0-rc6")
kapt("com.google.auto.service:auto-service:1.0-rc6")
}
configure<JavaPluginConvention> {
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks.withType<KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType<ShadowJar> {
dependencies {
exclude(dependency("com.google.auto.service:auto-service:1.0-rc6"))
}
}
In order for your custom annotation processor to work, you will have to use it in your build script dependencies
dependencies {
kapt project(':processor-module') // or what ever your processor's module is named.
//OR
kapt 'gourp:artifact:version' // if your processor is published into a maven repository.
}