How can I define compileOptions of android application within codenameone1? - android

How can I define android's compileOptions within codenameone1 project ?
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Thanks in advance

We don't support that at this time. There's an RFE to add this but I can't seem to find it right now in our issue tracker.
This is a bit problematic as integrating the Android builtin Java 8 support somewhat collides with our builtin Java 8 support. I'm assuming you need this to integrate native Android code, the solution for that is rather simple. Wrap it as an AAR library which is self contained and as such should work regardless of our settings.

The solution that works for me was adding this build hint:
android.xgradle_default_config = compileOptions {sourceCompatibility 1.8; targetCompatibility 1.8}

Related

Kotlin plug-in adds kotlin-stdlib by default

In many android projects, I observed this kotin stdlib dependency being added in the Gradle files. I also observed kotlin and kotlin-android plugin also adds it by default.
I am assuming adding it manually can be avoided? Or is there a downside to it?
org.jetbrains.kotlin:kotlin-stdlib:${versions.kotlin}
Also, I believe
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
}
compileOptions can be safely dropped from 100% kotlin application.
Using kotlinOptions.jvmTarget="11" is there a downside to it, in terms of byte-code generation and byte-code compatibility with other jdk versions.
I am assuming adding it manually can be avoided? Or is there a
downside to it?
https://kotlinlang.org/docs/gradle.html#dependency-on-the-standard-library
There's no downside to it, if you want to add it manually and donot want it to be downloaded by the plugin - set this plugin kotlin.stdlib.default.dependency=false property false in gradle.properties file.
Using kotlinOptions.jvmTarget="11" is there a downside to it, in terms
of byte-code generation and byte-code compatibility with other jdk
versions.
It require AGP 7.0+ to desugar apps for API levels 29 and earlier, while targeting jvmVersion to 8 only requires AGP 3.0+.
Otherwise, byte-code is same.
compileOptions can be safely dropped from 100% kotlin application.
Android projects are not 100% Kotlin, there are generated files like BuildConfig.java.
compileOptions should be there, it can be avoided in 100% Kotlin module.

How to an update opentok latest version in old projects without support Androidx?Is it possible?

I am using opentok version compile 'com.opentok.android:opentok-android-sdk:2.13.0' and i want to upgrade to compile 'com.opentok.android:opentok-android-sdk:2.16.1' but it's said it's necessary to whole project convert into AndroidX.Does it possible it without support AndroidX Please help me on this.
Thanks in Advance
OpenTok 2.16.1 does not require your project to be built with AndroidX support.
What you need to do is to use Java8 by adding this to your project:
android {
...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

Strange problem with Android app and library

I'm having some great code which I would like to share with others. I thought it would be a good idea to wrap the sharable code into an Android Library.
I'm using some foreign code, which requires me to specify this in my build.gradle for the library:
compileOptions {
sourceCompatibility '1.8'
targetCompatibility = '1.8'
}
I had a lot of problems to make some functions run, which ran successfully while they were embedded in my old MainActivity. Now, when they were in the lib it always crashed for unrelated and unclear reasons.
Until - and I admit, I don't really understand, what difference this makes - I specified exactly the same compileOptions regarding source and targetCompatibility in my app's build.gradle.
From that moment on all problems where gone.
Does that make any sense to somebody?

android opennlp build error: cannot access Path class file for java.nio.file.Path not found

I am trying to use apache opennlp library for my android project. But build fails. As instructed in some SO posts I have checked my javac version which is 1.8.0. I have also added following compile options
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
Then build error asked me to enable jack, which I did. But then I got the error mentioned in title. From a SO post I got to learn that not all Java packages are included in Android. So how do I use opennlp in my android project? Are there any other NLP libraries which are easier to integrate/use in Android?
try following
android{
jackOptions {
enabled true
}
}
add this in gradle project level.

Why API 22 insists on attaching to JDK 1.6?

I'm trying to work with Java 1.7 in IntelliJ (Android Studio enough) and I believe I already have Java 1.7 selected, but somehow it insists that my Java version is 1.6 for (API 22). Here are some screenshots:
I have the following in build.gradle:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
I can use 1.7 features, but the dialog box keeps showing 1.6 which makes me feel very uneasy. Am I missing something?
Thanks
Make sure File|Project Structure|SDK Location|JDK Location points to the correct Java

Categories

Resources