Adding API 27 support in Android project producing error - java

I recently upgraded Android studio and added support for API level 27. Created an emulator for API 27 (pixel xl).
The app runs perfectly fine on Nexus 5X emulator, but fails with following error on Pixel XL emulator. Can someone guide me with right direction?\
Error:
java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.localhost.myapp/com.mycompany.myapp.activity.MainActivity}: java.lang.ClassNotFoundException: Didn't find class "com.mycompany.myapp.activity.MainActivity" on path: DexPathList[[zip file "/data/app/com.localhost.myapp-fwgWxCeG6fwAPqPFcI0DsA==/base.apk", zip file "/data/app/com.localhost.myapp-fwgWxCeG6fwAPqPFcI0DsA==/split_lib_directories_apk.apk", zip file "/data/app/com.localhost.myapp-fwgWxCeG6fwAPqPFcI0DsA==/split_lib_resources_apk.apk"],nativeLibraryDirectories=[/data/app/com.localhost.myapp-fwgWxCeG6fwAPqPFcI0DsA==/lib/x86, /system/lib, /vendor/lib]]
Gradle file:
apply plugin: 'com.android.application'
apply plugin: 'org.greenrobot.greendao'
apply plugin: 'io.fabric'
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
defaultConfig {
applicationId 'com.localhost.myapp'
minSdkVersion 21
targetSdkVersion 27
versionCode 5
versionName "1.0.3"
}
buildTypes {
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
packagingOptions {
exclude 'META-INF/ASL2.0'
exclude 'META-INF/LICENSE'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/notice.txt'
}
productFlavors {
localhost {
}
}
applicationVariants.all { variant ->
if (variant.getBuildType().getName() == 'release') {
variant.assemble.doLast {
copy {
from variant.mappingFile
into "proguard"
rename { String fileName ->
"mapping-${variant.name}.txt"
}
}
}
}
}
}
def flavors = []
new File("app/flavors").eachFile() { file ->
def fileName = file.getName()
if (fileName.endsWith('.gradle')) {
flavors.push(fileName)
}
}
flavors.each { flavorName ->
apply from: rootProject.file("app/flavors/$flavorName")
}
greendao {
schemaVersion 1
targetGenDir "src/main/java"
daoPackage "com.mycompany.myapp.dao"
}
dependencies {
ext {
supportLibVersion = '27.1.0'
}
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation project(':aFileChooser')
implementation "com.android.support:support-compat:${supportLibVersion}"
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation "com.android.support:support-v4:${supportLibVersion}"
implementation "com.android.support:cardview-v7:${supportLibVersion}"
implementation "com.android.support:recyclerview-v7:${supportLibVersion}"
implementation "com.android.support:design:${supportLibVersion}"
implementation 'com.google.firebase:firebase-core:16.0.0'
implementation 'com.google.firebase:firebase-messaging:17.0.0'
implementation 'com.google.firebase:firebase-crash:16.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.3'
implementation 'com.google.android:flexbox:0.2.6'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'jp.wasabeef:richeditor-android:1.2.2'
implementation 'org.greenrobot:greendao:3.2.2'
implementation 'org.sufficientlysecure:html-textview:3.1'
testImplementation 'junit:junit:4.12'
}
repositories {
mavenCentral()
}
apply plugin: 'com.google.gms.google-services'
I tried multiDexEnabled true but that did not solve the problem.

After a lot of investigation, I found the "Instant Run" feature is causing the issue. If I disable Instant Run from Android Studio settings, the app is deployed with all source classes.
The side effect is the debugger cannot detect the classes and I cannot debug by placing debug points. If someone has any other solution, I am glad to see that.

Related

The application does not work after publishing in the Google market. R8

I can’t understand why the code stopped working correctly after being published in the Google market in the release branch.
Step 1. Problem of the following character: 1. Turn on "minifyEnabled true", configure the proguard-rules.pro file. I write there the names of classes whose code does not need to be changed (-keep public class myClassName ...)
I check all this on the local computer - everything works (As you can see, the same settings for both release and debug)
I upload to the Google market - a branch of internal testing. Does not work.
Step 2. Turn off "minifyEnabled false".
I upload the code to the Google market in the internal testing branch. Surprisingly, everything works.
Ok, I'm trying to copy the current version from the internal branch to the release branch.
And, after the publication, this version of the application does not work again.
First, I have "minifyEnabled" turned off, but the app behaves like it's enabled. The application also starts to crumble in other places because of the encrypted variables, nonsense is passed to my functions and because of this they break.
Although I also have a "proguard-rules.pro" file with the rules configured correctly.
Step 3. I repeated step 2, only uploaded directly to the release branch, everything is exactly the same. Doesn't want to work.
Files:
plugins {
id 'com.android.application'
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
// Apply the Crashlytics Gradle plugin
apply plugin: 'com.google.firebase.crashlytics'
repositories {
mavenCentral()
}
android {
compileSdkVersion 33
buildToolsVersion "30.0.3"
defaultConfig {
applicationId "com.my.app"
minSdkVersion 23
targetSdkVersion 33
versionCode 40
versionName "1.0"
setProperty("archivesBaseName", applicationId + "-v" + versionCode + "(" + versionName + ")")
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
debug {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildFeatures {
viewBinding true
}
packagingOptions {
resources {
excludes += ['META-INF/DEPENDENCIES', 'META-INF/LICENSE', 'META-INF/LICENSE.txt', 'META-INF/license.txt', 'META-INF/NOTICE', 'META-INF/NOTICE.txt', 'META-INF/notice.txt', 'META-INF/ASL2.0']
}
}
namespace 'com.my.app'
}
dependencies {
//firebase auth
implementation platform('com.google.firebase:firebase-bom:29.1.0')
implementation 'com.google.firebase:firebase-auth:21.1.0'
// google
implementation 'com.google.android.play:core:1.10.3'
implementation 'com.google.android.gms:play-services-games:23.0.0'
implementation 'com.google.android.gms:play-services-auth:20.3.0'
//firebase-crashlytics
implementation 'com.google.firebase:firebase-crashlytics:18.3.1'
implementation 'com.google.firebase:firebase-analytics:21.2.0'
//google billing
implementation "com.android.billingclient:billing:5.0.0"
implementation "com.android.volley:volley:1.2.1"
//default
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.nex3z:flow-layout:1.3.3'
implementation 'androidx.recyclerview:recyclerview:1.2.1'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'org.jetbrains:annotations:16.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
//JUnit 4 Test
testImplementation 'org.junit.jupiter:junit-jupiter:5.8.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "androidx.lifecycle:lifecycle-viewmodel:2.5.1"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1"
}
next file:
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin:secrets-gradle-plugin:2.0.1'
}
}
allprojects {
repositories {
mavenCentral()
google()
}
task clean(type: Delete) {
delete rootProject.buildDir
}
proguard-rules.pro file:
-keep public class myClassName

Android ResourcesNotFoundException on first App start

Whenever I run the app for the first time, I get the following exception
com.mypckg.myapp E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.mypckg.myapp, PID: 6460
android.content.res.Resources$NotFoundException: Resource ID #0x20c0016
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:237)
at android.content.res.Resources.getInteger(Resources.java:1127)
at org.chromium.ui.base.DeviceFormFactor.isTablet(chromium-TrichromeWebViewGoogle.aab-stable-438907233:2)
at Vm.a(chromium-TrichromeWebViewGoogle.aab-stable-438907233:2)
at Lc.run(chromium-TrichromeWebViewGoogle.aab-stable-438907233:3)
at org.chromium.content.browser.BrowserStartupControllerImpl.e(chromium-TrichromeWebViewGoogle.aab-stable-438907233:10)
at org.chromium.content.browser.BrowserStartupControllerImpl.g(chromium-TrichromeWebViewGoogle.aab-stable-438907233:7)
at t6.run(chromium-TrichromeWebViewGoogle.aab-stable-438907233:20)
at org.chromium.base.ThreadUtils.f(chromium-TrichromeWebViewGoogle.aab-stable-438907233:2)
at sp0.j(chromium-TrichromeWebViewGoogle.aab-stable-438907233:32)
at rp0.run(chromium-TrichromeWebViewGoogle.aab-stable-438907233:2)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7682)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)
Then when I open the app for the second,third time, it works fine.
I am guessing this might be due to some libraries, so here is my app.gradle file
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'dagger.hilt.android.plugin'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
android {
compileSdkVersion 29
buildToolsVersion "30.0.1"
defaultConfig {
applicationId "com.mypckg.myapp"
minSdkVersion 19
targetSdkVersion 29
versionCode 16
versionName "1.0.17"
multiDexEnabled true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
setProperty("archivesBaseName", "MyApp"+ versionName +"_"+new Date().format( 'yyyy-MM-dd HH:mm' ))
}
buildTypes {
debug {
buildConfigField "String", 'BASE_URL', '"https://baseurl.com/"'
}
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
buildConfigField "String", 'BASE_URL', '"https://baseurl.com/"'
}
}
viewBinding {
enabled = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8.toString()
}
}
dependencies {
def room_version = '2.2.6'
def retrofitVersion = '2.8.1'
def okhttpVersion = '4.5.0'
def daggerVersion = '2.31.2'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.3.2'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.material:material:1.4.0-alpha01'
implementation "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-runtime:$room_version"
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.3.0"
implementation 'androidx.fragment:fragment-ktx:1.3.0'
implementation "com.github.doyaaaaaken:kotlin-csv-jvm:0.11.0"
implementation "com.squareup.retrofit2:retrofit:$retrofitVersion"
implementation "com.squareup.retrofit2:converter-gson:$retrofitVersion"
implementation "com.squareup.okhttp3:okhttp:$okhttpVersion"
implementation "com.squareup.okhttp3:logging-interceptor:$okhttpVersion"
implementation 'com.squareup.retrofit2:adapter-rxjava2:2.3.0'
implementation "com.google.dagger:dagger:$daggerVersion"
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
implementation "com.google.dagger:hilt-android:2.31.2-alpha"
kapt "com.google.dagger:hilt-android-compiler:2.31.2-alpha"
implementation 'androidx.hilt:hilt-lifecycle-viewmodel:1.0.0-alpha03'
kapt 'androidx.hilt:hilt-compiler:1.0.0-alpha03'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.6'
implementation 'com.github.quickpermissions:quickpermissions-kotlin:0.4.0'
implementation 'com.facebook.android:audience-network-sdk:5.10.0'
implementation platform('com.google.firebase:firebase-bom:26.6.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.4'
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
and this is my project level build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = "1.4.31"
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.dagger:hilt-android-gradle-plugin:2.28-alpha'
classpath 'com.google.gms:google-services:4.3.5'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.5.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "http://jitpack.io/" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Any help would be highly appreciated. Thanks
This issue was also mentioned in Samsung Developer Forum, but no solution offered. See https://forum.developer.samsung.com/t/android-content-res-resources-notfoundexception-in-org-chromium-ui-base-deviceformfactor-istablet/17544/4
Is there any more information on this issue? I see it in my app too. Initially I saw it ONLY on Samsung S21 phones with Android 12, now I got also a crash report on Crashlytics on one Pixel 3 phone with Android 12, and several on Samsung S21 with Android 11… It happens most often on this call:
String uas = WebSettings.getDefaultUserAgent(context);
I suspect that it happens only if called when no WebView control was created yet, as so far I did not find crashes from similar calls later in the app, when the control was created in it. Surrounding this line with try - catch does not help, as the crash seems to happen in another thread.
Greg
I have the same issue,
due I move MobileAds.initialize from the Application class to another class.
You can try to init MobileAds.initialize at Application class

Android Gradle jar generation

I have an Android Project with a working build.gradle file. This is used to build an Android App. Additionally now I'd like to add my server code (plain java) to this project and setup the build.gradle file to run/start the emulator app like normal and also generate a jar file of the server code, which I can deploy onto my server.
I am new to Gradle and Groovy, so I am not sure about how to write the tasks correctly to achive my goal as described above. I'd really apprechiate some help in setting up this build file. I know I'll need the jar and java plugins but can't seem to figure out how to integrate everything into the Android build.
What I have so far in the (working) build file:
apply plugin: 'com.android.application'
apply plugin: 'jacoco'
android {
compileSdkVersion 29
buildToolsVersion '29.0.3'
defaultConfig {
applicationId "com.example.myapp"
minSdkVersion 19
targetSdkVersion 28
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 = 1.8
targetCompatibility = 1.8
}
}
task jacocoTestReport(type: JacocoReport, dependsOn: 'testDebugUnitTest') {
reports {
xml.enabled = true
html.enabled = true
}
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*']
def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"
sourceDirectories = files([mainSrc])
classDirectories = files([debugTree])
executionData = files("${buildDir}/jacoco/testDebugUnitTest.exec")
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
// https://mvnrepository.com/artifact/com.esotericsoftware/kryonet
implementation 'com.esotericsoftware:kryonet:2.22.0-RC1'
}

INSTALL_FAILED_NO_MATCHING_ABIS on Emulator Oreo and Real Device also

No problem on running other devices lollipop,marshmallow,nougat emulators and real devices. Oreo 8 doesnot support. showing this error INSTALL_FAILED_NO_MATCHING_ABIS .
gradle below
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.paulcart.administrator.wibslink"
minSdkVersion 21
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'
}
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
}
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-
core:2.2.2', {
exclude group: 'com.android.support', module: 'support-
annotations'
})
compile files('libs/PhotoUtil.jar')
compile files('libs/GenAsync.1.2.jar')
compile 'com.wajahatkarim3.EasyFlipView:EasyFlipView:1.0.0'
compile 'com.jakewharton:butterknife:8.5.1'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'org.apache.directory.studio:org.apache.commons.io:2.4'
testCompile 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.github.amlcurran.showcaseview:library:5.4.3'
}
android {
useLibrary 'org.apache.http.legacy'
}
android { sourceSets { main { res.srcDirs = ['src/main/res',
'src/main/res/layout-land'] } } }
tried this to
splits {
abi {
enable true
reset()
include 'x86', 'armeabi-v7a'
universalApk true
}
}
However this did not work, in order to make sure that the problem was with the Oreo 8.0 Emulator and I checked a OREO Real device too and problem still exists
Help me to solve this.
8.0 is much more strict about what's in the lib folder
extract apk file, see what's under lib/
use packagingOptions to exclude non so files under lib/
example(in android block):
packagingOptions {
exclude 'lib/commons-lang-2.6.jar'
}
Reference: https://issuetracker.google.com/issues/65941637

Android Studio 3.0 Unresolved reference: SupportedLanguages for AIConfiguration class in Dialogflow(api.ai)

I am building a chatbot Android app in Kotlin, through queries to a Dialogflow agent. I am using the Dialogflow android client github repository Readme and the sample app provided in that repository as the basis to build the app. As referenced in the above sources, java code for AIConfiguration.SupportedLanguages works fine:
import ai.api.android.AIConfiguration;
.....
private void initService(final LanguageConfig selectedLanguage) {
final AIConfiguration.SupportedLanguages lang = AIConfiguration.SupportedLanguages.fromLanguageTag(selectedLanguage.getLanguageCode());
.....
You can find the full usage of this here.
When I am implementing this in Kotlin:
import ai.api.android.AIConfiguration
....
private fun initService() {
//final AIConfiguration.SupportedLanguages lang = AIConfiguration.SupportedLanguages.fromLanguageTag(selectedLanguage.getLanguageCode());
val config = AIConfiguration(CLIENT_ACCESS_TOKEN,
AIConfiguration.SupportedLanguages.EnglishGB,
AIConfiguration.RecognitionEngine.System)
....
in Android 3.0 I am getting a gradle error of "Unresolved reference: SupportedLanguages" for AIConfiguration.SupportedLanguages. AIConfiguration.RecognitionEngine is resolving just fine. Why is this problem happening? What solution/work-around can I implement?
My higher level build.gradle file:
apply plugin: 'com.android.feature'
android {
compileSdkVersion 27
baseFeature true
defaultConfig {
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.1'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
api 'com.android.support:appcompat-v7:27.0.0'
api 'com.android.support:design:27.0.0'
api 'com.android.support.constraint:constraint-layout:1.0.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'ai.api:sdk:2.0.7#aar'
compile 'ai.api:libai:1.6.12'
//compile project(':ailib')
application project(':app')
feature project(':chatbot')
}
My module build.gradle file:
apply plugin: 'com.android.feature'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 27
defaultConfig {
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '27.0.1'
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jre8:$kotlin_version"
implementation project(':base')
//add the google gson library
compile 'com.google.code.gson:gson:2.8.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'
}
One workaround I found that is working is to use ai.api.AIConfiguration.SupportedLanguages which is resolving instead of ai.api.android.AIConfiguration.SupportedLanguages which is not resolving in kotlin in Android Studio 3.0 as mentioned in the question.
However, calling ai.api.android.AIConfiguration.SupportedLanguages works just fine in Java code, in which case it is resolving correctly in Android Studio 3.0. Since ai.api.android.AIConfiguration implements ai.api.AIConfiguration, why this issue is arising is puzzling!
Just use this line instead of previous -
ai.api.AIConfiguration.SupportedLanguages.English,

Categories