kapt/requery not generating ORM files - kotlin

I'm trying to ressurect a kotlin app that used to Just Work™, i.e., compile straight away, on Ubuntu 16.04.
Part of it is generated code, but i get compilation errors because there is, for instance, no PersonEntity class. So this code fails:
public final void getName(#org.jetbrains.annotations.Nullable()
android.widget.ImageView view, #org.jetbrains.annotations.NotNull()
com.my.app.model.Plus item, #org.jetbrains.annotations.Nullable()
android.widget.ImageView parent, #org.jetbrains.annotations.NotNull()
PersonEntity line) {
}
I have two viable candidates:
Person.java:
package com.my.package.model;
import android.databinding.Observable;
import android.os.Parcelable;
import java.io.Serializable;
import io.requery.Entity;
import io.requery.Key;
import io.requery.Persistable;
#Entity
public interface Person extends Observable, Parcelable, Persistable, Serializable {
#Key
long getID();
int getAge();
...
DbPerson.kt:
package com.my.package.DbObjects
import com.google.gson.annotations.Expose
import com.google.gson.annotations.SerializedName
class DbPerson {
#SerializedName("ID")
#Expose
var id: String =""
#SerializedName("Age")
#Expose
var age: String =""
I see kapt generates a lot of class files, e.g.:
./app/build/tmp/kapt3/incrementalData/debug/com/my/package/DbObjects/DbPerson.class
./app/build/tmp/kapt3/stubs/debug/com/my/package/DbObjects/DbPerson.java
./app/build/tmp/kapt3/stubs/debug/com/my/package/DbObjects/DbPerson.kapt_metadata
...but no PersonEntity.java. Actually, no *Entity* files whatsoever.
I'm not sure if this was because the *.model files are Java instad of kotlin, so i migrated them to kotlin, and got different errors. Maybe because they're interfaces and not regular classes? But then where are the other *Entity* files?
This is my build.gradle:
buildscript {
ext {
setup = [
compileSdk: 27,
buildTools: "27.0.1",
minSdk : 14,
targetSdk : 27
]
versions = [
supportLib: "27.0.1"
]
kotlin_version = '1.3.31'
}
repositories {
google()
jcenter() // w: JCenter is at end of life
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
//classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath "com.jaredsburrows:gradle-spoon-plugin:1.4.0"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And my app/build.gradle:
apply plugin: "com.android.application"
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "com.jaredsburrows.spoon"
android {
lintOptions {
abortOnError false
}
compileSdkVersion 27
defaultConfig {
multiDexEnabled true
applicationId "com.my.package"
minSdkVersion 19
targetSdkVersion 26
versionCode 9 //db_version too
versionName "2.31"
//testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "com.my.app.activities.CustomTestRunner"
resValue "string", "app_build_number", (System.getenv("BUILD_NUMBER") ?: "IDE")
resValue "string", "server_address", "1.2.3.4"
project.ext.set("archivesBaseName", "MyAppName-" + System.getenv("BRANCH_NAME") + "-v" + defaultConfig.versionName + "." + (System.getenv("BUILD_NUMBER") as Integer ?: 0).toString())
}
signingConfigs {
release {
storeFile file("myKey.jks")
storePassword 'mypassword'
keyAlias 'mykeyalias'
keyPassword 'mypassword'
}
}
buildTypes {
release {
resValue "string", "server_address", ""
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
no_wifi_check
{
resValue "string", "app_build_number", "NOWIFI"
signingConfig signingConfigs.release
}
debug {
resValue "string", "server_address", "1.2.3.4"
}
}
buildFeatures {
dataBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = '1.8' // Java 7 not supported by kotlinOptions jvmTarget
}
}
dependencies {
implementation 'javax.xml.bind:jaxb-api:2.3.1'
implementation 'xml-apis:xml-apis:2.0.2'
implementation 'xerces:xercesImpl:2.12.0'
implementation 'com.android.support:multidex:1.0.3'
androidTestImplementation('com.android.support:multidex-instrumentation:1.0.3') {
exclude group: 'com.android.support', module: 'multidex'
}
implementation fileTree(dir: 'libs', include: ['*.jar'])
//implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.31"
/* ^ w: Plugin version (1.5.0) is not the same as library version (1.3.31)
A newer version of org.jetbrains.kotlin:kotlin-stdlib-jdk8 than 1.3.31 is available: 1.4.31 */
implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2' // w: A newer version of com.android.support.constraint:constraint-layout than 1.0.2 is available: 2.0.4
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:cardview-v7:27.1.1'
implementation 'io.reactivex.rxjava2:rxjava:2.1.1'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
//retrofit
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
//requery
implementation 'io.requery:requery:1.4.1'
implementation 'io.requery:requery-android:1.4.1' // for android
//annotationProcessor 'io.requery:requery-processor:1.4.1'
kapt("io.requery:requery-processor:1.4.1")
//Picasso
implementation 'com.squareup.picasso:picasso:2.5.2'
//okhttp
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.1.0'
//AndroidSlidingUpPanel
implementation 'com.sothree.slidinguppanel:library:3.4.0'
//
implementation 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
//MaterialDrawer
implementation("com.mikepenz:materialdrawer:6.0.9#aar") {
transitive = true
}
//required support lib modules
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:recyclerview-v7:27.1.1'
//implementation "com.android.support:support-annotations:${versions.supportLib}"
implementation "com.android.support:support-annotations"
implementation 'com.android.support:design:27.1.1'
// the sample uses more advanced functions of the fastadapter
// https://github.com/mikepenz/FastAdapter/
implementation 'com.mikepenz:fastadapter-commons:3.2.8#aar'
// used to generate the Open Source section
// https://github.com/mikepenz/AboutLibraries
implementation('com.mikepenz:aboutlibraries:6.0.0#aar') {
transitive = true
}
//used to provide different itemAnimators for the RecyclerView
//https://github.com/mikepenz/ItemAnimators
implementation 'com.mikepenz:itemanimators:1.0.1#aar'
// used to provide the MiniDrawer to normal Drawer crossfade effect via a SlidingPane layout
// --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/MiniDrawerActivity.java
// https://github.com/mikepenz/Crossfader
implementation 'com.mikepenz:crossfader:1.5.1#aar'
// used to provide the two step crossfade DrawerLayout. Which allows to have a mini layout which transforms to a normal layout within the drawer
// --> https://github.com/mikepenz/MaterialDrawer/blob/develop/app/src/main/java/com/mikepenz/materialdrawer/app/CrossfadeDrawerLayoutActvitiy.java
// https://github.com/mikepenz/CrossfadeDrawerLayout
implementation('com.mikepenz:crossfadedrawerlayout:1.0.1#aar')
// icon fonts used inside the sample
// https://github.com/mikepenz/Android-Iconics
implementation 'com.mikepenz:google-material-typeface:3.0.1.1.original#aar'
implementation 'com.mikepenz:fontawesome-typeface:4.7.0.1#aar'
implementation 'com.mikepenz:octicons-typeface:3.0.0.1#aar'
implementation('com.mikepenz:materialdrawer:6.0.9#aar') { transitive = true }
// icon fonts used inside the sample
// https://github.com/mikepenz/Android-Iconics
implementation 'com.mikepenz:google-material-typeface:3.0.1.1.original#aar'
implementation 'com.mikepenz:fontawesome-typeface:4.7.0.1#aar'
implementation 'com.mikepenz:octicons-typeface:3.0.0.1#aar'
//Toasty
implementation 'com.github.GrenderG:Toasty:1.2.8'
//android fab
//compile 'uk.co.markormesher:android-fab:2.0.0'
//FloatingActionButton
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.jaredrummler:colorpicker:1.0.2'
implementation 'com.fasterxml.jackson.core:jackson-core:2.7.3'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.7.3'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.7.3'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.android.support', module: 'support-v4'
exclude group: 'com.android.support', module: 'design'
exclude group: 'com.android.support', module: 'recyclerview-v7'
}
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
androidTestImplementation 'com.squareup.spoon:spoon-client:1.6.4'
}
kapt {
//generateStubs = true
useBuildCache = false
correctErrorTypes = true
}
apply plugin: 'spoon'
// This section is optional
spoon {
// for debug output
debug = true
// To run a single test class
className = 'fully.qualified.TestCase'
// To run a single method in TestCase
methodName = 'testMyApp'
// To execute the tests device by device */
sequential = true
// To grant permissions to Android M >= devices */
grantAllPermissions = true
}
android.applicationVariants.all { variant ->
def applicationId = variant.applicationId
def adb = android.getAdbExe().toString()
def variantName = variant.name.capitalize()
def grantPermissionTask = tasks.create("grant${variantName}Permissions") { doLast {
"${adb} devices".execute().text.eachLine {
if (it.endsWith("device")) {
def device = it.split()[0]
println "Granting permissions on devices ${device}"
"${adb} -s ${device} shell pm grant ${applicationId} android.permission.CAMERA".execute()
"${adb} -s ${device} shell pm grant ${applicationId} android.permission.ACCESS_FINE_LOCATION".execute()
"${adb} -s ${device} shell pm grant ${applicationId} android.permission.WRITE_EXTERNAL_STORAGE".execute()
"${adb} -s ${device} shell pm grant ${applicationId} android.permission.READ_EXTERNAL_STORAGE".execute()
}
}
}
}
}
I assume there's a mismatch somewhere between plugin versions, Java version, kotlin version, gradle, etc... but i can't place it.
** EDIT **
The same project builds on:
Windows 10 VM
Android Studio 4.1
whichever JDK is in C:\Program Files\Android\Android Studio\jre (the release file has JAVA_VERSION="1.8.0_242")
but not on:
Ubuntu Xenial VM
Android Studio 4.2.1
whichever JDK is in ${HOME}/android-studio/jre (the release file has JAVA_VERSION="11.0.8", which is too different to make sense).

Related

How can I add serialization dependencies to my kotlin project?

I am trying to add json serialization dependencies in my kotlin project but it doesnt work and lots of error appear when I sync project. I dont know why. I did as in the serialization dependency addition section on the kotlin web site, but it didn't work. how do I add it to my codes ?.
Build.Gragle(project)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
compose_version = '1.0.1'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.21"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.44'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Build.Gradle(module)
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id 'org.jetbrains.kotlin.android.extensions'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.enestigli.dictionaryapp"
minSdk 21
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
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 {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
androidExtensions {
experimental = true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.3.1'
implementation 'androidx.activity:activity-compose:1.3.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation "com.squareup.okhttp3:okhttp:4.9.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.9.0"
//Dagger - Hilt
implementation "com.google.dagger:hilt-android:2.38.1"
kapt "com.google.dagger:hilt-android-compiler:2.38.1"
//implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-alpha03'
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.1'
// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
// Room
implementation "androidx.room:room-runtime:2.3.0"
kapt "androidx.room:room-compiler:2.3.0"
// To use Kotlin annotation processing tool (kapt)
// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.3.0"
//Material theme3
implementation "androidx.compose.material3:material3:1.0.0-alpha12"
implementation "androidx.compose.material3:material3-window-size-class:1.0.0-alpha12"
//skrape{it}
//implementation 'org.jsoup:jsoup:1.12.1'
//compose
implementation "androidx.compose.runtime:runtime-livedata:$compose_version"
}
EDIT
I found the solution
In this case, you need to install whatever Kotlin version is. In my case like this
my kotlin version is : 1.5.21
and I added this dependency in gradle.plugin(module)
plugins {
id 'org.jetbrains.kotlin.plugin.serialization' version '1.5.21'
}
and I added this
dependencies {
implementation 'org.jetbrains.kotlinx:kotlinx-serialization-json:1.4.1'
}
and that's it, now you can use serialization in your data class like this.
for example
import kotlinx.serialization.Serializable
#Serializable
data class example(
val example: String,
)

Error resolving jetpack compose dependencies in version 1.1.0-rc02

Problem description
I'm trying to use the latest version of jetpack compose 1.1.0-rc02, but some dependencies are returning an error:
Failed to resolve: androidx.compose.material:material:1.1.0-rc02
Failed to resolve: androidx.compose.ui:ui:1.1.0-rc02
Failed to resolve: androidx.compose.ui:ui-tooling:1.1.0-rc02
Failed to resolve: androidx.compose.ui:ui-tooling-preview:1.1.0-rc02
Failed to resolve: androidx.compose.ui:ui-test-junit4:1.1.0-rc02
My gradle files
Project scope
buildscript {
ext {
compose_version = '1.1.0-rc02'
kotlin_version = '1.6.10'
hilt_version = '2.38.1'
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.4"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Application scope
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
}
android {
compileSdk 31
defaultConfig {
applicationId "com.plcoding.dictionary"
minSdk 21
targetSdk 31
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary true
}
}
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'
useIR = true
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion compose_version
kotlinCompilerVersion kotlin_version
}
packagingOptions {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.7.0'
implementation 'androidx.appcompat:appcompat:1.4.0'
implementation 'com.google.android.material:material:1.4.0'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.4.0'
implementation 'androidx.activity:activity-compose:1.4.0'
testImplementation 'junit:junit:4.+'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
// Compose dependencies
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:2.4.0"
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2'
// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.4.0"
//Dagger - Hilt
implementation "com.google.dagger:hilt-android:$hilt_version"
kapt "com.google.dagger:hilt-android-compiler:$hilt_version"
implementation "androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03"
kapt "androidx.hilt:hilt-compiler:1.0.0"
implementation 'androidx.hilt:hilt-navigation-compose:1.0.0-rc01'
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
implementation "com.squareup.okhttp3:okhttp:5.0.0-alpha.2"
implementation "com.squareup.okhttp3:logging-interceptor:5.0.0-alpha.2"
// Room
implementation "androidx.room:room-runtime:2.4.0"
kapt "androidx.room:room-compiler:2.4.0"
// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:2.4.0"
}
Here is a code version of the same answer #Francesc gave:
// Inside project's build.gradle file
buildscript {
ext {
// Define the 2 versions
compose_compiler_version = '1.1.0-rc02'
compose_version = '1.1.0-rc01'
}
...
}
Then inside your android module (app/library):
// Inside module's build.gradle file
android {
...
composeOptions {
// Compose compiler uses 'compose_compiler_version'
kotlinCompilerExtensionVersion compose_compiler_version
}
}
dependencies {
...
// Compose dependencies use 'compose_version'
implementation "androidx.compose.ui:ui:$compose_version"
implementation "androidx.compose.material:material:$compose_version"
implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
}
RC02 is only available for the compose compiler to make it compatible with Kotlin 1.6.10. All other libraries are still in RC01, so for now you have to specify different versions for the compiler and the other compose dependencies.

SQLDelight: Unresolved reference AndroidSqliteDriver in Kotlin Multiplatform App

I try add sqldelight to my Kotlin Multiplatform App, but AndroidSqliteDriver unresolved reference. I dont understand why.
I clear cache and regenerate all, but it dont work too.
AndroidSqliteDriver:
package com.rompos.deactivator
import com.squareup.sqldelight.android.AndroidSqliteDriver
import android.content.Context
lateinit var appContext: Context
actual fun createDB() : Server {
val driver = AndroidSqliteDriver(Server.Schema, appContext, "Server.db")
return Server(driver)
}
build.gradle(common):
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
plugins {
kotlin("multiplatform")
id("com.squareup.sqldelight")
}
kotlin {
//select iOS target platform depending on the Xcode environment variables
val iOSTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget =
if (System.getenv("SDK_NAME")?.startsWith("iphoneos") == true)
::iosArm64
else
::iosX64
iOSTarget("ios") {
binaries {
framework {
baseName = "SharedCode"
}
}
}
jvm("android")
// Common Main
sourceSets["commonMain"].dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib-common")
implementation("io.ktor:ktor-client-core:1.3.2")
implementation("com.squareup.sqldelight:runtime:1.4.0")
}
// Android Main
sourceSets["androidMain"].dependencies {
implementation("org.jetbrains.kotlin:kotlin-stdlib")
implementation("com.squareup.sqldelight:android-driver:1.4.0") {
exclude(group = "com.squareup.sqldelight", module = "runtime-jdk")
}
}
// iOS Main
sourceSets["iosMain"].dependencies {
implementation("com.squareup.sqldelight:native-driver:1.4.0")
}
}
build.gradle(android):
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlinx-serialization'
apply plugin: 'com.squareup.sqldelight'
android {
compileSdkVersion 30
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.rompos.deactivator"
minSdkVersion 26
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'
}
}
packagingOptions {
exclude 'META-INF/*.kotlin_module'
}
buildFeatures {
dataBinding true
}
}
dependencies {
implementation project(':SharedCode')
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.core:core-ktx:1.3.1"
implementation "androidx.appcompat:appcompat:1.2.0"
implementation "com.google.android.material:material:1.2.0"
implementation "androidx.constraintlayout:constraintlayout:1.1.3"
implementation
"androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation "androidx.navigation:navigation-fragment-ktx:2.3.0"
implementation "androidx.navigation:navigation-ui-ktx:2.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-
android:1.3.7"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-
runtime:0.20.0"
implementation "io.ktor:ktor-client-android:1.3.2"
implementation "com.squareup.sqldelight:android-
driver:$sqldelight_version"
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-
core:3.2.0'
}
build.gradle(project):
buildscript {
ext {
ext.kotlin_version = '1.3.72'
sqldelight_version = "1.4.0"
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-
plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-
serialization:$kotlin_version"
classpath "com.squareup.sqldelight:gradle-
plugin:$sqldelight_version"
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://kotlin.bintray.com/kotlinx" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I use:
gradle: 6.1.1
gradle plugin: 4.0.1
kotlin: 1.3.72
upd: Add code
you only have a jvm target jvm("android") and not an android target. you need an android library or application target to use the android library.
EDIT: To add an android target:
//build.gradle(common)
plugins {
...
// assuming your building a library. use application otherwise
id("com.android.library")
id("kotlin-android")
}
...
android {
// fill in your library or app info here
}
kotlin {
android { // creates androidMain/Test source sets
// ex: publishLibraryVariants("release", "debug")
}
ios() { ... }
val commonMain by getting { ... }
val androidMain by getting { ... }
...
}
Make sure you're using at least Android Studio 4.1.
You should only need to include the SQLDelight plugin in your common build.gradle.
build.gradle
...
apply plugin: "com.squareup.sqldelight" in the common build.gradle
...
sourceSets {
commonMain.dependencies {
...
// SQL Delight
implementation "com.squareup.sqldelight:runtime:${Versions.sqlDelight}"
implementation "com.squareup.sqldelight:coroutines-extensions:${Versions.sqlDelight}"
}
androidMain.dependencies {
...
// SQL Delight
implementation "com.squareup.sqldelight:android-driver:${Versions.sqlDelight}"
implementation "com.squareup.sqldelight:coroutines-extensions-jvm:${Versions.sqlDelight}"
}
iOSMain.dependencies {
...
// SQL Delight
implementation "com.squareup.sqldelight:ios-driver:${Versions.sqlDelight}"
}
}

DaggerAppComponent has unresolved referance in kotlin

Please, help me. I have tried out all ways to solve this problem, but no result :( More information about my app
build.gradle(Module:app)
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-kapt'
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
// You can find the lastest version number here:
https://docs.fabric.io/android/changelog.html#fabric-gradle-plugin
classpath 'io.fabric.tools:gradle:1.+'
}
}
project.ext {
supportLibraryVersion = "26.1.0"
androidArchVersion = "1.0.0-rc1"
daggerVersion = "2.11"
butterKnifeVersion = "8.7.0"
rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.1"
timberVersion = "4.5.1"
priorityJobQueueVersion = "2.0.1"
playServicesVersion = "11.4.2"
retrofitVersion = "2.1.0"
okHttpVersion = "3.4.1"
rxRelayVersion = "2.0.0"
rxLintVersion = "1.6"
}
android {
compileSdkVersion 27
defaultConfig {
javaCompileOptions.annotationProcessorOptions.includeCompileClasspath =
true
vectorDrawables.useSupportLibrary true
applicationId "***"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
resConfigs "en"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
splits {
density {
enable true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
}
debug {
// Disable fabric build ID generation for debug builds
ext.enableCrashlytics = false
}
}
}
kapt {
generateStubs = true
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'uk.co.chrisjenx:calligraphy:2.2.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:design:27.0.2'
implementation 'com.intuit.sdp:sdp-android:1.0.5'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0#aar') {
transitive = true
}
implementation 'com.android.support:support-v4:27.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'
implementation "com.android.support:appcompat-
v7:$project.supportLibraryVersion"
// Retrofit
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
// GSON Converter
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
//OkHttp Logging Interceptor
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.9.1'
implementation 'com.google.code.gson:gson:2.8.2'
// ReactiveX
implementation "io.reactivex.rxjava2:rxjava:$project.rxJavaVersion"
implementation
"io.reactivex.rxjava2:rxandroid:$project.rxAndroidVersion"
//Room database
implementation "android.arch.persistence.room:runtime:1.1.1"
implementation "android.arch.persistence.room:rxjava2:1.1.1"
kapt "android.arch.persistence.room:compiler:1.1.1"
implementation "android.arch.paging:runtime:1.0.0-alpha3"
// Lifecycle
implementation
"android.arch.lifecycle:runtime:$project.androidArchVersion"
implementation
"android.arch.lifecycle:extensions:$project.androidArchVersion"
annotationProcessor
"android.arch.lifecycle:compiler:$project.androidArchVersion"
// RxRelay
implementation
"com.jakewharton.rxrelay2:rxrelay:$project.rxRelayVersion"
// RxLint
implementation "nl.littlerobots.rxlint:rxlint:$project.rxLintVersion"
// GCM Network Manager
implementation "com.google.android.gms:play-services-
gcm:$project.playServicesVersion"
// Priority Job Queue
implementation "com.birbit:android-priority-
jobqueue:$project.priorityJobQueueVersion"
// ButterKnife
implementation "com.jakewharton:butterknife:$project.butterKnifeVersion"
annotationProcessor "com.jakewharton:butterknife-
compiler:$project.butterKnifeVersion"
// Dagger
def daggerVer = 2.14
implementation "com.google.dagger:dagger:$daggerVer"
implementation "com.google.dagger:dagger-android-support:$daggerVer"
kapt "com.google.dagger:dagger-android-processor:$daggerVer"
kapt "com.google.dagger:dagger-compiler:$daggerVer"
// Timber
implementation "com.jakewharton.timber:timber:$project.timberVersion"
}
Here is my App, where DaggerAppComponent is red
class App : Application(), HasActivityInjector {
#Inject
lateinit var dispatchingAndroidInjector: DispatchingAndroidInjector<Activity>
override fun onCreate() {
super.onCreate()
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
DaggerAppComponent
.builder()
.application(this)
.build()
.inject(this)
JobManagerFactory().getJobManager(this)
}
override fun activityInjector(): AndroidInjector<Activity> {
return this.dispatchingAndroidInjector
}
}
Android Studio Version - 3.0.1
I have registered app in the Manifest and have rebuild and invalidated caches more times.
Don't understand what is the problem. Please, save me :(

gradle android - google services 3.2.0 [ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform]

i have downgraded google services plugin to 3.2.0 inorder for my builds to work sense 3.3.0 is broken.
but when i run the gradle build i get the following error stacktrace:
[ERROR] [com.android.build.gradle.internal.transforms.DesugarTransform] Exception in thread "main" java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer$DefaultMethodFinder.visit(DefaultMethodClassFixer.java:483)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:621)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.defaultMethodsDefined(DefaultMethodClassFixer.java:331)
at com.google.devtools.build.android.desugar.DefaultMethodClassFixer.visitEnd(DefaultMethodClassFixer.java:91)
at org.objectweb.asm.ClassVisitor.visitEnd(ClassVisitor.java:339)
at com.google.devtools.build.android.desugar.InterfaceDesugaring.visitEnd(InterfaceDesugaring.java:112)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:702)
at org.objectweb.asm.ClassReader.accept(ClassReader.java:500)
at com.google.devtools.build.android.desugar.Desugar.desugarClassesInInput(Desugar.java:477)
at com.google.devtools.build.android.desugar.Desugar.desugarOneInput(Desugar.java:361)
at com.google.devtools.build.android.desugar.Desugar.desugar(Desugar.java:314)
at com.google.devtools.build.android.desugar.Desugar.main(Desugar.java:711)
let me show you my gradle project details:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
google()
}
//kotlin version
ext.kotlin_version = '1.2.41'
ext.kotlin_ktx_version = '0.3'
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "http://dl.bintray.com/pt-midtrans/maven" }
maven { url "https://jitpack.io" }
google()
}
project.ext {
minimumSdkVersion = 16
supportlib_version = '27.1.1'
room_version = '1.0.0'
espresso_version = '3.0.1'
archLifecycleVersion = '1.1.1'
dagger = '2.15'
}
}
subprojects {
//todo change this to loop once
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex')) {
details.useVersion "$supportlib_version" //force all versions of support library to be the same. i tried commending out this entire block but that is not the issue
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and here is my module gradle file (single module application i have, only app):
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 27
//buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion project.ext.minimumSdkVersion
//check top level build.gradle file for attributes -
targetSdkVersion 27
applicationId "com.mobile.mypackage"
versionCode 1
versionName "3" //whatever
testInstrumentationRunner "com.mobile.mypackage.base.MyTestRunner"
multiDexEnabled true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
flavorDimensions 'tier'
buildTypes {
release {
debuggable false //for troubleshooting, should set to false in production build
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
}
debugMini {
//this is a proguarded version of debug build, turn off - InstaRun to use
initWith debug
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro', 'proguard-gson.pro', 'proguard-midtrans.pro'
matchingFallbacks = ['debug']
}
}
dexOptions {
//for out of memory gc overhead error
javaMaxHeapSize "6g"
}
lintOptions {
abortOnError false
}
androidExtensions {
experimental = true
}
testOptions {
//this seems to be absolutely nothing in build tools 25.0.3. after upgrading gradle will check again
animationsDisabled = true
execution 'ANDROID_TEST_ORCHESTRATOR'
}
productFlavors {
def STRING = "String"
def BOOLEAN = "boolean"
def TRUE = "true"
def FALSE = "false"
def BASE_ENDPOINT = "BASE_ENDPOINT"
staging {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-STAGING'
applicationIdSuffix 'staging'
}
labs {
dimension 'tier'
ext.alwaysUpdateBuildId = false
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
versionNameSuffix '-LABs'
applicationIdSuffix 'labs'
}
prod {
dimension 'tier'
buildConfigField STRING, BASE_ENDPOINT, '"https://api.myendpoint.com"'
}
}
}
kapt {
useBuildCache = false //toggle this to see if it will help
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation("com.android.support:appcompat-v7:$supportlib_version") {
force = true
}
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation "com.android.support:support-annotations:$supportlib_version"
implementation("com.android.support:design:$supportlib_version") {
force = true
}
implementation 'com.android.support:multidex:1.0.3'
//firebase
implementation("com.google.firebase:firebase-auth:15.1.0") {
//force = true
}
implementation("com.google.firebase:firebase-core:15.0.2") {
// force = true
}
implementation("com.google.firebase:firebase-config:15.0.2") {
// force = true
}
implementation("com.google.android.gms:play-services-auth:15.0.0") {
// force = true
}
implementation("com.google.firebase:firebase-messaging:15.0.2") {
// force = true
}
//rxjava
implementation 'io.reactivex.rxjava2:rxjava:2.1.6'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.0.0'
//square
implementation 'com.google.dagger:dagger:2.12'
kapt "com.google.dagger:dagger-compiler:2.12"
implementation 'com.github.ajalt:timberkt:1.3.0'
implementation 'com.jakewharton:butterknife:8.8.1'
kapt 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "com.squareup.retrofit2:retrofit:2.3.0"
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation "com.squareup.retrofit2:converter-gson:2.3.0"
androidTestImplementation 'com.squareup.rx.idler:rx2-idler:0.9.0' //for espresso
//mosby //some bug in mosby3 and dagger2 preventing me from updating still. i opened a bug with mosby: https://github.com/sockeqwe/mosby/issues/298
implementation 'com.hannesdorfmann.mosby:viewstate:2.0.1'
//------Architecture Components ------------
//room db
implementation "android.arch.persistence.room:runtime:$room_version"
implementation "android.arch.lifecycle:common-java8:1.1.1"
kapt "android.arch.persistence.room:compiler:$room_version"
implementation "android.arch.persistence.room:rxjava2:$room_version"
// Lifecycles only (no ViewModel or LiveData)
implementation "android.arch.lifecycle:runtime:$archLifecycleVersion"
kapt "android.arch.lifecycle:compiler:$archLifecycleVersion"
implementation "android.arch.lifecycle:extensions:$archLifecycleVersion"
//------END Architecture Components ------------
//event Bus
implementation 'org.greenrobot:eventbus:3.0.0'
//FB
implementation 'com.facebook.android:facebook-android-sdk:4.32.0'
//implementation 'com.facebook.android:facebook-applinks:[4,5)'
implementation 'com.facebook.fresco:fresco:1.3.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.facebook.stetho:stetho-okhttp3:1.5.0'
//testing
androidTestImplementation 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'
testImplementation 'org.mockito:mockito-core:2.15.0'
androidTestImplementation 'org.mockito:mockito-android:2.8.9'
androidTestImplementation 'com.github.fabioCollini:DaggerMock:0.8.4'
implementation 'com.squareup.okhttp3:mockwebserver:3.8.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test:rules:1.0.1'
// Espresso dependencies
androidTestImplementation "com.android.support.test.espresso:espresso-core:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-contrib:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-intents:$espresso_version"
// androidTestImplementation 'com.android.support.test.espresso:espresso-accessibility:3.0.1'
androidTestImplementation "com.android.support.test.espresso:espresso-web:$espresso_version"
androidTestImplementation "com.android.support.test.espresso.idling:idling-concurrent:$espresso_version"
androidTestImplementation "com.android.support.test.espresso:espresso-idling-resource:$espresso_version"
//UI dependencies
implementation 'com.andreabaccega:android-edittext-validator:1.3.4'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation "com.imgix:imgix-java:1.1.10"
implementation 'com.github.markomilos:paginate:0.5.1'
implementation 'com.sprylab.android.texturevideoview:texturevideoview:1.2.1'
implementation 'com.balysv:material-ripple:1.0.2'
implementation 'com.github.d-max:spots-dialog:0.7#aar' //loading screen
implementation 'com.jaredrummler:material-spinner:1.1.0'//drop down list
implementation 'com.github.ganfra:material-spinner:1.1.1'//drop down list
implementation 'com.bartoszlipinski:recyclerviewheader2:2.0.1'
//implementation 'com.github.takusemba:multisnaprecyclerview:1.1.1' //snap
implementation 'com.crystal:crystalrangeseekbar:1.1.1'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.0'
//data structures
implementation 'com.scalified:tree:0.2.4'
//parcelable
implementation 'org.parceler:parceler-api:1.1.9'
kapt 'org.parceler:parceler:1.1.9'
//payment gateways
//implementation 'co.omise:omise-android:2.3.+'
implementation 'co.omise:omise-android:2.6.4'
implementation 'com.braintreepayments.api:braintree:1.+'
debugImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
debugMiniImplementation 'com.midtrans:uikit:1.17.0-SANDBOX'
releaseImplementation 'com.midtrans:uikit:1.17.0'
//fresh chat
implementation 'com.github.freshdesk:freshchat-android:1.3.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.9.0#aar') {
transitive = true
//one signal
implementation 'com.onesignal:OneSignal:[3.7.1, 3.99.99]'
//retrofit pretty logs
implementation('com.github.ihsanbal:LoggingInterceptor:2.0.2') {
exclude group: 'org.json', module: 'json'
}
//barcode scanner
implementation 'com.journeyapps:zxing-android-embedded:3.5.0'
//masking text
implementation 'com.redmadrobot:inputmask:2.3.0'
// Analytics
implementation "com.google.android.gms:play-services-analytics:15.0.0"
implementation 'com.appsflyer:af-android-sdk:4+#aar'
implementation 'com.android.installreferrer:installreferrer:1.0'
//runtime permissions
implementation 'com.karumi:dexter:4.2.0'
//chrome custom tabs
implementation 'saschpe.android:customtabs:1.0.9'
//searching
implementation 'com.algolia:algoliasearch-android:3.+'
//credit card scanner
implementation 'io.card:android-sdk:5.5.1'
//firebase test orchestrator
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestUtil 'com.android.support.test:orchestrator:1.0.1'
//kotlin
//implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
//implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
//kotlin ktx
implementation "androidx.core:core-ktx:$kotlin_ktx_version"
}
apply plugin: 'com.google.gms.google-services' //add to bottom of file
i tried adding the following boolaen to gradle-properties but its not helping: android.enableD8.desugaring = true
im . using gradle wrapper 4.4 but also tried 4.6. instanrun is off. and configure on demand is turned off. but i tried them both on also. i toggled D8 compiler but that did not help.
do you think it something to do with Java runtime Environment? i see the following summary error:
Process 'command '/Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
its my understanding that in gradle i can use implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" and it will figure out which package version to use.
removing the dependency on oneSignal sdk resolved this issue:
remove this line from build.gradle:
implementation 'com.onesignal:OneSignal:3.8.4'
it seems that above dependency works if i remove the following from gradle:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
update: i do not have to remove java 8 features now. i found that if i force all dependencies to be firebase 12.0.1 then it all works. here is my resolution strategy in top level gradle file:
subprojects {
//todo change this to loop once
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.google.android.gms' ||
details.requested.group == 'com.google.firebase') {
details.useVersion(firebase_resolution_version)//firebase_resolution_version being 12.0.1
}
}
}
}
then go into your build.gradle app file and change all dependecies to be 12.0.1 for com.google.android.gms* and com.google.firebase.*
ensure your using classpath 'com.google.gms:google-services:3.2.1' also